Random variables

Definition (random variables) open_in_new

In a probability space $(\Omega, \mathcal F, \prob)$, a random variable is a function $$X: \Omega \to \R$$ such that for all $x\in\R$, $\sb{\omega\in\Omega}{X(\omega)\leq x} \in \mathcal F$.

We write $\set{X\leq x} \equiv \sb{\omega\in\Omega}{X(\omega)\leq x}$.

More generally, a random variable in $\R^n$ is a function $$ \v X = (X_1, \ldots, X_n): \Omega \to \R^n $$ such that $$\set{X_1\leq x_1, \ldots, X_n\leq x_n}\in\mathcal F.$$

Definition (distribution function) open_in_new

The distribution function of a random variable $X$ is the function $F_X: \R \to [0,1]$ given by $$ F_X(x) = \prob(X\leq x). $$

For a random variable $\v X$ on $\R^n$, the distribution function of $\v X$ (also called the joint distribution function $X_1, \ldots, X_n$) is defined as $F_{\v X}: \R^n \to [0,1]$ by $$ F_{\v X}(x_1, x_2, \ldots, x_n) = \prob(X_1\leq x_1,\ \ldots,\ X_n\leq x_n). $$

Properties of a distribution function:

Definition (independent random variables) open_in_new

Random variables $X_1, X_2, \ldots, X_n$ are independent if the joint distribution function factorises: $$ F_{X_1,\ldots,X_n}(x_1,\ldots,x_n) = F_{X_1}(x_1) \times\ldots\times F_{X_n}(x_n).$$

In particular for discrete random variables, this is equivalent to $$ \prob(X_1 = x_1, \ldots, X_n = x_n) = \prob(X_1=x_1) \times \ldots \times \prob(X_n = x_n), $$ and for absolutely continuous random variables, the joint probability density function factorises.

Lemma (sum of random variables) open_in_new

Suppose $X,Y$ are random variables with values in $\set{0,1,2,\ldots}$ and $X,Y$ are independent. Then the probabilities for $X+Y$ are given by the convolution $$ \prob(X+Y=n) = \sum_{k=1}^n \prob(X=k)\, \prob(Y=n-k). $$

Proof

Expectation open_in_new

Definition (non-negative random variable) open_in_new

For a probability space $(\Omega, \mathcal F, \prob)$, a function $$ X: \Omega \to [0, \infty] $$ is a non-negative random variable if $$ \set{X\leq x}\in\mathcal F \quad\forall x\geq 0. $$

Denote $\mathcal F^+$ for the set of all non-negative random variables.

$X(\omega)$ can be $\infty$ for non-negative random variable but not for random variable.

Theorem (uniqueness of expectation) open_in_new

There is a unique map, called the expectation, $$ \expect: \mathcal F^+ \to [0,\infty] $$ satisfying

  1. $\expect(1_A) = \prob(A)$ for all $A\in\mathcal F$;

  2. $\expect(\lambda X) = \lambda\expect(X)$ for all $\lambda\in[0,\infty)$ and $X\in\mathcal F^+$;

  3. $\expect(\sum_n X_n) = \sum_n \expect(X_n)$ for all sequences $(X_n)_{n\in\N}$ in $\mathcal F^+$.

Proof for $\Omega$ countable

Definition (integrable, square-integrable) open_in_new

A random variable $X$ is

  • integrable if $\expect|X| < \infty$.

  • square-integrable if $\expect(X^2) < \infty$.

Denote $L'(\prob)$ be the set of integrable random variables.

Definition (expectation of integrable random variable) open_in_new

For an integrable random variable $X\in L'(\prob)$, define $$ \expect(X) = \expect(X^+) - \expect(X^-) $$ where $X^+ = \max\set{X,0}$ and $X^- = \max\set{-X, 0}$.

