AI Knowledge Tree

Bernoulli, Binomial, Poisson, Gaussian

Know the defining stories, PMFs/PDFs, and moments of the workhorse distributions.

A handful of distributions show up again and again because each models a simple, recurring mechanism: a single yes/no trial, a count of successes, a count of rare events, and the limiting bell curve that sums of anything tend toward[1]. Knowing their stories and moments cold pays off everywhere downstream.

Bernoulli: one trial

A Bernoulli random variable X∈{0,1}X \in \{0, 1\} models a single trial with success probability qq:

P(X=1)=q,P(X=0)=1−q,pX(x)=qx(1−q)1−x.P(X = 1) = q, \quad P(X = 0) = 1 - q, \qquad p_X(x) = q^x (1-q)^{1-x}.

Mean: E[X]=1⋅q+0⋅(1−q)=q\mathbb{E}[X] = 1 \cdot q + 0 \cdot (1-q) = q. Variance: E[X2]=q\mathbb{E}[X^2] = q (since X2=XX^2 = X for a 0/1 variable), so Var⁡(X)=q−q2=q(1−q)\operatorname{Var}(X) = q - q^2 = q(1-q), maximized at q=1/2q = 1/2.

Binomial: counting successes

The Binomial X∼Bin(n,q)X \sim \text{Bin}(n, q) counts successes in nn independent Bernoulli(qq) trials. The PMF multiplies the probability of any specific sequence with kk successes, qk(1−q)n−kq^k(1-q)^{n-k}, by the number of such sequences:

pX(k)=(nk)qk(1−q)n−k,k=0,1,…,n.p_X(k) = \binom{n}{k} q^k (1-q)^{n-k}, \qquad k = 0, 1, \dots, n.

Writing X=∑i=1nXiX = \sum_{i=1}^n X_i as a sum of independent Bernoullis, linearity and (for independent terms) additivity of variance give

E[X]=nq,Var⁡(X)=nq(1−q),\mathbb{E}[X] = nq, \qquad \operatorname{Var}(X) = nq(1-q),

with no need to sum the PMF directly. The sum-of-indicators decomposition is the fast route to both moments.

Poisson: rare events

The Poisson X∼Pois(λ)X \sim \text{Pois}(\lambda) counts events in a fixed interval when they occur independently at an average rate λ\lambda. It arises as the limit of Bin(n,λ/n)\text{Bin}(n, \lambda/n) as n→∞n \to \infty (many trials, each rarely succeeding):

pX(k)=λke−λk!,k=0,1,2,…p_X(k) = \frac{\lambda^k e^{-\lambda}}{k!}, \qquad k = 0, 1, 2, \dots

A defining feature is equal mean and variance:

E[X]=λ,Var⁡(X)=λ.\mathbb{E}[X] = \lambda, \qquad \operatorname{Var}(X) = \lambda.

This equality is a quick diagnostic: count data with variance much larger than its mean is "overdispersed" and not Poisson. The mean-variance relationship separates these count distributions sharply, using the parameters from the code below:

  • Binomial(20, 0.3) has mean nq=6nq = 6 but variance nq(1−q)=4.2nq(1-q) = 4.2. The variance sits below the mean, because a bounded count (0≤k≤200 \le k \le 20) cannot spread freely.
  • Poisson(4) has mean and variance both equal to 44. Removing the upper bound (Poisson counts run to infinity) lets the variance rise to match the mean.

So variance below the mean points to a bounded Binomial-like count, variance equal to the mean to a Poisson, and variance above the mean to overdispersion that neither models.

Gaussian: the bell curve

The Gaussian (normal) X∼N(μ,σ2)X \sim \mathcal{N}(\mu, \sigma^2) is the continuous distribution with PDF[2]

fX(x)=12πσ2exp⁡ ⁣(−(x−μ)22σ2).f_X(x) = \frac{1}{\sqrt{2\pi\sigma^2}}\exp\!\left(-\frac{(x - \mu)^2}{2\sigma^2}\right).

