Random Variables

1 min read

A random variable XX is a function from outcomes to numbers, equipped with a probability distribution describing the likelihood of each value.

Discrete RVs:

  • PMF (probability mass function): p(x)=P(X=x)p(x) = P(X = x), must satisfy ∑xp(x)=1\sum_x p(x) = 1
  • Example: coin flip, dice roll, word count

Continuous RVs:

  • PDF (probability density function): f(x)f(x) where P(a≤X≤b)=∫abf(x)dxP(a \leq X \leq b) = \int_a^b f(x)dx
  • f(x)≥0f(x) \geq 0 and ∫−∞∞f(x)dx=1\int_{-\infty}^{\infty} f(x)dx = 1
  • Note: f(x)f(x) can exceed 1; it's a density, not a probability

CDF (cumulative distribution function): F(x)=P(X≤x)F(x) = P(X \leq x)

  • Works for both discrete and continuous
  • Non-decreasing, right-continuous, F(−∞)=0F(-\infty) = 0, F(∞)=1F(\infty) = 1
  • For continuous RVs: f(x)=F′(x)f(x) = F'(x)

Joint distributions: p(x,y)p(x, y) for two RVs. Marginal: p(x)=∑yp(x,y)p(x) = \sum_y p(x,y). Conditional: p(x∣y)=p(x,y)/p(y)p(x|y) = p(x,y)/p(y).

Independence: X⊥YX \perp Y iff p(x,y)=p(x)p(y)p(x,y) = p(x)p(y) for all x,yx, y.

See also: Expectation and Variance, Key Probability Distributions, Bayes' Theorem

Linked from