IA Probability

Probability space open_in_new

Definition (sigma-algebra, measurable space) open_in_new

Let $E$ be a set.

A set $\mathcal A\subseteq\mathcal P(E)$ of subsets of $\Omega$ is a $\sigma$-algebra or tribe on $E$ if it satisfies

  • $E \in \mathcal A$;

  • stability by complementation: $A^\complement\in\mathcal F$ for all $A\in\mathcal F$; and

  • stability by countable unions: if $(A_n)_{n\in\N}$ is a countable sequence in $\mathcal A$, then $\bigcup_{n\in\N} A_n \in \mathcal A$.

Equivalently:

Elements of $\mathcal{A}$ are called measurable sets, and $(E,\mathcal{A})$ is called a measurable space.

  • Every set $E$ admits the full tribe $\mathcal{P}(E)$ and the trivial tribe $\set{\emptyset, E}$.

  • If $(\mathcal{A}_i)_{i\in I}$ is a collection of $σ$-algebras on $E$, then $\bigcap_{i\in I} \mathcal{A}_i$ is also a $σ$-algebra on $E$.

Definition (probability measure) open_in_new

Let $\mathcal F$ be a $\sigma$-algebra on $\Omega$. A function $\mathbb P: \mathcal F \to [0,1]$ is a probability measure on $\mathcal F$ if it satsifies

  • $P(\Omega) = 1$; and

  • countable additivity: for any sequences $(A_n)_{n\in\N}$ of disjoint elements in $\mathcal F$, $$ \mathbb P\Big(\bigcup_n A_n\Big) = \sum_n \mathbb P(A_n). $$

Definition (probability space) open_in_new

A triple $(\Omega, \mathcal F, \mathbb P)$ is a probability space when $\mathcal F$ is a $\sigma$-algebra of $\Omega$ and $\mathbb P$ is a probability measure on $\mathcal F$.

We interpret:

  • elements in $\Omega$ as outcomes;

  • elements in $\mathcal F$ as events;

  • $\mathbb P(A)$ as the probability of the event $A\in\mathcal F$.

Classical probability open_in_new

In classical probability,

  • $\Omega$ is a finite set.

  • $\mathcal F = \mathcal P(\Omega)$.

  • We model all outcomes as equally likely, so $$\mathbb P(A) = \frac{|A|}{|\Omega|}.$$

Examples: throwing a dice, balls from a bag, well-shuffled pack of card, distribution of the largest digit, birthdays

Basic properties of probability measures open_in_new

Let $(\Omega, \mathcal F, \mathbb P)$ be a probability space.

Lemma (union bound of probability) open_in_new

For every sequence $(A_n)_{n\in\N}$ in $\mathcal F$, $$ \mathbb P\Big(\bigcup_{n\in\N} A_n\Big) \leq \sum_{n\in\N} \mathbb P(A_n). $$

Proof

This is useful for showing $\prob=0$ or $1$.

Lemma (continuity of probability) open_in_new

Let $(A_n)_{n\in\N}$ be a sequence of $\mathcal F$ and suppose $A_n\subseteq A_{n+1}$ for all $n$. Then $$ \mathbb P(A_n) \to \mathbb P\Big(\bigcup_n A_n\Big) \quad\text{as } n\to\infty. $$

Equivalently, let $(C_n)_{n\in\N}$ be a sequence of $\mathcal F$ and suppose $C_n \supseteq C_{n+1}$ for all $n$. Then $$ \prob(C_n) \to \prob\Big(\bigcap_n C_n\Big) \quad\text{as } n\to\infty. $$

Proof

Theorem (Borel-Cantelli lemma) open_in_new

For a sequence of events $(A_n: n\in\N)$, let $A$ be the event where $A_n$ happens infinitely often: $$ A = \sb{\omega\in \Omega}{\omega\in A_n \text{ infintiely often}}. $$

Then

  • if $\sum\prob(A_n)$ converges, then $\prob(A) = 0$; (Example sheet 1 Q6)

  • provided that $(A_n)$ are independent, if $\sum\prob(A_n)=\infty$, then $\prob(A)=1$. (Non-examinable)

Proof

Dropping the condition that $(A_n)$ are independent allows $\prob(A)$ to be anything: set $A_1=A_2=\ldots=C$ to get $\prob(A)=\prob(C)\neq0$, and set $A_1\supset A_2\supset A_3\supset\ldots$ with $\prob(A_n) = 1/n$ to get $\prob(A)=0$.

Lemma (inclusion-exclusion formula for probability) open_in_new

Let $A_1, A_2, \ldots, A_n\in\mathcal F$. Then $$ \mathbb P(A_1\union A_2\union\ldots\union A_n) = \sum_{k=1}^n(-1)^{k+1} \sum_{1\leq i_1<i_2<\ldots<i_k\leq n} \mathbb P(A_{i_1}\cap A_{i_2}\cap\ldots\cap A_{i_k}). $$

Proof using expectation

Lemma (partial sums in inclusion-exclusion formula overestimate and underestimate) open_in_new

Referring to the inclusion-exclusion formula, let $S_k$ be the partial sums $$ S_k = \fsum j1k (-1)^{j+1} \sum_{1\leq i_1<\ldots<i_j\leq n} \prob(A_{i_1}\cap \ldots\cap A_{i_j}). $$

Then sum of odd terms overestimates and sum of even terms underestimate: $$ S_{2k} \leq \prob(A_1\cup\ldots\cup A_n) \leq S_{2k+1}. $$

Proof (non-examinable)

Independence open_in_new

Definition (independent sequence of events) open_in_new

For a finite or infinite sequence of events $(A_1, A_2, \ldots, A_n)$ or $(A_n)_{n\in\N}$, we say that the sequence is independent if $$ \mathbb P(A_{i_1} \cap A_{i_2} \cap\ldots\cap A_{i_k}) = \mathbb P(A_{i_1}) \times \mathbb P(A_{i_2}) \times \ldots\times \mathbb P(A_{i_k}) $$ for all finite subsequence $i_1 < \ldots < i_k$.

  • Note that pairwise independent events may not be an independent sequence. (Example)

  • If $\prob(A)=0$ or $1$, then $A$ is independent of any event. (Proof)

  • If $A$ and $B$ are independent events, then $A^\complement$ and $B$ are also independent. Generally for an independent sequence of events, replacing any subset of them with their complements still gives an independent sequence. (Sheet 2 Q2, Proof)

  • Independence is a natural property of the product of probability spaces.

Conditional probability open_in_new

Definition (conditional probability) open_in_new

For a probability space, for any two events $A,B$ with $\mathbb P(B) > 0$, the conditional probability of $A$ given $B$ is $$ \mathbb P(A|B) = \frac{\mathbb P(A\cap B)}{\mathbb P(B)}. $$

Lemma (conditional probability measure) open_in_new

