Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Review of Probability

Random Experiments, Sample Spaces, and Events

Probability of Events

A probability function P(⋅)P(\cdot) over events in SS satisfies:

  1. Non-negativity: P(A)≥0P(A) \geq 0

  2. Normalization: P(S)=1P(S) = 1

  3. Additivity:

    • If A∩B=∅A \cap B = \emptyset: P(A∪B)=P(A)+P(B)P(A \cup B) = P(A) + P(B)

    • In general: P(A∪B)=P(A)+P(B)−P(A∩B)P(A \cup B) = P(A) + P(B) - P(A \cap B)

Random Variables

A random variable is a function mapping outcomes to real values:

X:S→RX : S \to \mathbb{R}

Example (two coin tosses): Let XX = number of tails.

X(H,H)=0,X(H,T)=1,X(T,H)=1,X(T,T)=2.X(H,H)=0,\quad X(H,T)=1,\quad X(T,H)=1,\quad X(T,T)=2.

The state space (support) of XX is X={0,1,2}\mathcal{X} = \{0, 1, 2\}.

Two types:

Probability Mass Function (PMF) — Discrete

For a discrete random variable XX with state space X\mathcal{X}, the PMF is P(X=x)P(X = x) for x∈Xx \in \mathcal{X}.

Properties:

Joint, Marginal, and Conditional Probabilities

For two discrete random variables XX and YY:

Bayes’ Rule

P(X=x∣Y=y)=P(X=x) P(Y=y∣X=x)∑x′∈XP(X=x′) P(Y=y∣X=x′)\boxed{P(X = x \mid Y = y) = \frac{P(X = x)\, P(Y = y \mid X = x)}{\displaystyle\sum_{x' \in \mathcal{X}} P(X = x')\, P(Y = y \mid X = x')}}

Independent Random Variables

XX and YY are independent if:

P(X,Y)=P(X) P(Y)P(X, Y) = P(X)\, P(Y)

Expectation and Variance

For a discrete random variable XX:

E[X]=∑x∈Xx P(X=x)\mathbb{E}[X] = \sum_{x \in \mathcal{X}} x\, P(X = x)
Var(X)=E[(X−E[X])2]=E[X2]−E[X]2\text{Var}(X) = \mathbb{E}\bigl[(X - \mathbb{E}[X])^2\bigr] = \mathbb{E}[X^2] - \mathbb{E}[X]^2
Std(X)=Var(X)\text{Std}(X) = \sqrt{\text{Var}(X)}

Common Distributions

Bernoulli Distribution

Models a single binary trial (e.g., one coin flip).

p(x∣μ)=μx(1−μ)1−x,x∈{0,1}p(x \mid \mu) = \mu^x (1-\mu)^{1-x}, \quad x \in \{0, 1\}

where μ=P(X=1)\mu = P(X = 1). Mean and variance:

E[X]=μ,Var(X)=μ(1−μ)\mathbb{E}[X] = \mu, \qquad \text{Var}(X) = \mu(1 - \mu)

Binomial Distribution

Models the number of successes in NN independent Bernoulli trials.

Bin(m∣N,μ)=(Nm)μm(1−μ)N−m\text{Bin}(m \mid N, \mu) = \binom{N}{m} \mu^m (1-\mu)^{N-m}

Mean and variance:

E[m]=Nμ,Var(m)=Nμ(1−μ)\mathbb{E}[m] = N\mu, \qquad \text{Var}(m) = N\mu(1-\mu)

Continuous Random Variables

For a continuous random variable XX, P(X=x)=0P(X = x) = 0 for any single point. Probabilities are described by the probability density function (PDF) pX(x)p_X(x):

P(a<X<b)=∫abpX(x) dxP(a < X < b) = \int_a^b p_X(x)\, dx

The cumulative distribution function (CDF) is:

FX(x)=P(X≤x),pX(x)=ddxFX(x)F_X(x) = P(X \leq x), \qquad p_X(x) = \frac{d}{dx} F_X(x)

Bivariate Continuous Distributions

For joint PDF pX,Y(x,y)p_{X,Y}(x,y) satisfying ∫−∞∞∫−∞∞pX,Y(x,y) dx dy=1\int_{-\infty}^\infty \int_{-\infty}^\infty p_{X,Y}(x,y)\, dx\, dy = 1:

Gaussian (Normal) Distribution

The Gaussian distribution is one of the most important models in machine learning.

Univariate:

N(x∣μ,σ2)=12πσ2exp⁡ ⁣(−(x−μ)22σ2)\mathcal{N}(x \mid \mu, \sigma^2) = \frac{1}{\sqrt{2\pi\sigma^2}} \exp\!\left(-\frac{(x-\mu)^2}{2\sigma^2}\right)

where μ\mu is the mean and σ2\sigma^2 is the variance.

Multivariate (DD-dimensional vector x\mathbf{x}):

N(x∣μ,Σ)=1(2π)D/2∣Σ∣1/2exp⁡ ⁣(−12(x−μ)⊤Σ−1(x−μ))\mathcal{N}(\mathbf{x} \mid \boldsymbol{\mu}, \boldsymbol{\Sigma}) = \frac{1}{(2\pi)^{D/2} |\boldsymbol{\Sigma}|^{1/2}} \exp\!\left(-\frac{1}{2}(\mathbf{x} - \boldsymbol{\mu})^\top \boldsymbol{\Sigma}^{-1} (\mathbf{x} - \boldsymbol{\mu})\right)

where μ\boldsymbol{\mu} is the mean vector and Σ\boldsymbol{\Sigma} is the covariance matrix.