Skip to content

Random Variables | Mathematics

Definition. A random variable is a measurable function X:ΩRX : \Omega \to \mathbb{R}. The cumulative distribution function (CDF) of XX is

FX(x)=P(Xx)F_X(x) = P(X \leq x)

Proposition 2.1 (Properties of the CDF).

  1. FF is non-decreasing: if aba \leq b Then F(a)F(b)F(a) \leq F(b).
  2. limxF(x)=0\lim_{x \to -\infty} F(x) = 0 and limx+F(x)=1\lim_{x \to +\infty} F(x) = 1.
  3. FF is right-continuous: limxa+F(x)=F(a)\lim_{x \to a^+} F(x) = F(a).

Proof. (1) If aba \leq b Then {Xa}{Xb}\{X \leq a\} \subseteq \{X \leq b\} So F(a)=P(Xa)P(Xb)=F(b)F(a) = P(X \leq a) \leq P(X \leq b) = F(b) by Proposition 1.1(3).

(2) As xx \to -\inftyThe events {Xx}\{X \leq x\} decrease to \emptyset So by continuity from above of probability measures, F(x)0F(x) \to 0. As x+x \to +\inftyThe events increase to Ω\Omega So F(x)1F(x) \to 1.

(3) As xa+x \to a^+The events {Xx}\{X \leq x\} decrease to {Xa}\{X \leq a\}Giving right-continuity. \blacksquare

A random variable is discrete if its range is countable. The probability mass function (PMF) is pX(x)=P(X=x)p_X(x) = P(X = x).

Definition (Expected Value). For a discrete random variable:

E[X]=xxpX(x)E[X] = \sum_{x} x\, p_X(x)

Provided the sum converges absolutely.

Definition (Variance). Var(X)=E[(Xμ)2]=E[X2](E[X])2\mathrm{Var}(X) = E[(X - \mu)^2] = E[X^2] - (E[X])^2 where μ=E[X]\mu = E[X].

Proposition 2.2 (Linearity of Expectation). E[aX+bY]=aE[X]+bE[Y]E[aX + bY] = aE[X] + bE[Y] for any random variables XX, YY and constants aa, bb.

Proof. Direct computation from the definition of expected value. For the discrete case:

E[aX+bY]=x,y(ax+by)pX,Y(x,y)=axxpX(x)+byypY(y)=aE[X]+bE[Y]E[aX + bY] = \sum_{x,y} (ax + by)\, p_{X,Y}(x,y) = a\sum_x x\, p_X(x) + b\sum_y y\, p_Y(y) = aE[X] + bE[Y]

\blacksquare

A random variable is continuous if its CDF is absolutely continuous, i.e., there exists a probability density function (PDF) fXf_X such that

FX(x)=xfX(t)dtF_X(x) = \int_{-\infty}^{x} f_X(t)\, dt

Key properties:

  1. fX(x)0f_X(x) \geq 0 for all xx.
  2. fX(x)dx=1\int_{-\infty}^{\infty} f_X(x)\, dx = 1.
  3. P(aXb)=abfX(x)dxP(a \leq X \leq b) = \int_a^b f_X(x)\, dx.
  4. P(X=a)=0P(X = a) = 0 for any single point aa.

Discrete distributions:

DistributionPMFE[X]E[X]Var(X)\mathrm{Var}(X)
Bernoulli(p)(p)px(1p)1xp^x(1-p)^{1-x}, x{0,1}x \in \{0,1\}ppp(1p)p(1-p)
Binomial(n,p)(n,p)(nx)px(1p)nx\binom{n}{x}p^x(1-p)^{n-x}npnpnp(1p)np(1-p)
Poisson(λ)(\lambda)eλλx/x!e^{-\lambda}\lambda^x / x!λ\lambdaλ\lambda
Geometric(p)(p)(1p)x1p(1-p)^{x-1}p, x1x \geq 11/p1/p(1p)/p2(1-p)/p^2

Continuous distributions:

