Discrete Probability Distributions

Discrete probability distributions are a small set of recurring patterns for counting outcomes. Learn the uniform, Bernoulli, binomial, Poisson, geometric, and negative binomial, plus expected value and variance, with worked examples.

Probability becomes a usable tool the moment we attach numbers to the outcomes of an experiment, and that is exactly what a random variable does. A random variable maps each outcome of an experiment to a real number, so that probabilities can be attached to those numbers, and its value varies from one run of the experiment to the next, unpredictable before the experiment is performed. By convention a capital letter such as X denotes the random variable itself, and a lower-case letter such as x denotes a particular value it takes. A coin toss, for instance, becomes a random variable by coding heads as one and tails as zero. This article works through the family of discrete distributions built on that idea, from the uniform and Bernoulli through the binomial, Poisson, geometric, and negative binomial, along with the expectation and variance that summarise each one.

Discrete and Continuous Variables

Random variables split into two kinds. A discrete random variable takes countable values, typically the non-negative integers, as with the number of heads in a series of coin tosses. A continuous random variable takes values across a range of the real line, as with the height of adults in centimetres. The full description of a discrete random variable is its probability distribution, the complete set of values it can take together with their probabilities, and a defining requirement is that those probabilities sum to one.

The Discrete Uniform Distribution

The simplest case is the one where every outcome is equally likely. If there are k possible values, each carries probability one over k.

P(X=x)=1k,x=1,2,…,kP(X = x) = \frac{1}{k}, \quad x = 1, 2, \ldots, k

A fair die is the textbook example, with k equal to six, so every score has probability one sixth and the bars of its probability plot are all the same height.

Bernoulli Trials and the Bernoulli Distribution

The building block of much of probability is the Bernoulli trial, an experiment with exactly two outcomes, success coded as one and failure coded as zero, where the probability of success is a fixed value pi and the trials are independent of one another.

P(X=x)=πx(1−π)1−x,x=0,1P(X = x) = \pi^x (1 – \pi)^{1-x}, \quad x = 0, 1

Almost any measurement can be turned into a Bernoulli trial by collapsing it into two categories, such as the sex of a newborn, whether a manufactured item is defective, whether a voter supports a candidate, or even whether a person is taller than 180 centimetres.

The Binomial Distribution

Counting the number of successes across several identical, independent Bernoulli trials gives the binomial distribution. If there are n trials each with success probability pi, the number of successes X is binomial.

X∼Bin(n,π)X \sim \text{Bin}(n, \pi)
P(X=x)=(nx)πx(1−π)n−x,x=0,1,…,nP(X = x) = \binom{n}{x} \pi^x (1 – \pi)^{n-x}, \quad x = 0, 1, \ldots, n

So X can take n plus one different values, from zero up to n. The distribution applies only when four conditions hold: each trial has just two outcomes, the success probability pi is fixed, the number of trials n is fixed, and the trials are statistically independent. Consider ten test tubes each with a 0.2 probability of bacterial growth, so X is binomial with n equal to ten and pi equal to 0.2. The probability that exactly four show growth is the binomial formula evaluated at four.

P(X=4)=(104)(0.2)4(0.8)6P(X = 4) = \binom{10}{4}(0.2)^4(0.8)^6

The probability that more than one shows growth is most easily found through the complement, by subtracting the probabilities of zero and one.

P(X>1)=1−(0.8)10−(101)(0.2)(0.8)9=0.6242P(X > 1) = 1 – (0.8)^{10} – \binom{10}{1}(0.2)(0.8)^9 = 0.6242

The Cumulative Distribution Function

Alongside the probability of a single value, it is often useful to know the probability of being at or below a value, which the cumulative distribution function provides.

F(x)=P(X≤x)=∑k=0xP(X=k)F(x) = P(X \leq x) = \sum_{k=0}^{x} P(X = k)

You can recover the individual probabilities from it by taking successive differences.

P(X=x)=F(x)−F(x−1)P(X = x) = F(x) – F(x-1)

For a discrete distribution the cumulative function is a step function: it is flat between integers and jumps at each integer by the probability of that value.

The Poisson Distribution

