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 models a single trial with success probability :
Mean: . Variance: (since for a 0/1 variable), so , maximized at .
Binomial: counting successes
The Binomial counts successes in independent Bernoulli() trials. The PMF multiplies the probability of any specific sequence with successes, , by the number of such sequences:
Writing as a sum of independent Bernoullis, linearity and (for independent terms) additivity of variance give
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 counts events in a fixed interval when they occur independently at an average rate . It arises as the limit of as (many trials, each rarely succeeding):
A defining feature is equal mean and variance:
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 but variance . The variance sits below the mean, because a bounded count () cannot spread freely.
- Poisson(4) has mean and variance both equal to . 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) is the continuous distribution with PDF[2]
Its parameters are its moments directly: and . The standard normal has , and any Gaussian standardizes via .
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.
Check it on arrays
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 to four decimals.
Solution
Step 1. Each roll is a Bernoulli with (six or not), and the rolls are independent, so the count of sixes is .
Step 2. Apply the moment formulas:
Step 3. Evaluate the PMF at :
The most probable count is the mean of 2, carrying about 0.296 of the mass.
Exercise 2. Take the Binomial and show that, as with fixed, its PMF at a fixed converges to the Poisson PMF .
Solution
Step 1. Write the Binomial PMF with :
Step 2. Expand and group powers of :
Step 3. Take with fixed. Factor is a product of terms each tending to 1, so . Factor by the standard limit . Factor since and is fixed. What remains is
the Poisson PMF. Many trials each rarely succeeding give a Poisson count.
Exercise 3 (code). Demonstrate the convergence of Exercise 2 numerically: compare the PMF against at for growing , and confirm the gap shrinks.
Solution
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 = errThe maximum gap between the Binomial and Poisson PMFs falls monotonically as grows, confirming the limit derived by hand.
The next lesson shows that three of these four share a single algebraic skeleton: the exponential family.