Given a probability space $(\Omega, \mathcal F, \mathbb P)$, for any event $B$ with $\mathbb P(B) > 0$, the function $$ \begin{align*} \mathbb P_B: \mathcal F &\to [0,1] \\ A &\mapsto \mathbb P(A|B) \end{align*} $$ is a probability measure called the conditional probability measure given $B$.

Proof

Law of total probability open_in_new

Let $(B_n)_{n\in\N}$ be a partition of $\Omega$ (sequence of disjoint events with $\bigcup_n B_n = \Omega$) with $\prob(B_n)>0$. Then for all event $A$, $$ \prob(A) = \sum_n \prob(A|B_n)\, \prob(B_n). $$ The condition of positive probabilities can be dropped if we agree that $\prob(A|B_n) \prob(B_n) = 0$ when $\prob(B_n) = 0$.

Proof

Bayes' formula open_in_new

Let $(B_n)_{n\in\N}$ be a partition of $\Omega$ with positive probability and let $A$ be an event of positive probability. Then $$ \prob(B_n | A) = \frac{\prob(A|B_n) \prob(B_n)}{\fsum k1\infty \prob(A|B_k) \prob(B_k) }. $$

We hold a prior belief of the probabilities $\prob(B_n)$. Should we observe the event $A$, this formula gives the posterior probabilities $\prob(B_n|A)$.

Simpson's paradox open_in_new

Let $(\Omega_n)_{n\in\N}$ be a partition of $\Omega$. Let $A,B$ be events with $\prob(B) > 0$.

It can be that $B$ makes $A$ more likely on all $\Omega_n$, i.e. $\prob(A|B\cap\Omega_n) > \prob(A|\Omega_n)$, but $B$ makes $A$ less likely on $\Omega$, i.e. $\prob(A|B) < \prob(A)$. (Example)

Using the law of total probability, $$ \begin{matrix} \prob(A) & = & \sum_n & \prob(A|\Omega_n) & \prob(\Omega_n) \\ \bigvee & & & \bigwedge \\ \prob(A|B) & = & \sum_n & \prob(A|B\cap\Omega_n) & \prob(\Omega_n|B) \\ \end{matrix} $$ and the weights $\prob(\Omega_n)$ can change when conditioning on $B$.

Counting finite sets open_in_new

Stirling's formula open_in_new

We write $a_n\sim b_n$ to mean that $a_n/b_n\to 1$.