DistributionPDFE[X]E[X]Var(X)\mathrm{Var}(X)
Uniform(a,b)(a,b)1/(ba)1/(b-a) on [a,b][a,b](a+b)/2(a+b)/2(ba)2/12(b-a)^2/12
Exponential(λ)(\lambda)λeλx\lambda e^{-\lambda x}, x0x \geq 01/λ1/\lambda1/λ21/\lambda^2
N(μ,σ2)N(\mu, \sigma^2)1σ2πe(xμ)2/(2σ2)\frac{1}{\sigma\sqrt{2\pi}}e^{-(x-\mu)^2/(2\sigma^2)}μ\muσ2\sigma^2

Definition. XN(μ,σ2)X \sim N(\mu, \sigma^2) if XX has PDF f(x)=1σ2πexp((xμ)22σ2)f(x) = \frac{1}{\sigma\sqrt{2\pi}}\exp\left(-\frac{(x-\mu)^2}{2\sigma^2}\right).

Theorem 2.3 (Standardisation). If XN(μ,σ2)X \sim N(\mu, \sigma^2) Then Z=(Xμ)/σN(0,1)Z = (X - \mu)/\sigma \sim N(0, 1).

Proof. The CDF of ZZ: P(Zz)=P(Xμ+σz)=μ+σz1σ2πet2/2dtP(Z \leq z) = P(X \leq \mu + \sigma z) = \int_{-\infty}^{\mu + \sigma z} \frac{1}{\sigma\sqrt{2\pi}} e^{-t^2/2}\, dt. Substituting u=(tμ)/σu = (t - \mu)/\sigma: =z12πeu2/2du= \int_{-\infty}^{z} \frac{1}{\sqrt{2\pi}} e^{-u^2/2}\, duWhich is the CDF of N(0,1)N(0, 1). \blacksquare

Theorem 2.4 (Moment Generating Function). If XN(μ,σ2)X \sim N(\mu, \sigma^2) Then

MX(t)=E[etX]=exp(μt+σ2t22)M_X(t) = E[e^{tX}] = \exp\left(\mu t + \frac{\sigma^2 t^2}{2}\right)

Proof. MX(t)=etx1σ2πe(xμ)2/(2σ2)dxM_X(t) = \int_{-\infty}^{\infty} e^{tx} \frac{1}{\sigma\sqrt{2\pi}} e^{-(x-\mu)^2/(2\sigma^2)}\, dx. Completing the square in the exponent and evaluating the Gaussian integral gives the result. \blacksquare

Definition. The moment generating function (MGF) of XX is MX(t)=E[etX]M_X(t) = E[e^{tX}] (when it exists in a neighbourhood of t=0t = 0).

Theorem 2.5. If the MGF exists in a neighbourhood of 0, it uniquely determines the distribution. Furthermore, E[Xn]=MX(n)(0)E[X^n] = M_X^{(n)}(0).

A random variable is a function that converts uncertain outcomes into numbers, making it possible to compute averages, variances, and probabilities of numerical events. The cumulative distribution function FX(x)=P(Xx)F_X(x) = P(X \leq x) tells you the probability that XX falls at or below a given value, and it completely determines the distribution of XX. For discrete random variables, the probability mass function gives the probability at each point. For continuous random variables, the probability density function gives the “rate” at which probability accumulates, and probabilities are computed by integrating.

Expected value is the long-run average: if you repeated an experiment infinitely many times and averaged the results, the expected value is what you would converge to. Variance measures spread around the mean. The normal distribution is special because the central limit theorem shows that sums of many independent random variables, regardless of their original distribution, tend toward a normal distribution. Moment generating functions encode all moments of a distribution into a single function, and they convert the hard operation of convolution (adding independent random variables) into the easy operation of multiplication.

Problem. Let XPoisson(3)X \sim \mathrm{Poisson}(3) and YPoisson(5)Y \sim \mathrm{Poisson}(5) be independent. Find the distribution of X+YX + Y.

Solution

The MGF of XPoisson(λ)X \sim \mathrm{Poisson}(\lambda) is MX(t)=eλ(et1)M_X(t) = e^{\lambda(e^t - 1)}.

