Skip to content

ProbabilityLesson 5 of 6

The usual suspects

Bernoulli, binomial, uniform, and normal distributions

A named distribution packages an experiment and its probabilities. The parameters specify which member of the family you mean.

XBer(p)X\sim\operatorname{Ber}(p) means X is 1 with probability p and 0 with probability 1−p. The symbol \sim reads “is distributed as.” The p in this expression is a probability, not the number of features used later in ML.

E[X]=1p+0(1p)=p.\mathbb E[X]=1p+0(1-p)=p.

Since squaring 0 or 1 changes nothing, E[X2]=p\mathbb E[X^2]=p too. The variance shortcut gives

Var(X)=pp2=p(1p).\operatorname{Var}(X)=p-p^2=p(1-p).

At p=0 or p=1 there is no uncertainty and the variance is zero. It is largest at p=1/2.

Binomial: count successes in independent trials

Section titled “Binomial: count successes in independent trials”

XBin(n,p)X\sim\operatorname{Bin}(n,p) is the number of successes in n independent Bernoulli trials, all with the same success probability p.

Pr(X=h)=(nh)ph(1p)nh,h=0,,n.\Pr(X=h)=\binom nh p^h(1-p)^{n-h},\qquad h=0,\ldots,n.

Choose which h trials succeed. Each particular arrangement has probability ph(1p)nhp^h(1-p)^{n-h}. The factor (nh)\binom nh, “n choose h,” counts the arrangements.

For three fair flips and one head, the arrangements are HTT, THT, and TTH. Each has probability 1/8, so their total is 3/8.

The count is a sum of n Bernoulli variables. Linearity gives E[X]=np\mathbb E[X]=np. Independence lets their variances add, giving Var(X)=np(1p)\operatorname{Var}(X)=np(1-p).

How does “n choose h” count arrangements?

To choose h different positions in order, there are n(n1)(nh+1)n(n-1)\cdots(n-h+1) possibilities. Each unordered set of positions was counted h! times, once for each ordering. Divide by h!:

(nh)=n!h!(nh)!.\binom nh=\frac{n!}{h!(n-h)!}.

For two successes among four positions, this gives 43/(21)=64\cdot3/(2\cdot1)=6.

For XUnif[a,b]X\sim\operatorname{Unif}[a,b], with a<b, the density is 1/(ba)1/(b-a) inside the interval and zero outside it. Width times height is one. Its mean is the midpoint (a+b)/2(a+b)/2.

To derive the variance, start with UUnif[0,1]U\sim\operatorname{Unif}[0,1]. Its mean is 1/2, and

E[U2]=01u2du=[u33]01=13.\mathbb E[U^2]=\int_0^1 u^2\,du=\left[\frac{u^3}{3}\right]_0^1=\frac13.

The bracket means evaluate at the upper endpoint and subtract the value at the lower one. The function u3/3u^3/3 is used because its derivative is u2u^2.

Thus Var(U)=1/31/4=1/12\operatorname{Var}(U)=1/3-1/4=1/12. Any uniform on [a,b] can be written as X=a+(ba)UX=a+(b-a)U. Shifting does not change variance; scaling by b−a multiplies it by (ba)2(b-a)^2:

Var(X)=(ba)212.\operatorname{Var}(X)=\frac{(b-a)^2}{12}.

For [−1,1], the width is 2, giving variance 4/12=1/34/12=1/3.

Normal: a bell described by mean and variance

Section titled “Normal: a bell described by mean and variance”

XN(μ,σ2)X\sim\mathcal N(\mu,\sigma^2) means a normal distribution with mean μ and variance σ². Its density is

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

Read the center first: x−μ measures distance from the mean. Dividing by σ measures that distance in standard deviations. Squaring makes both directions behave the same. The negative exponential makes distant values have smaller density. The leading factor normalizes the total area to one.

This explains how to read and use the formula. Deriving the normal family and its normalization is a separate calculation, not a prerequisite for these examples.

The standard normal has μ=0 and σ=1. Its CDF is named Φ\Phi. It has no elementary closed form, but it has exact definitions using integrals and special functions, and accurate numerical approximations. “No elementary closed form” does not mean “no formula.”

A useful conversion is

Z=XμσN(0,1).Z=\frac{X-\mu}{\sigma}\sim\mathcal N(0,1).

For XN(10,4)X\sim\mathcal N(10,4), the standard deviation is 2, not 4. The probability Pr(X12)\Pr(X\le12) becomes Pr(Z1)=Φ(1)0.8413\Pr(Z\le1)=\Phi(1)\approx0.8413.

Why does this family arise often? Under the central limit theorem, the centered, properly scaled sum of many independent, identically distributed variables with finite nonzero variance approaches a standard normal distribution. The convergence is an approximation for finite sums, and dependence or heavy tails can change the result.

Describe two quantities together, and condition on one of them.

Definition

Read the full glossary entry →