Properties of expectation:

  • $\expect(X+Y) = \expect(X) + \expect(Y)$ holds for $X,Y\in\mathcal F^+$ (derivation) and also for $X,Y\in L'(\prob)$ (derivation).

  • If $X(\omega)\leq Y(\omega)$ for all $\omega\in\Omega$, then $\expect(X)\leq\expect(Y)$ for both $X,Y\in\mathcal F^+$ and $L'(\prob)$. (Derivation)

  • $\expect(\lambda X) = \lambda \expect(X)$ for all $\lambda\in\R$ and $X,Y\in L'(\prob)$ (derivation).

  • For $X\in\mathcal F^+$ (not $L'(\prob)$), $\expect(X)=0 \iff \prob(X=0)=1$. (Derivation)

Lemma (expectation for discrete random variable) open_in_new

For a discrete random variable $X$ taking values $(x_n:n\in\N)$ and a function $f$, $$ \expect\big(f(X)\big) = \sum_n f(x_n)\,\prob(X=x_n) $$ provided that $f$ is non-negative, or $f(X)$ is integrable.

Proof

In particular, if $X$ is non-negative or integrable, $$ \expect(X) = \sum_n x_n\, \prob(X=x_n). $$

Lemma (expectation of product of independent random variables) open_in_new

For independent random variables $X,Y$ and functions $f,g$, $$ \expect\big(f(X) g(Y)\big) = \expect\big(f(X)\big) \expect\big(g(Y)\big) $$ provided that $f,g$ are non-negative, or $f(X),g(Y)$ are integrable.

Proof for X,Y discrete

Lemma (expectation as sum of probabilities) open_in_new

For non-negative integer-valued random variable $X$, $$ \expect(X) = \fsum n1\infty \prob(X\geq n). $$ Proof

For a general non-negative random variable $X$, $$\expect(X) = \int_0^\infty \prob(X\geq x)\,dx. $$ Proof requiring Fubini's theorem

Definition (expectation of multivariate random variable) open_in_new

The expectation of a random variable $\v X=(X_1, X_2, \ldots, X_n)$ in $\R^n$ is obtained by taking expectation of each of the components: $$ \begin{align*} \expect(\v X) = \left(\expect(X_1), \expect(X_2), \ldots, \expect(X_n)\right). \end{align*} $$

Variance and covariance open_in_new

Definition (variance) open_in_new

For an integrable random variable $X$ having mean $\mu\in\R$, the variance of $X$ is $$ \operatorname{var}(X) = \expect\big((X-\mu)^2\big). $$

Equivalently (derivation), $$ \operatorname{var}(X) = \expect(X^2) - \expect(X)^2. $$

We see that $\expect(X)^2 \leq \expect(X^2)$, so square-integrable implies integrable.

For $X$ integrable discrete with mean $\mu$, $$\operatorname{var}(X) = \sum_n (x_n-\mu)^2\,\prob(X=x_n).$$

Definition (standard deviation) open_in_new

The standard deviation of an integrable random variable $X$ is $\sqrt{\operatorname{var}(X)}$.

Definition (covariance) open_in_new

For square-integrable random variables $X$, $Y$ with means $\mu$, $\nu$, the covariance is defined by $$ \operatorname{cov}(X,Y) = \expect\big((X-\mu)(Y-\nu)\big). $$ (Derivation that $(X-\mu)(Y-\nu)$ is integrable)

Equivalently (derivation), $$ \op{cov}(X,Y) = \expect(XY) - \expect(X)\expect(Y). $$

Definition (correlation) open_in_new

The correlation of two square-integrable random variables $X,Y$ is $$ \begin{align*} \op{corr}(X,Y) = \frac{\cov(X,Y)}{\sqrt{\var(X)}\sqrt{\var(Y)}}. \end{align*} $$

Cauchy-Schwarz inequality implies $\op{corr}(X,Y)\in[-1,1]$.

Lemma (variance of sum) open_in_new

For square-integrable random variables $X,Y$, $$ \op{var}(X+Y) = \op{var}(X) + 2\op{cov}(X,Y) + \op{var}(Y). $$

Proof

Lemma (independent implies zero covariance) open_in_new

If $X,Y$ are independent, then $\op{cov}(X,Y)=0$.

Proof: $\expect(XY) = \expect(X) \expect(Y)$.

Converse not true: example.

Variance of indicator function open_in_new

For all $A\in\mathcal F$, if $\prob(A) = p$, then $$ \begin{align*} \op{var}(1_A) &= \expect({1_A}^2) - \expect(1_A)^2 \\ &= p - p^2. \end{align*} $$

Definition (variance of multivariate random variable) open_in_new

The variance of a random variable $\v X=(X_1, X_2, \ldots, X_n)$ in $\R^n$ is its covariance matrix $$ \begin{align*} \op{var}(\v X) = (\op{cov}(X_i, X_j))_{i,j=1}^n = \expect\big[ (\v X-\expect(\v X))(\v X-\expect(\v X))^T \big]. \end{align*} $$

Conditional expectation open_in_new

Definition (conditional expectation) open_in_new

For a non-negative of integrable random variable $X$ and an event $B$ of positive probability, define the condition expectation of $X$ given $B$ by $$ \expect(X|B) = \frac{\expect(X1_B)}{\prob(B)}. $$

Law of total expectation open_in_new

Given disjoint events $(B_n: n\in\N)$ of positive probabilities such that $\bigcup_n B_n = \Omega$, we have $$ \expect(X) = \sum_n \expect(X|B_n) \prob(B_n). $$

Proof

Inequalities on random variables open_in_new

Proposition (Markov's inequality in probability) open_in_new

Let $X$ be a non-negative random variable and let $\lambda\in(0,\infty)$. Then $$ \prob(X\geq \lambda) \leq \frac{\expect(X)}\lambda. $$

In general, for any random variable $X$ and a non-decreasing non-negative function $f$, $$ \prob(X\geq\lambda) \leq \frac{\expect(f(X))}{f(\lambda)}.$$

Proof

Proposition (Chebyshev's inequality) open_in_new

Let $X$ be a square integrable random variable with mean $\mu$ and variance $\sigma^2$. ($\sigma^2<\infty$ since square integrable.) Then for all $k\in(0,\infty)$, $$ \prob(|X-\mu|\geq k\sigma) \leq \frac{1}{k^2}. $$ In another form, for all $\lambda\in(0,\infty)$, $$ \begin{align*} \prob(|X-\mu|\geq \lambda) \leq \frac{\sigma^2}{\lambda^2}. \end{align*} $$

Proof

Proposition (Cauchy-Schwarz inequality for expectation) open_in_new

For all random variables $X,Y$, $$ \expect(|XY|) \leq \sqrt{\expect(X^2)} \sqrt{\expect(Y^2)}. $$ (RHS takes the convention of $0\times\infty = 0$.)

If $\expect(X^2),\expect(Y^2)\in(0,\infty)$, then equality holds iff $\prob(Y=tX)=1$ for some $t\in\R$.

Proof

Proposition (Jensen's inequality) open_in_new

Let $X$ be an integrable random variable with values in an interval $I$, and let $f$ be a convex function on $I$. Then $$ f(\expect(X)) \leq \expect(f(X)). $$

If $f$ is strictly convex, then equality holds iff $\prob(X=m) = 1$ for some $m\in I$.

Proof

Proposition (AM-GM inequality) open_in_new

Let $x_1,x_2,\ldots,x_n\in\R$. Then $$\bigg(\for\prod k1n x_k\bigg)^{1/n} \leq \frac1n\fsum k1n x_k.$$

Proof