The Poisson distribution models the number of random points occurring in a continuous medium, whether that is time, distance, area, or volume, on the assumptions that each point is equally likely to fall anywhere in the medium and that the points occur independently.

P(X=x)=e−λλxx!,x=0,1,2,…P(X = x) = \frac{e^{-\lambda}\lambda^x}{x!}, \quad x = 0, 1, 2, \ldots

Here lambda is the rate parameter, the average number of points per unit of the medium, and unlike the binomial there is no upper bound on x. A key flexibility is scaling: to find the rate over k units of the medium, you simply use k times lambda. Take a machine that breaks down on average 3.2 times a week. The probability of exactly one breakdown next week comes straight from the formula.

P(X=1)=e−3.2(3.2)11!=0.1304P(X = 1) = \frac{e^{-3.2}(3.2)^1}{1!} = 0.1304

For exactly four breakdowns over two weeks, the rate doubles to 6.4 and the formula applies again.

P(X=4)=e−6.4(6.4)44!=0.1162P(X = 4) = \frac{e^{-6.4}(6.4)^4}{4!} = 0.1162

Approximating the Binomial with the Poisson

When n is very large, evaluating the factorials in the binomial becomes impractical, and the Poisson offers a close approximation. It is valid when n exceeds about thirty, when pi is extreme enough that the product n times pi is below ten, and when x is small relative to n, in which case you set lambda equal to n times pi. For one hundred items with a 0.02 defect rate, lambda is two, and the conditions hold, so the Poisson closely matches the true binomial.

(1003)(0.02)3(0.98)97=0.1823≈e−2233!=0.1804\binom{100}{3}(0.02)^3(0.98)^{97} = 0.1823 \approx \frac{e^{-2}2^3}{3!} = 0.1804

Expected Value

The expected value of a discrete random variable is its population mean, the probability-weighted average of all the values it can take.

E(X)=μ=∑i=1NxipiE(X) = \mu = \sum_{i=1}^{N} x_i p_i

This is distinct from the sample mean computed from observed data, although the sample mean converges to the expected value as the sample grows. For the standard distributions the expected value has a simple closed form: a binomial has mean n times pi, and a Poisson has mean lambda.

E(X)=nπ(binomial),E(X)=λ(Poisson) E(X) = n\pi \quad (\text{binomial}), \qquad E(X) = \lambda \quad (\text{Poisson})

The expectation operator is linear, which makes it easy to handle scaled and combined variables.

E(αX±βY)=αE(X)±βE(Y)E(\alpha X \pm \beta Y) = \alpha E(X) \pm \beta E(Y)

Variance

Variance measures how spread out a distribution is around its mean, as the expected squared deviation from the mean.

σ2=E((X−μ)2)=∑i=1N(xi−μ)2pi \sigma^2 = E\big((X – \mu)^2\big) = \sum_{i=1}^{N} (x_i – \mu)^2 p_i

There is an equivalent and usually easier form, the mean of the square minus the square of the mean.

σ2=E(X2)−μ2 \sigma^2 = E(X^2) – \mu^2

Rearranging this gives the often-useful identity that the expected value of the square equals the variance plus the squared mean. For a fair die, the mean is 3.5, the expected value of the square is 91 over 6, and the variance follows.

σ2=916−(3.5)2=2.92 \sigma^2 = \frac{91}{6} – (3.5)^2 = 2.92

The standard deviation is its square root, about 1.71. The standard distributions again have tidy variances: a binomial has variance n times pi times one minus pi, and a Poisson has variance lambda.

Var(X)=nπ(1−π)(binomial),Var(X)=λ(Poisson)\text{Var}(X) = n\pi(1-\pi) \quad (\text{binomial}), \qquad \text{Var}(X) = \lambda \quad (\text{Poisson})

A striking feature of the Poisson is that its mean and variance are equal, both lambda. Variance behaves differently from expectation under linear combinations. A scaling constant comes out squared, and for independent variables the variances add regardless of whether the variables are combined with a plus or a minus.

Var(αX)=α2,Var(X)\text{Var}(\alpha X) = \alpha^2,\text{Var}(X)
Var(αX±βY)=α2,Var(X)+β2,Var(Y) \text{Var}(\alpha X \pm \beta Y) = \alpha^2,\text{Var}(X) + \beta^2,\text{Var}(Y)