Theorem (Stirling's formula for log n!) open_in_new

In the limit $n\to\infty$, $$ \log n! \sim n\log n. $$

Proof

Theorem (Stirling's formula for n!) open_in_new

In the limit $n\to\infty$, $$ n! \sim \sqrt{2\pi} n^{n+1/2} e^{-n}.$$

Proof (non-examinable)

Sums and products open_in_new

Definition (finite set, cardinality) open_in_new

A non-empty set $\Omega$ is finite if there exists $n\in\N$ and a bijection $$ \set{1,2,\ldots,n}\to \Omega. $$ We call $n$ the cardinality or size and write $|\Omega| = n$.

For finite sets $\Omega_1, \Omega_2, \ldots, \Omega_k$,

  • $|\Omega_1\times\Omega_2\times\ldots\times\Omega_k| = |\Omega_1| \times |\Omega_2| \times \ldots \times |\Omega_k|$;

  • if $\Omega_1, \Omega_2, \ldots, \Omega_k$ are disjoint, then $|\Omega_1\union\Omega_2\union\ldots\union\Omega_k| = |\Omega_1| + |\Omega_2| + \ldots + |\Omega_k|$.

Counting permutations open_in_new

The number of bijections $\Omega_1 \to \Omega_2$ for $|\Omega_1| = |\Omega_2| = n$ is $n!$.

Counting subsets open_in_new

Let $n\in\N$ and $k=0,1,2,\ldots,n$. The number of subsets of $\set{1,2,\ldots, n}$ of size $k$ is $$ \pmatrix{n\\k} = \frac{n!}{k!(n-k)!}. $$

Derivation of number of permutations and subsets

Counting increasing and non-decreasing functions open_in_new

Consider functions $\set{1,2,\ldots,k} \to \set{1,2,\ldots,n}$ where $k\leq n$.

  • For (strictly) increasing functions i.e. $f(i+1) > f(i)$, there are $\pmat{n\\k}$ of them. (Derivation)

  • For non-decreasing functions i.e. $f(i+1) >= f(i)$, there are $\pmat{n+k-1\\k}$ of them. (Derivation)

Counting ordered partition open_in_new

An ordered partition of $m$ of size $n$ is a sequence of non-negative integers $(m_1,m_2,\ldots, m_n)$ such that $m_1+m_2+\ldots+m_n = m$. There are $\pmat{m+n-1\\m}$ such partitions. (Derivation)

Given $n\in\N$ and $n_1,n_2,\ldots,n_k\in\N$ where $n_1+n_2+\ldots+n_k=n$, an ordered partition of $\set{1,2,\ldots,n}$ is a sequence of subsets $(S_1, S_2, \ldots, S_k)$ such that $|S_i| = n_i$ for all $i$ and $S_1\union S_2\union\ldots\union S_k = \set{1,2,\ldots,n}$. The number of such partitions is $$ \pmat{n \\ n_1,n_2,\ldots,n_k} = \frac{n!}{n_1!n_2!\ldots n_k!} $$ by a similar argument to this.

Counting surjections open_in_new

The number of surjections $\set{1,2,\ldots,m}\to\set{1,2,\ldots,n}$ is $$ \sum_{k=0}^n (-1)^k \pmat{n\\k} (n-k)^m. $$

Derivation

Counting derangements open_in_new

The probability of a randomly chosen permutations of $\set{1,2,\ldots,n}$ having no fixed points (derangement) is $$ \sum_{k=0}^n \frac{(-1)^k}{k!}. $$

Derivation

Random variables open_in_new

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:

  • it is non-decreasing, i.e. $F_X(x) \leq F_X(x+h)$ for all $x\in\R, h\geq 0$ (Derivation);

  • $F_X(x) \to 0$ as $x\to -\infty$, and $F_X(x)\to1$ as $x\to\infty$ (Derivation);

  • $F_X$ is right-continuous, for $h\geq 0$, i.e. $F_X(x+h) \to F_X(x)$ as $h\to 0$ for all $x\in\R$ (Derivation);

  • for $h\geq0$, $F_X(x-h)\to \prob(X<x)$ as $h\to 0$ for all $x\in\R$ (Derivation);

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

Discrete random variables open_in_new

Definition (discrete probability measure) open_in_new

A probability measure $\mathbb P$ on $(\Omega, \mathcal F)$ is discrete if there exists a countable set $S\subseteq\Omega$ and function $(p_x: x\in S)$ such that $$ \mathbb P(A) = \sum_{x\in S\cap A} p_x $$ for all $A\in\mathcal F$.

Definition (discrete random variable) open_in_new

A random variable $X$ is discrete if there is a countable set $S\subseteq \R$ such that $$ \prob(X\in S) = 1. $$

Probability generating functions open_in_new

Definition (probability generating function) open_in_new

Let $X$ be a random variable with values in $\Z^+ = \set{0,1,2,\ldots}$.

The probability generating function of $X$ is given by the power series $$ G_X(t) = \expect(t^X) = \fsum n0\infty \prob(X=n)\, t^n. $$

  • The radius of convergence $R\geq 1$ since $G_X(1) = \fsum n0\infty\prob(X=n) = 1$.

  • $G_X(t)$ is unique to the distribution of $X$ since we can recover the coefficients in $G_X(t)$ by $$ \prob(X=n)=\frac1{n!} G_X^{(n)}(0). $$

Lemma (generating function of sum of independent random variables) open_in_new

Let $X,Y$ be independent random variables with values in $\Z^+$. Then "generating functions turn convolutions into products": $$ G_{X+Y}(t) = G_X(t)\, G_Y(t). $$

Proof

Lemma (generating function of random sums) open_in_new

Let $N, X, X_1, X_2, X_3,\ldots$ be non-negative integer-valued independent random variables, and suppose $X,X_1,X_2,X_3,\ldots$ are identically distributed. Define the random sum $$ S_N = \fsum n1N X_n. $$

Then $$ G_{S_N} = G_N \circ G_X. $$

Proof

Generating functions and moments open_in_new

Definition (n-th moment of random variable) open_in_new

The $n$-th moment of $X$ is $\expect(X^n)$.

If $R>1$, $$ \begin{align*} G_X'(1) &= \fsum n1\infty \prob(X=n)\,n = \expect(X) \\ G_X''(1) &= \fsum n1\infty \prob(X=n)\,n(n-1) = \expect(X(X-1)) \\ \end{align*} $$ and so on.

If $R=1$, we can take the limit instead: $$ G_X'(t) = \fsum n1\infty \prob(X=n) nt^{n-1} \to \fsum n1\infty \prob(X=n) n = \expect(X). $$

In counting, generating functions help convert convolutions into products. Example (Catalan number)

Discrete probability distributions open_in_new

"Distributions" just mean probability measure.

Definition (distribution and mass function of discrete random variable) open_in_new

Given a discrete random variable $X$ with values in a countable set $S$, the distribution of $X$ is a discrete distribution $\mu_X$ on $\R$ by $$ \mu_X(B) = \prob(X\in B). $$

The mass function of $X$ is $$ p_x = \mu_X(\set{x}) = \prob(X=x). $$

We only consider the case when $\set{x}\in\mathcal F$ for all $x\in S$. Then $p_x = \mathbb P(\set{x})$. $p_x$ is called the mass function.

Distribution $X\sim$

Parameters

Values

Mass function $p_k$

Mean $\expect(X)$

Variance $\var(X)$

PGF $G_X(t)$

Radius of convergence $R$

Bernoulli $B(1,p)$

$p\in[0,1]$

$\set{0,1}$

$p_0=1-p$
$p_1=p$

$p$

$p(1-p)$

$1-p+pt$

$\infty$

Binomial $B(n,p)$

$n\in\N$
$p\in[0,1]$

$\set{0,1,\ldots,n}$

$\pmat{n \\ k}p^k(1-p)^{n-k}$

$np$

$np(1-p)$

$(1-p+pt)^n$

$\infty$

Geometric $G(p)$

$p\in(0,1)$

$\Z^+$

$p(1-p)^k$

$\frac{1-p}{p}$

$\frac{1-p}{p^2}$

$\frac{p}{1-(1-p)t}$

$\frac{1}{1-p}$

$\N$

$p(1-p)^{k-1}$

Poisson $P(\lambda)$

$\lambda\in(0,\infty)$

$\Z^+$

$e^{-\lambda}\frac{\lambda^k}{k!}$

$\lambda$

$\lambda$

$e^{-\lambda+\lambda t}$

$\infty$

Bernoulli distribution open_in_new

A Bernoulli random variable $X$ of parameter $p\in[0,1]$, denoted as $X\sim B(1,p)$, has a distribution on $\set{0,1}$ given by $$ p_0 = 1-p, \quad p_1 = p. $$

This is used to model the outcome of one biased coin toss.

  • Mean $\expect(X)=p$.

  • Variance $\var(X) = p-p^2$.

  • Generating function $$ G_X(t) = 1-p+pt, \qquad R=\infty. $$

Binomial distribution open_in_new

A binomial random variable $X\sim B(n,p)$ of parameters $n\in\N$ and $p\in[0,1]$ has a distribution on $\set{0,1,2,\ldots,n}$ given by $$ p_k = \pmat{n\\k} p^k (1-p)^{n-k}, \quad k=0,1,\dots,n.$$

Use this to model the number of heads obtained on tossing a biased coin $n$ times.

Lemma (adding binomial random variables) open_in_new

If random variables $X\sim B(n,p)$ and $Y\sim B(m, p)$ are independent, then $X+Y\sim B(n+m, p)$.

Adding Bernoulli random variables on a product space

  • Expectation $=np$;

  • Variance $=np(1-p)$. (Derivation)

  • Generating function: either using binomial theorem or adding up $n$ independent Bernoulli variables, $$ G_X(t) = (1-p+pt)^n, \qquad R=\infty. $$

Multinomial distribution open_in_new

A multinomial random variable $X$ of parameters $n\in\N$ and $(p_1, p_2, \ldots, p_k)$ where $p_i\geq 0$ and $p_1+p_2+\ldots+p_k = 1$ has a distribution on the set of ordered partitions $(n_1, n_2, \ldots, n_k)$ of $n$, i.e. $n_1+n_2+\ldots+n_k = n$, given by $$ p_{(n_1,n_2,\ldots, n_k)} = \pmat{n \\ n_1, n_2, \ldots, n_k} p_1^{n_1}\times p_2^{n_2}\times \ldots \times p_k^{n_k}. $$

Use this to model the number of balls in each of $k$ boxes when we assign $n$ balls independently to box $i$ with probability $p_i$.

Geometric distribution open_in_new

A geometric random variable $X\sim G(p)$ of parameter $p\in(0,1)$ has a distribution on $\N_0=\set{0,1,2,\ldots}$ given by $$ p_k = p(1-p)^k, \quad k=0,1,2,\ldots. $$

Alternatively some define it as the probability measure on $\N=\set{1,2,\dots}$ given by $$ p_k = p(1-p)^{k-1}, \quad k=1,2,\ldots. $$

Be clear with the definition. This is to model the number of tosses of a biased coin up to (or including) the first head.

Using the first definition,

  • Expectation $= (1-p)/p$. (Derivation)

  • Variance $= (1-p)/p^2$. (Derivation)

  • Generating function $$ G_X(t) = \fsum n0\infty (1-p)^n pt^n = \frac{p}{1-(1-p)t}, \qquad R=\frac{1}{1-p}.$$

Poisson distribution open_in_new

A Poisson random variable $X\sim P(\lambda)$ of parameter $\lambda\in(0,\infty)$ has a distribution on $\N_0 = \set{0,1,2,\dots}$ given by $$ p_k = e^{-\lambda}\frac{\lambda^k}{k!},\quad k=0,1,2,\ldots. $$

Lemma (adding Poisson random variables) open_in_new

If random variables $X\sim P(\lambda)$ and $Y\sim P(\mu)$ are independent, then $X+Y\sim P(\lambda+\mu)$.

  • Expectation $=\lambda$;

  • Variance $=\lambda$. (Derivation)

  • Generating function $$ G_X(t) = \fsum n0\infty e^{-\lambda} \frac{\lambda^n}{n!} t^n = e^{-\lambda + \lambda t}, \qquad R=\infty. $$

Lemma (Poisson distribution as a limit of binomial distribution) open_in_new

The Poisson distribution $P(\lambda)$ is the limit of the binomial distribution $B(n, \lambda/n)$ as $n\to\infty$.

Proof

Random processes open_in_new

Definition (random process, random walk) open_in_new

A random process is a sequence $(X_n:n\geq 0)$ of random variables.

A random walk is a random process $(X_n: n\geq0)$ that has the form $$ X_n = x+Y_1 + \ldots + Y_n $$ where constant $x$ is the initial value and $(Y_n: n\geq 1)$ are a sequence of independent identically distributed random variables.

Gambler's ruin open_in_new

Consider a random walk where at each step $k$, $$ \prob(Y_k = +1) = p, \quad \prob(Y_k = -1) = 1-p \equiv q. $$ The gambler will walk away either when $X_n = a$ or 0.

The key is to see that if we condition on the first step, say $Y_1=1$, then $(X_{n+1})_{n\geq 0}$ is again a simple random walk with the same step distribution.

Denote $\prob_x$ and $\expect_x$ for probability and expectation regarding initial value $x$, and $$ T = \min\sb{n\geq 0}{X_n=0\text{ or } a}. $$

Proposition (gambler's ruin almost always terminates) open_in_new

The process almost always terminates, i.e. $\prob(T<\infty) = 1$. (Derivation)

Prbability of success in gambler's ruin open_in_new

Let the probability of success be $h_x = \prob(X_T=a)$.

For $x=1,2,\ldots,a-1$, using the law of total probability $$ \begin{align*} h_x &= \prob(Y_1=1)\prob(X_T=a|Y_1=1)+\prob(Y_1=-1)\prob(X_T=a|Y_1=-1) \\ &= ph_{x+1} + qh_{x-1} \end{align*} $$ and boundary condition is $$ h_0 = 0, \quad h_a=1. $$ Solving (derivation), $$ h_x = \begin{cases} \dfrac ax, &p=\dfrac12, \\ \dfrac{1-(p/q)^x}{1-(p/q)^a}, &p\neq\dfrac12. \end{cases} $$

Mean time to absorption in gambler's ruin open_in_new

Let the mean time to absorption be $\tau_x = \expect_x(T)$.

For $x=1,2,\ldots,a-1$, using the law of total expectation, $$ \begin{align*} \tau_x &= \prob(Y_1=1)\expect(X_T=a|Y_1=1)+\prob(Y_1=-1)\expect(X_T=a|Y_1=-1) \\ &= p(1+\tau_{x+1}) + q(1+\tau_{x-1}) \\ &= 1+p\tau_{x+1} + q\tau_{x-1}. \end{align*} $$ and boundary condition is $$ \tau_0 = 0,\quad \tau_a = 0. $$ Solving (Derivation), $$ \tau_x = \begin{cases} x(a-x),& p=\dfrac12,\\ \dfrac{x}{q-p}-\dfrac{a}{q-p}\dfrac{(q/p)^x - 1}{(q/p)^a-1},& p\neq\dfrac12. \end{cases} $$

Branching process open_in_new

This is to model a population, with $X_n$ being the size of the population in generation $n$, and $Y_{k,n}$ is the number of offspring of the $k$-th individual in generation $n$.

Definition (branching process) open_in_new

A random process $(X_n: n\geq 0)$ is a branching process (Galton-Watson process) if it is in the form $$ X_0 = 1, \quad X_{n+1} = \fsum n1{X_n} Y_{k,n} $$ for some array array $(Y_{k,n}: k\geq1, n\geq0)$ of independent and identically distributed non-negative integer-valued random variables. (The distribution is called the offspring distribution.)

Mean population of branching process open_in_new

Set $\mu=\expect(X_1)$. Conditioning on $X_n$, $$ \expect(X_{n+1}|X_n=m) = \expect(Y_{1,n}+\ldots+Y_{m,n}) = m\mu $$ so using the law of total expectation, $$ \begin{align*} \expect(X_{n+1}) &= \fsum m0\infty \expect(X_{n+1}|X_n=m)\,\prob(X_n=m) \\ &= \mu\fsum m0\infty m\prob(X_n=m) \\ &= \mu\expect(X_n). \end{align*} $$ Applying the boundary condition of $\expect(X_0)=1$, we have $\expect(X_n)=\mu^n$.

Generating function of branching process open_in_new

Generating function: let $F(t) = \expect(t^{X_1})$ and $F_n(t)=\expect(t^{X_n})$. Then using the result about random sums, $$ F_n(t) = F_{n-1}\big(F(t)\big) = \ub{F\circ F\circ\ldots\circ F}_\text{$n$-fold composition}(t). $$

A feature to exploit is that if we condition on $\set{X_1=m}$, the descendants of any individuals in generation 1 is another branching process.

Extinction probability of branching process open_in_new

Let $q_n = \prob(X_n=0)$ and the extinction probability $q=\prob(X_n=0\text{ for some } n\geq0)$. Since $\set{X_1=0}\subseteq\set{X_2=0}\subseteq\ldots$ and $\bigcup_n \set{X_n=0} = \set{X_n=0\text{ for some } n\geq 0}$, by continuity of probability, $q_n\to q$.

Note that $$ q_n = \prob(X_n=0) = F_n(0)=\ub{F\circ F\circ\ldots\circ F}_\text{$n$-fold composition}(0).$$ Alternatively we can condition on the first generation $$ \begin{align*} q_n &= \fsum m0\infty \prob(X_1=m)\prob(X_n=0|X_1=m) \\ &= \fsum m0\infty \prob(X_1=m) q_{n-1}^m = F(q_{n-1}) \end{align*} $$ since $\set{X_n=0|X_1=m}$ means that each of the descendants of the $m$ individuals in generation 1 go extinct, which are independent events.

And using analysis (Derivation), $q$ is the smallest non-negative solution of $q=F(q)$. Also if $\prob(X_1=1)<1$, then $q<1$ iff $\mu=\expect(X_1)>1$.

Random walk from branching process open_in_new

List the individuals in increasing order. Set $S_0=1$, and for $n\geq 1$ let $S_n$ for the number of offspring of all visited individuals who have not yet been visited (think about breadth-first search).

Then the jumps of $(S_n:n\geq0)$ are independent with the same distribution as $X_1-1$.

Continuous random variables open_in_new

Definition (continuous random variable) open_in_new

A random variable $X$ is continuous if its distribution function $F_X$ is a continuous function $\R \to [0,1]$.

Recall that the distribution function of any random variable is right-continuous.

Definition (probability density function) open_in_new

A function $f$ on $\R$ is a probability density function if $f$ is non-negative, sufficiently regular (Borel measurable), and $$ \int_\R f(x)\, dx = 1. $$

Proposition (probability distribution given pdf) open_in_new

Given a probability density function $f$, there is a unique probability measure $\mu$ on $\R$ (defined on the Borel $\sigma$-algebra $\mathcal B$ which is the smallest $\sigma$-algebra containing all intervals in $\R$) such that $$ \mu\big((-\infty, x]\big) = \int_{-\infty}^x f(y) \, dy,\qquad \mu(B)=\int_B f(x)\,dx = \int_\R 1_B(x)\,f(x)\,dx.$$

Definition (absolutely continuous random variable) open_in_new

A random variable $X$ is absolutely continuous if there exists a probability density function $f_X$ such that its distribution function $F_X(x)$ satisfies $$ \begin{align*} F_X (x) = \int_{-\infty}^{x} f_X(y)\, dy, \quad x\in\R. \end{align*} $$ Equivalently, the distribution $\mu_X$ satisfies $$ \begin{align*} \mu_X(B) = \int_{B} f_X(x) \, dx. \end{align*} $$

We will simply say that $X$ has a density function $f_X$.

  • For a random variable $X$, it is continuous iff $\prob(X=x) = 0$ for all $x\in\R$. Proof

  • If $X$ has density function $f_X$, then $X$ is a continuous random variable, since $\prob(X=x) = \int_{\set{x}} f_X(y) \, dy = 0$.

    The converse is not true: a random variable with the Cantor function as its distribution function.

  • If $F_X$ is piecewise continuously differentiable, or $f_X$ is continuous at $x$, then $$ \begin{align*} F'_X(x) = f_X(x), \qquad \int_{-\infty}^{x} f_X(y) \, dy = F_x(x). \end{align*} $$ (Derivation)

Proposition (applying function to continuous random variable) open_in_new

Let $X$ be a continuous random variable with piecewise continuous density function $f_X$, and $X$ takes values in $I$.

For some continuously differentiable function $\phi: I\to\R$ with $\phi'(x)\neq 0$ for any $x$, set $y=\phi(x)$ and define a new random variable $Y=\phi(X)$.

Then $Y$ has density function given by $$ \begin{align*} f_Y(y) = f_X(x) \left|\dfd xy\right|. \end{align*} $$

Proof

Proposition (expectation of continuous random variable) open_in_new

Let $X$ be a random variable with desnity function $f_X$ and let $g$ be a non-negative Borel function on $\R$.

Then $$ \begin{align*} \expect(g(X)) = \int_{\R} g(x) f_X(x)\, dx. \end{align*} $$ This remains valid without assuming $g$ is non-negative provided that $\expect|g(x)|<\infty$.

Moment generating function open_in_new

Definition (moment generating function) open_in_new

Let $X$ be a random variable on $\R$. The moment generating function of $X$ is the function $M_X: \R\to[0,\infty]$ given by $$ \begin{align*} M_X(\lambda) = \expect(e^{\lambda X}). \end{align*} $$

For a random variable on $\R^n$, the moment generating function $M_{\v X}: \R^n \to [0,\infty]$ given by $$ \begin{align*} M_{\v X}(\v \lambda) = \expect(e^{\v \lambda^T \v X}), \quad \v \lambda\in\R^n. \end{align*} $$ ($\v \lambda^T \v X$ is the dot product)

If $X$ takes values in $\Z^+$, then the probability generating function is related by $M_X(\lambda) = G_X(e^{\lambda})$.

Proposition (moment generating function of sum of random variables) open_in_new

For independent random variables $X,Y$, $$ \begin{align*} M_{X+Y}(\lambda) = \expect(e^{\lambda X} e^{\lambda Y}) = \expect(e^{\lambda X}) \expect(e^{\lambda Y}) = M_X(\lambda) M_Y(\lambda). \end{align*} $$

Theorem (uniqueness of moment generating function) open_in_new

Let $X,Y$ be random variables having the same moment generating function $M$.

For $X,Y$ in $\R$, if $M(\lambda) < \infty$ for some $\lambda>0$, then $X,Y$ have the same distribution $F_X = F_Y$.

For $\v X,\v Y$ in $\R^n$, if $M(\v \lambda) < \infty$ on some open set of $\v \lambda$, then $\v X,\v Y$ have the same distribution.

The condition of finiteness is required: Example (scaling Cauchy distribution has the same moment generating function).

Definition (convergence of random variables) open_in_new

A sequence of random variables $(X_n)$ converges in distribution to a random variable $X$ if $$ \begin{align*} F_{X_n}(x) \to F_X(x) \end{align*} $$ for all $x\in\R$ where $F_X$ is continuous at $x$.

Why we exclude discontinuity
Theorem (continuity of moment generating function) open_in_new

Let $X,(X_n)$ be random variables. Suppose that as $n\to\R$, $M_{X_n} (\lambda) \to M_X(\lambda)$ for all $\lambda\in\R$ and $M_X(\lambda) < \infty$ for some $\lambda\neq 0$.

Then $X_n \to X$ in distribution.

Continuous probability distributions open_in_new

Distribution $X\sim$

Parameters

Values $x\in$

PDF $f(x)$

Mean $\expect(X)$

Variance $\var(X)$

MGF $M_X(t)$

Uniform $U[a,b]$

$[a,b]$

$[a,b]$

$\frac{1}{b-a}$

$\frac{1}{2}(a+b)$

$\frac{1}{12}(b-a)^2$

$\begin{cases} \frac{e^{bx}-e^{ax}}{t(b-a)}, &t\neq 0 \\ 1, &t=0\end{cases}$

Exponential $E(\lambda)$

$\lambda\in(0,\infty)$

$[0,\infty)$

$\lambda e^{-\lambda x}$

$\frac{1}{\lambda}$

$\frac{1}{\lambda^2}$

$\begin{cases} \frac{\lambda}{\lambda-t},& t<\lambda \\ \infty, &t\geq \lambda \end{cases}$

Gamma $\Gamma(\alpha,\lambda)$

$\alpha\in(0,\infty)$
$\lambda\in(0,\infty)$

$[0,\infty]$

$\frac{\lambda^{\alpha}}{\Gamma(\alpha)}x^{\alpha-1}e^{-\lambda x}$

$\frac{\alpha}{\lambda}$

$\frac{\alpha}{\lambda^2}$

$\begin{cases} \left(\frac{\lambda}{\lambda-t}\right)^\alpha,& t<\lambda \\ \infty, &t\geq \lambda \end{cases}$

Normal $N(\mu,\sigma^2)$

$\mu\in\R$
$\sigma>0$

$\R$

$\frac{1}{\sigma\sqrt{2\pi}}\exp\left(-\frac{(x-\mu)^2}{2\sigma^2}\right)$

$\mu$

$\sigma^2$

$\exp(\mu t + \frac{1}{2}\sigma^2 t^2)$

Cauchy

$\R$

$\frac{1}{\pi(1+x^2)}$

$\expect\textbar X\textbar = \infty$

$\infty$

$\begin{cases} \infty, &t\neq 0 \\ 1, &t=0 \end{cases}$

Uniform distribution open_in_new

$U[a,b]$, the uniform distribution on $[a,b]$, has probability density function $$ f(x) = \frac{1}{b-a}1_{[a,b]}(x). $$

Analogue to equally likely outcomes.

  • Mean $= (a+b)/2$. (Derivation)

  • Moment generating function (Derivation) $$ \begin{align*} M_X(t) = \begin{cases} \dfrac{e^{bx} - e^{ax}}{t(b-a)}, &t\neq 0 \\ 1, &t=0. \end{cases} \end{align*} $$

Exponential distribution open_in_new

$E(\lambda)$, the exponential distribution of parameter $\lambda\in(0,\infty)$, has probability density function $$ f(x) = \lambda {\color{yellow}e^{-\lambda x}},\qquad x\in[0,\infty).$$

  • Mean $= 1/\lambda$. (Derivation)

  • Exponential distribution is the limit of geometric distributions. (How?)

  • Exponential distribution is unique non-trivial distribution satisfying the memoryless property $$ \begin{align*} \prob(T > s+t | T>s) = \prob(T>t). \end{align*} $$ (Proof)

  • Moment generating function (Derivation) $$ \begin{align*} M_X(t) = \begin{cases} \dfrac{\lambda}{\lambda-t}, &t<\lambda, \\ \infty, &t\geq \lambda. \end{cases} \end{align*} $$

Gamma distribution open_in_new

$\Gamma(\alpha,\lambda)$, the gamma distribution of parameter $\alpha,\lambda\in(0,\infty)$, has probability density function $$ f(x) = \frac{\lambda^\alpha}{\Gamma(\alpha)} {\color{yellow}x^{\alpha-1} e^{-\lambda x}},\qquad x\in[0,\infty) $$ where $\Gamma(\alpha) = \int_0^\infty x^{\alpha-1} e^{-x}\,dx$.

$\Gamma(1, \lambda)$ is identical to $E(\lambda)$.

  • Moment generating function (Derivation) $$ \begin{align*} M_X(t) = \begin{cases} \left(\dfrac{\lambda}{\lambda-t}\right)^\alpha, & t<\lambda, \\ \infty, & t\geq \lambda. \end{cases} \end{align*} $$

Normal distribution open_in_new

$N(\mu,\sigma^2)$, the normal distribution of mean $\mu$ and variance $\sigma^2$, has probability density function $$ f(x) = \frac{1}{\sigma\sqrt{2\pi}} \color{yellow}e^{-\frac{(x-\mu)^2}{2\sigma^2}}. $$

  • If $X\sim N(0,1)$, then $\sigma X + \mu \sim N(\mu, \sigma^2)$.

  • Mean $= \mu$, variance $= \sigma^2$. (Derivation)

  • Moment generating function (Derivation)

    • For $X\sim N(0,1)$, $$ \begin{align*} M_X(t) = e^{t^2/2}. \end{align*} $$

    • For $X\sim N(\mu, \sigma^2)$, $$ \begin{align*} M_X(t) = e^{\mu t + (\sigma t)^2/2}. \end{align*} $$

Cauchy distribution open_in_new

The Cauchy distribution has probability density function $$ \begin{align*} f(x) = \frac{1}{\pi(1+x^2)} \end{align*} $$

  • Mean $= \infty$.

  • Moment generating function $M_X(0) = 1$ and $\infty$ elsewhere.

Multivariate density functions open_in_new

Definition (joint probability density function) open_in_new

We say a random variable $\v X = (X_1, \ldots, X_n)$ in $\R^n$ has probability density function $f_{\v X}$ if for all $x_1, \ldots, x_n\in\R$, $$ \begin{align*} F_{\v X}(x_1, \ldots, x_n) \equiv \prob(X_1\leq x_1, \ldots, X_n\leq x_n) = \int_{-\infty}^{x_1} \ldots \int_{-\infty}^{x_n} f_{\v X}(\v x) \, dx \end{align*} $$ Equivalently for all Borel set $B$, $$ \begin{align*} \prob(\v X\in B) = \int_{B} f_{\v X}(\v x) \, dx. \end{align*} $$ Also equivalently for all non-negative Borel function $g$, $$ \begin{align*} \expect(g(\v X)) = \int_{\R^n} g(\v x) f_{\v X}(\v x) \, dx. \end{align*} $$

Definition (marginal density function) open_in_new

Suppose $\v X=(X_1, X_2, \ldots, X_n)$ is a random variable in $\R^n$ having density function $f_{\v X}$. Then each $X_i$ has a density function $f_{X_i}$ called marginal density function given by $$ \begin{align*} f_{X_i}(x_i) = \int_{\R^{n-1}} f_X(x_1, x_2, \ldots, x_n) \, \prod_{j\neq i} dx_j. \end{align*} $$

Theorem (independence iff joint pdf factorises) open_in_new

Let $\v X=(X_1, \ldots, X_n)$ be a random variable in $\R^n$, and $f_1, \ldots, f_n$ be density functions.

$X_1, \ldots X_n$ are independent and have marginal density functions $f_1, \ldots, f_n$ iff $X$ has density function $f_X$ given by $$ \begin{align*} f_{\v X}(x) = \prod_{i=1}^{n} f_i(x_i). \end{align*} $$

Proof

Theorem (convolution of densities for sum of independent random variables) open_in_new

Let $X,Y$ be independent random variables in $\R$ with density functions $f_X, f_Y$.

Then $Z=X+Y$ has a density function given by the convolution $$ \begin{align*} f_Z(z) = f_X * f_Y(z) \equiv \int_{\R} f_X(z-y) f_Y(y) \, dy. \end{align*} $$

Proof

Theorem (transformation of multi-dimensional random variable) open_in_new

Let $\v X$ be a random variable in $\R^n$ taking values and having a density function $f_{\v X}$ in an open set $D$. Let $\v\phi$ maps $D$ bijectively to $\v\phi(D) \subseteq \R^n$ and suppose $\v\phi$ has a continuous derivative (Jacobian matrix $\v\phi'$) with $\v\phi'(x) \neq 0$.

Set $\v y=\v \phi(x)$ and define a new random variable $\v Y=\v \phi(X)$. Then $\v Y$ has a density function in $\v \phi(D)$ given by $$ \begin{align*} f_{\v Y}(\v y) = f_{\v X}(\v x)\,|J| \end{align*} $$ where $J$ is the Jacobian $$ \begin{align*} J = \det\left(\pdfd{x_i}{y_j}\right) = \left(\det\left(\pdfd{y_i}{x_j}\right)\right)\inv. \end{align*} $$

Gaussian random variables open_in_new

Definition (Gaussian random variables) open_in_new

A random variable $X$ in $\R$ is Gaussian if $X=\sigma Z+\mu$ for some $\mu\in\R, \sigma\in[0,\infty)$ and $Z\sim N(0,1)$, i.e. the probability distribution function is $$ \begin{align*} f_Z(z) = \frac{1}{\sqrt{2\pi}} e^{-z^2/2}. \end{align*} $$ Then we write $X\sim N(\mu, \sigma^2)$.

For $n\geq 2$, a random variable $\v X$ in $\R^n$ is Gaussian if $\v u^T \v X \equiv \sum_{i=1}^{n} u_i X_i$ is Gaussian for all $\v u\in\R^n$.

Proposition (affine functions of Gaussian are Gaussian) open_in_new

For a Guassian random variable $\v X$ in $\R^n$, for any $m\times n$ matrix $\matr a$ and vector $\v b\in\R^m$, the random variable $\v Y = \matr a\v X + \v b$ is also Gaussian. (Proof)

Moment generating function of Gaussian random variable open_in_new

For a Gaussian random variable $\v X$ in $\R^n$, suppose it has mean $\v \mu = \expect(\v X)$ and variance $\matr V = \op{var}(\v X) = \left(\op{cov}(X_i, X_j)\right)_{i,j=1}^n$.

For all $\v u\in\R^n$, the random variable $\v u^T \v X \sim N(\v u^T \v \mu, \v u^T V \v u)$. (Derivation) Note that $\v u^T \matr V \v u \geq 0$ so $\matr V$ is non-negative definite.

Therefore the generating function is $$ \begin{align*} M_{\v X}(\v\lambda) = \expect(e^{\v\lambda^T \v X}) = e^{\v \lambda^T \v \mu + \frac{1}{2}\v \lambda^T \matr V\v \lambda}. \end{align*} $$ Hence the distribution of $\v X$ is uniquely determined by $\v \mu$ and $\matr V$. So we write $\v X\sim N(\v \mu, \matr V)$.

Constructing Guassian random variables open_in_new

To construct $\v Z\sim N(0, I_n)$ where $I_n$ is the $n\times n$ identity matrix, take $Z_1, \ldots, Z_n$ independent $N(0,1)$ random variables and set $\v Z = (Z_1, \ldots, Z_n)$. (Proof)

Generally to construct $\v X\sim N(\v \mu, \matr V)$, we define $\v X=\matr \sigma \v Z + \v \mu$ where $\matr \sigma = \sqrt{\matr V}$. $\v X$ is then Gaussian, $\expect(\v X) = \v \mu$, and $$\op{var}(\v X) = \expect((\matr \sigma \v Z)(\matr \sigma \v Z)^T) = \matr \sigma\op{var}(\v Z)\matr \sigma^T = \matr \sigma I_n \matr \sigma^T = \matr V.$$ Hence $\v X \sim N(\v\mu,\matr V)$.

(What is $\sqrt{\matr V}$: since $\matr V$ is symmetric, $\matr V$ is diagonalisable by an orthogonal matrix $\matr U$. Also since $\matr V$ is non-negative definite, $\matr V$ has eigenvalues $\lambda_1, \ldots, \lambda_n \geq 0$. $$ \begin{align*} \matr V &= \matr U\matr \Lambda \matr U^T, & \quad \matr \Lambda &= \op{diag}(\lambda_1, \ldots, \lambda_n). \\ \text{Set } \matr \sigma &= \matr U\sqrt{\matr \Lambda} \matr U^T, &\sqrt{\matr \Lambda} &= \op{diag}(\sqrt{\lambda_1}, \ldots, \sqrt{\lambda_n}) \end{align*} $$ so we have $\matr \sigma\matr \sigma^T = \matr V$.)

For positive definite variance $\matr V$ (equivalently $\matr V$ is invertible), the density function of $\v X\sim N(\v \mu, \matr V)$ is $$ \begin{align*} f_\v X(\v x) = \frac{\exp\left(-\frac{1}{2} (\v x-\v \mu)^T \matr V\inv (\v x-\v \mu)\right)}{\sqrt{(2\pi)^n \det \matr V}}. \end{align*} $$ (Derivation)

If $\matr V$ is not invertible, then $\matr U$ can be choosen so that $\matr U\v X \sim N(\matr U\v\mu, \matr U\matr V\matr U^T)$ with $$ \begin{align*} \matr U\matr V\matr U^T = \op{diag}(\lambda_1, \lambda_2, \ldots, \lambda_k, 0, \ldots, 0) \equiv \pmat{\matr V_0 & \matr 0 \\ \matr 0 & \matr 0}. \end{align*} $$ where $\matr V_0$ is positive definite. Then we can construct $$ \begin{align*} \v X = \v \mu + \matr U^T \pmat{\v Y\\\v 0}, \quad \v Y = \sqrt{\matr V_0}\pmat{z_1 \\ z_2 \\ \vdots \\ z_k} \end{align*} $$ and $\v Y$ has density $$ \begin{align*} f_\v Y(\v y) = \frac{\exp\left(-\frac{1}{2} \v y^T \matr V_0\inv \v y\right)}{\sqrt{(2\pi)^n\det \matr V_0}} \end{align*} $$

Bivariate normal open_in_new

Let $\v X$ be a non-degenerate normal random variable in $\R^2$, i.e. $\matr V=\var(\v X)$ is invertible. $\v X$ is uniquely determined by each $(\mu_1, \mu_2, \sigma_1^2, \sigma_2^2, \rho) \in \R^2\times (0,\infty)^2 \times (-1, 1)$, where $\mu_i = \expect(X_i), \sigma_i^2 = \expect(X_i), \rho = \op{corr}(X_1,X_2)$. (Proof)

If $\op{corr}(X_1, X_2)=0$, then $X_1, X_2$ are independent. (Proof) For a general $\rho$, we can write $$ \begin{align*} X_2 = aX_1 + Y \end{align*} $$ where $Y$ is normal and independent of $X_1$, and $a = \rho\sigma_2/\sigma_1$. (Derivation)

Simulation of random variables open_in_new

We have access to a sequence of independent $U[0,1]$ random variables $U_1, U_2, \ldots, U_n$, and we want to simulate independent random variables $(X_1, X_2, \ldots, X_n)$ having a given distribution.

Simulation using inverse function open_in_new

Suppose our desired density function is $f$ in an open interval $I$. Then the distribution function $F(x) = \int_{-\infty}^{x} f(y) dy$ is an increasing map from $I$ to $(0,1)$. Let the quantile function be $$ \begin{align*} G(u) = \inf\sb{x\in\R}{u\leq F(x)}. \end{align*} $$ (When $f$ is positive everywhere, $G=F\inv$.) Note that for all $x\in\R, u\in(0,1)$, $$ \begin{align*} G(u) \leq x \iff u \leq F(x). \end{align*} $$ Then when we have $U\sim U[0,1]$ and let $X=G(U)$, we have $$ \begin{align*} \prob(X\leq x) = \prob(G(U)\leq x) = \prob(U\leq F(x)) = F(x) \end{align*} $$ so $X$ has a distribution function $F_X$.

Box-Muller transform open_in_new

To simulate $X\sim N(0,1)$, we take $U,V\sim U[0,1]$ and set $$ \begin{align*} \Theta = 2\pi U, \quad R = \sqrt{-2\log V} \implies V = e^{-R^2/2}, \quad \Theta\sim U[0,2\pi]. \end{align*} $$ Then $X=R\cos\Theta$ and $Y=R\sin\Theta$ are independent $N(0,1)$ random variables. (Derivation)

Rejection sampling with uniform random variables open_in_new

To simulate $\v U\sim U([0,1]^d)$, we take $\v U = (\bar U_1, \bar U_2, \ldots, \bar U_d)$ where $\bar U_i \sim U[0,1]$ are independent.

For some $A\subseteq [0,1]^d$, to simulate a random variable $\v X$ in $[0,1]^d$ having density $$ \begin{align*} f(\v x) = \frac{1_A(\v x)}{|A|}, \end{align*} $$ take $\v U_1,\v U_2,\ldots$ independent $U([0,1]^d)$ random variables and $\v X$ to be the first of those which land in $A$, i.e. reject the others: $$ \begin{align*} \v X = \v U_N, \quad N=\min\sb{n\geq 1}{\v U_n \in A}. \end{align*} $$ (Derivation)

In general to simulate $\v X$ having a bounded density $f$ in $[0,1]^d$, let $f(\v x)\leq \lambda$ for all $\v x$. We'll apply the same technique as above to $[0,1]^{d+1}$:

Take $\v U_1, \v U_2, \ldots \sim U([0,1]^d)$ and $V_1,V_2,\ldots\sim U[0,1]$ all independent random variables, and $\v X$ to be the the first $\v U_n$ such that $V_n\leq f(\v U_n)/\lambda$: $$ \begin{align*} \v X = \v U_n, \quad N = \min\sb{n\geq 1}{V_n \leq f(\v U_n)/\lambda}. \end{align*} $$ (Derivation)

https://www.geogebra.org/calculator/gtjdw2kc

See the general formulation.

Sums of independent random variables open_in_new

Let $(X_n: x\in\N)$ be a sequence of independent identically distributed integrable random variables. Set $S_n = X_1 + \ldots + X_n$, $\mu = \expect(X_1)$ and $\sigma^2 = \var(X_1)$.

Theorem (weak law of large numbers) open_in_new

For all $\epsilon>0$, as $n\to\infty$, $$ \begin{align*} \prob\left(\left|\frac{S_n}{n} - \mu \right| > \epsilon\right) \to 0. \end{align*} $$

Proof for finite second moment

Theorem (strong law of large numbers) open_in_new

Let $X_1, X_2, \ldots$ be iid copies of $X$ taking values in $\R^k$. Assume $\expect \|X\|_2 < \infty$.

Then $$ \begin{align*} \frac{1}{n} \sum_{i=1}^{n} X_i \xrightarrow{a.s.}\expect[X_i]. \end{align*} $$

Proof for finite fourth moment

Theorem (central limit theorem) open_in_new

Suppose $X_n$ are square-integrable iid random variables in $\R^d$. Then $$ \begin{align*} \sqrt{n}\left(\frac{1}{n} \sum_{i=1}^{n} X_i - \expect[X_i]\right) \xrightarrow{d} N(0, \var(X_1)). \end{align*} $$

In particular for $d=1$, as $n\to\infty$, the normalised random variables $$ \begin{align*} Z_n = \frac{S_n - \mu n}{\sigma\sqrt{n}} \to Z \sim N(0,1) \text{ in distribution}. \end{align*} $$ Equivalently, for all $x\in\R$ $$ \begin{align*} \prob\left(\frac{S_n - \mu n}{\sigma\sqrt{n}} \leq x\right) \to \Phi(x) = \int_{-\infty}^{x} \frac{1}{\sqrt{2\pi}} e^{-y^2/2}\, dy. \end{align*} $$

Proof with finite exponential moment

In applications, we imprecisely write $Z_n \stackrel{\text{approx.}}{\sim} N(0,1)$ or $S_n \stackrel{\text{approx.}}{\sim} N(n\mu, n\sigma^2)$.

Sample error via central limit theorem open_in_new

Often we want to know how large $N$ needs to be such that $$ \begin{align*} \prob\left(\left|\frac{S_N}{N} - \mu \right| \geq \epsilon\right) \leq \delta. \end{align*} $$ By the central limit theorem, for large $N$, the normalised random variable $$ \begin{align*} Z_N = \frac{S_N - N\mu}{\sigma\sqrt{N}} \stackrel{\text{approx.}}{\sim} N(0,1). \end{align*} $$

Since $S_N/N - \mu = (\sigma/\sqrt{N})Z_N$, the event $$ \begin{align*} \left|\frac{S_N}{N}-\mu \right|\geq \epsilon \iff \left|Z_N \right| \geq \frac{\epsilon}{\sigma}\sqrt{N}. \end{align*} $$ By symmetry, $$ \begin{align*} \prob\left(\left|\frac{S_N}{N}-\mu \right|\geq \epsilon\right) = 2\prob\left(Z_N \geq \frac{\epsilon}{\sigma}\sqrt{N}\right) = 2\left(1-\Phi\left(\frac{\epsilon}{\sigma}\sqrt{N}\right)\right). \end{align*} $$ So we want $$ \begin{align*} N = \left(\frac{\sigma}{\epsilon}\Phi\inv\left(1-\frac{\delta}{2}\right)\right)^2. \end{align*} $$