Its parameters are its moments directly: E[X]=μ\mathbb{E}[X] = \mu and Var⁡(X)=σ2\operatorname{Var}(X) = \sigma^2. The standard normal N(0,1)\mathcal{N}(0, 1) has μ=0,σ=1\mu = 0, \sigma = 1, and any Gaussian standardizes via Z=(X−μ)/σZ = (X - \mu)/\sigma.

The Gaussian dominates because of the central limit theorem (a later lesson): sums and averages of many independent contributions converge to it regardless of the pieces' own distributions. Sums of independent Gaussians are again Gaussian, with means and variances adding.

The four workhorse distributions with the parameters used below: Bernoulli(0.3), Binomial(20, 0.3) and Poisson(4) probability masses, and the Gaussian(1, 2) density.
The four workhorse distributions with the parameters used below: Bernoulli(0.3), Binomial(20, 0.3) and Poisson(4) probability masses, and the Gaussian(1, 2) density.

Check it on arrays

python · numpy
import numpy as np
from math import comb, factorial

rng = np.random.default_rng(6)
N = 1_000_000

# Bernoulli(0.3)
q = 0.3
B = (rng.random(N) < q).astype(float)
print(f"Bernoulli mean {B.mean():.3f} (q={q}), var {B.var():.3f} (q(1-q)={q*(1-q):.3f})")

# Binomial(n=20, q=0.3)
n = 20
X = rng.binomial(n, q, size=N)
print(f"Binomial mean {X.mean():.3f} (nq={n*q}), var {X.var():.3f} (nq(1-q)={n*q*(1-q):.3f})")
# Check one PMF value
k = 6
print(f"P(X={k}) sim {np.mean(X == k):.4f}, exact {comb(n,k)*q**k*(1-q)**(n-k):.4f}")

# Poisson(lambda=4): mean == variance
lam = 4.0
Pn = rng.poisson(lam, size=N)
print(f"Poisson mean {Pn.mean():.3f}, var {Pn.var():.3f} (both {lam})")
print(f"P(X=3) sim {np.mean(Pn == 3):.4f}, exact {lam**3*np.exp(-lam)/factorial(3):.4f}")

# Gaussian(mu=1, sigma=2): standardize and check ~N(0,1)
G = rng.normal(1.0, 2.0, size=N)
Z = (G - 1.0) / 2.0
print(f"standardized mean {Z.mean():.3f} (~0), std {Z.std():.3f} (~1)")

Every mean and variance lands on its formula, the binomial and Poisson PMF spot checks match, and standardizing the Gaussian produces a unit normal.

Exercises

Exercise 1. A fair die is rolled 12 times. Model the number of sixes as a Binomial and compute its mean and variance from the formulas, then give P(X=2)P(X = 2) to four decimals.

Solution

Step 1. Each roll is a Bernoulli with q=1/6q = 1/6 (six or not), and the rolls are independent, so the count of sixes is X∼Bin(12,1/6)X \sim \text{Bin}(12, 1/6).

Step 2. Apply the moment formulas:

E[X]=nq=12⋅16=2,Var⁡(X)=nq(1−q)=12⋅16⋅56=106≈1.6667.\mathbb{E}[X] = nq = 12 \cdot \tfrac{1}{6} = 2, \qquad \operatorname{Var}(X) = nq(1-q) = 12 \cdot \tfrac{1}{6} \cdot \tfrac{5}{6} = \tfrac{10}{6} \approx 1.6667.

Step 3. Evaluate the PMF at k=2k = 2:

P(X=2)=(122)(16)2(56)10=66⋅136⋅(56)10≈66⋅0.027778⋅0.161506≈0.2961.P(X = 2) = \binom{12}{2}\left(\tfrac{1}{6}\right)^2\left(\tfrac{5}{6}\right)^{10} = 66 \cdot \tfrac{1}{36} \cdot \left(\tfrac{5}{6}\right)^{10} \approx 66 \cdot 0.027778 \cdot 0.161506 \approx 0.2961.