MX+Y(t)=MX(t)MY(t)=e3(et1)e5(et1)=e8(et1)M_{X+Y}(t) = M_X(t) \cdot M_Y(t) = e^{3(e^t - 1)} \cdot e^{5(e^t - 1)} = e^{8(e^t - 1)}.

This is the MGF of Poisson(8)\mathrm{Poisson}(8). Since the MGF uniquely determines the distribution, X+YPoisson(8)X + Y \sim \mathrm{Poisson}(8).

\blacksquare

Worked Example: Minimum of Exponential Random Variables

Solution. Let X1,,XnX_1, \ldots, X_n be independent with XiExp(λi)X_i \sim \mathrm{Exp}(\lambda_i). Find the distribution of M=min(X1,,Xn)M = \min(X_1, \ldots, X_n).

P(M>t)=P(X1>t,,Xn>t)=i=1nP(Xi>t)=i=1neλit=e(λ1++λn)tP(M > t) = P(X_1 > t, \ldots, X_n > t) = \prod_{i=1}^{n} P(X_i > t) = \prod_{i=1}^{n} e^{-\lambda_i t} = e^{-(\lambda_1 + \cdots + \lambda_n)t}

So P(Mt)=1eλtP(M \leq t) = 1 - e^{-\lambda t} where λ=i=1nλi\lambda = \sum_{i=1}^{n} \lambda_i. This means MExp(λ)M \sim \mathrm{Exp}(\lambda). \blacksquare

Mistake 1: Confusing P(AB)P(A|B) with P(BA)P(B|A). The conditional probability P(AB)=P(AB)/P(B)P(A|B) = P(A \cap B)/P(B) is not the same as P(BA)=P(AB)/P(A)P(B|A) = P(A \cap B)/P(A). These are equal only when P(A)=P(B)P(A) = P(B). A common error is to assume that if P(AB)P(A|B) is high, then P(BA)P(B|A) is also high. This is the basis of the prosecutor’s fallacy.

Mistake 2: Assuming that independence implies uncorrelatedness. If two random variables XX and YY are independent, then they are uncorrelated (their covariance is zero). However, the converse is not true: uncorrelated variables can be dependent. For example, let XX be uniform on {1,0,1}\{-1, 0, 1\} and Y=X2Y = X^2. Then XX and YY are uncorrelated but not independent.

Mistake 3: Forgetting Bayes’ theorem. Bayes’ theorem states that P(AB)=P(BA)P(A)/P(B)P(A|B) = P(B|A)P(A)/P(B). A common mistake is to ignore the prior P(A)P(A) and the evidence P(B)P(B), leading to incorrect updates of probabilities. Always use the full form of Bayes’ theorem when updating beliefs based on new evidence.

Mistake 4: Confusing the expectation of a product with the product of expectations. E[XY]=E[X]E[Y]E[XY] = E[X]E[Y] holds only when XX and YY are independent (or uncorrelated). as a rule, E[XY]E[X]E[Y]E[XY] \neq E[X]E[Y]. Do not assume that the expectation of a product factors without checking independence.

Mistake 5: Forgetting that variance is not linear. Var(aX+b)=a2Var(X)\mathrm{Var}(aX + b) = a^2 \mathrm{Var}(X), not aVar(X)+ba \mathrm{Var}(X) + b. The variance of a sum is Var(X+Y)=Var(X)+Var(Y)+2Cov(X,Y)\mathrm{Var}(X + Y) = \mathrm{Var}(X) + \mathrm{Var}(Y) + 2\mathrm{Cov}(X, Y). If XX and YY are independent, then Var(X+Y)=Var(X)+Var(Y)\mathrm{Var}(X + Y) = \mathrm{Var}(X) + \mathrm{Var}(Y), but this does not hold as a rule.

flowchart TD
A[2_Random Variables] --> B[Key Concepts]
A --> C[Core Principles]
A --> D[Practical Applications]
B --> E[Fundamental definitions]
C --> F[Design patterns]
D --> G[Real-world usage]