That last point is worth dwelling on: variance always adds, never subtracts, because spreads accumulate whichever direction the variables are combined.

Waiting for Success: Geometric and Negative Binomial

Two more distributions describe how long you wait for successes rather than how many you count. The geometric distribution applies when Bernoulli trials are repeated until the first success, with X being the trial number on which that success occurs.

P(X=x)=(1−π)x−1π,x=1,2,…P(X = x) = (1 – \pi)^{x-1}\pi, \quad x = 1, 2, \ldots
E(X)=1π,Var(X)=1−ππ2E(X) = \frac{1}{\pi}, \qquad \text{Var}(X) = \frac{1-\pi}{\pi^2}

The logic is transparent: for the first success to land on trial x, the previous x minus one trials must all have been failures, each with probability one minus pi. The negative binomial generalises this to wait for the rth success, with the geometric being the special case where r equals one.

P(X=x)=(x−1r−1)πr(1−π)x−r,x=r,r+1,…P(X = x) = \binom{x-1}{r-1} \pi^r (1 – \pi)^{x-r}, \quad x = r, r+1, \ldots
E(X)=rπ,Var(X)=r(1−π)π2E(X) = \frac{r}{\pi}, \qquad \text{Var}(X) = \frac{r(1-\pi)}{\pi^2}

Rolling a die until the seventh success, with success probability one sixth, the soonest possible is seven rolls, whose probability is one sixth to the seventh power, and the general term for the rth success on roll k follows the formula above.

A Worked Example Tying It Together

Consider a four-question multiple-choice exam answered by pure guesswork, with each question offering a one-in-three chance, so the number correct is binomial with n equal to four and pi equal to one third. Its mean and variance come from the binomial formulas.

E(X)=4×13=1.33,Var(X)=4×13×23=0.89E(X) = 4 \times \frac{1}{3} = 1.33, \qquad \text{Var}(X) = 4 \times \frac{1}{3} \times \frac{2}{3} = 0.89

Now suppose the mark is rescaled to Y equal to ten plus 22.5 times X. The linearity of expectation gives the new mean directly, while the variance picks up the squared coefficient.

E(Y)=10+22.5×1.33=39.93E(Y) = 10 + 22.5 \times 1.33 = 39.93
Var(Y)=(22.5)2×0.89=450.6\text{Var}(Y) = (22.5)^2 \times 0.89 = 450.6

This shows the two rules working side by side: the constant ten shifts the mean but vanishes from the variance, and the multiplier 22.5 scales the mean once but the variance by its square.

A few exercises for you to practice with: https://datalad.co.uk/discrete-probability-distributions-10-exercises-with-full-solutions/

Quick Reference

DistributionNotationMeanVariance
Discrete uniform—(k+1)/2—
BernoulliBern(π)ππ(1−π)
BinomialBin(n, π)nπnπ(1−π)
PoissonPois(λ)λλ
GeometricGeo(π)1/π(1−π)/π²
Negative binomialNegBin(r, π)r/πr(1−π)/π²

Conclusion

Discrete probability distributions are a small set of recurring patterns, each suited to a particular kind of counting. Use the uniform when outcomes are equally likely, the Bernoulli for a single yes-or-no trial, the binomial for the number of successes in a fixed number of trials, and the Poisson for random events in a continuous medium, switching to the Poisson as a shortcut when the binomial’s n grows too large. When you are waiting for successes rather than counting them in a fixed run, the geometric handles the first success and the negative binomial the rth. Across all of them, two summaries carry most of the weight: the expected value, a probability-weighted average that is linear and so easy to combine, and the variance, which scales by the square of a constant and adds across independent variables whether they are summed or differenced. Learn which distribution fits the experiment, then read its mean and variance off the table, and most discrete probability questions reduce to plugging into a formula you already recognise.

View Comments (1)

Leave a Reply

Subscribe to My Newsletter

Subscribe to my email newsletter to get the latest posts delivered right to your email. Pure inspiration, zero spam.

Discover more from Discuss Data Science, Machine Learning and Analytics

Subscribe now to keep reading and get access to the full archive.

Continue reading