The most probable count is the mean of 2, carrying about 0.296 of the mass.

Exercise 2. Take the Binomial Bin(n,λ/n)\text{Bin}(n, \lambda/n) and show that, as n→∞n \to \infty with λ\lambda fixed, its PMF at a fixed kk converges to the Poisson PMF λke−λk!\frac{\lambda^k e^{-\lambda}}{k!}.

Solution

Step 1. Write the Binomial PMF with q=λ/nq = \lambda/n:

P(X=k)=(nk)(λn)k(1−λn)n−k.P(X = k) = \binom{n}{k}\left(\frac{\lambda}{n}\right)^k\left(1 - \frac{\lambda}{n}\right)^{n-k}.

Step 2. Expand (nk)=n(n−1)⋯(n−k+1)k!\binom{n}{k} = \frac{n(n-1)\cdots(n-k+1)}{k!} and group powers of nn:

P(X=k)=λkk!⋅n(n−1)⋯(n−k+1)nk⏟(a)⋅(1−λn)n⏟(b)⋅(1−λn)−k⏟(c).P(X = k) = \frac{\lambda^k}{k!}\cdot\underbrace{\frac{n(n-1)\cdots(n-k+1)}{n^k}}_{(a)}\cdot\underbrace{\left(1 - \frac{\lambda}{n}\right)^{n}}_{(b)}\cdot\underbrace{\left(1 - \frac{\lambda}{n}\right)^{-k}}_{(c)}.

Step 3. Take n→∞n \to \infty with kk fixed. Factor (a)(a) is a product of kk terms each tending to 1, so (a)→1(a) \to 1. Factor (b)→e−λ(b) \to e^{-\lambda} by the standard limit (1−x/n)n→e−x(1 - x/n)^n \to e^{-x}. Factor (c)→1(c) \to 1 since λ/n→0\lambda/n \to 0 and kk is fixed. What remains is

P(X=k)→λkk! e−λ,P(X = k) \to \frac{\lambda^k}{k!}\,e^{-\lambda},

the Poisson PMF. Many trials each rarely succeeding give a Poisson count.

Exercise 3 (code). Demonstrate the convergence of Exercise 2 numerically: compare the Bin(n,4/n)\text{Bin}(n, 4/n) PMF against Pois(4)\text{Pois}(4) at k=0,…,9k = 0, \dots, 9 for growing nn, and confirm the gap shrinks.

Solution
python · numpy
import numpy as np
from math import comb, factorial

lam = 4.0
ks = np.arange(10)

def binom_pmf(n, q, k):
    return comb(n, k) * q**k * (1 - q)**(n - k)

def pois_pmf(lam, k):
    return lam**k * np.exp(-lam) / factorial(k)

pois = np.array([pois_pmf(lam, k) for k in ks])

prev = None
for n in [10, 50, 200, 1000]:
    binom = np.array([binom_pmf(n, lam / n, k) for k in ks])
    err = np.max(np.abs(binom - pois))
    print(f"n={n:5d}  max |Bin - Pois| = {err:.5f}")
    if prev is not None:
        assert err < prev          # error decreases as n grows
    prev = err

The maximum gap between the Binomial and Poisson PMFs falls monotonically as nn grows, confirming the limit derived by hand.

The next lesson shows that three of these four share a single algebraic skeleton: the exponential family.


References

  1. [1]Casella, G., & Berger, R. L. (2002). Statistical Inference (2nd ed.). Duxbury. §3.2-3.3, families of discrete and continuous distributions.↩
  2. [2]Bishop, C. M. (2006). Pattern Recognition and Machine Learning. Springer. §2.1-2.3, the Bernoulli, binomial, and Gaussian distributions.↩