Probability · Discrete Random Variables

Discrete Probability
Distributions

PMFs, CDFs, expected value, and variance, the complete toolkit for working with random variables that take countable values.

Share this page

§ 01What Is a Discrete Probability Distribution?

A discrete distribution assigns a probability to each of a countable set of outcomes. Before we can talk about means and variances, we need to understand exactly what a probability distribution is.

In everyday life, many phenomena produce outcomes that can be listed: the number of heads in five coin flips, the number of goals scored in a football match, the number of defective chips in a batch of 100. These are discrete random variables: they take values from a finite or countably infinite set, usually the non-negative integers.

A probability distribution is a complete description of how likely each possible value is. For a discrete random variable X, we capture this using two closely related functions: the probability mass function (PMF) and the cumulative distribution function (CDF).

Key Distinction: Discrete vs. Continuous A discrete random variable has a countable range of values, and we can assign non-zero probability to each one. A continuous random variable (like height or weight) takes values in an interval, and the probability of any single exact value is zero — those require a probability density function instead.

The most important discrete distributions you will encounter at varsity level are the Binomial, Poisson, Geometric, Hypergeometric, and Negative Binomial distributions. On this page we build the foundations, PMF, CDF, E[X], and Var[X], that make all of these distributions understandable.

§ 02The Probability Mass Function (PMF)

The probability mass function of a discrete random variable X is the function that tells you the probability that X takes each specific value.

Definition — PMF
P(X = x) = p(x),  for each x in the range of X

The PMF must satisfy two axioms, the same axioms that underpin all of probability theory:

PMF Axioms
1.  p(x) ≥ 0   for all x 2.  Σ p(x) = 1   (sum over all possible values)

If either axiom is violated, the function is not a valid PMF. The first axiom says probabilities can never be negative. The second says that when you add up the probabilities of all possible outcomes, you get exactly one, meaning something must happen.

Reading a PMF from a table

PMFs are often presented as a table of values. Consider the number of heads X when a fair coin is tossed three times:

x0123
P(X = x) 1/83/83/81/8

Check: 1/8 + 3/8 + 3/8 + 1/8 = 8/8 = 1. ✓ The PMF sums to 1.

The PMF can also be displayed as a bar chart, a key visualisation for understanding the shape and spread of a distribution. Each bar sits at a value x and has height equal to P(X = x).

§ 03Interactive PMF Diagram — Binomial(n, p)

The chart below shows the PMF of the Binomial distribution B(n, p). Drag the sliders to change n (number of trials) and p (probability of success) and watch how the distribution shifts, spreads, and skews.

Interactive · Binomial PMF

P(X = k) = C(n,k) · pk · (1−p)n−k

Notice how the distribution is symmetric when p = 0.5, right-skewed when p is small, and left-skewed when p is large. As n increases, the bell-shaped normal approximation becomes visible, this is the Central Limit Theorem at work.

§ 04The Cumulative Distribution Function (CDF)

While the PMF answers "what is the probability X equals exactly x?", the cumulative distribution function (CDF) answers "what is the probability that X is at most x?"

Definition — CDF
F(x) = P(X ≤ x) = Σt ≤ x p(t)

The CDF accumulates probabilities. For the three-coin-toss example:

x0123
P(X = x)1/83/83/81/8
F(x) = P(X ≤ x)1/84/87/88/8 = 1

Properties of the CDF

Every valid CDF for a discrete random variable satisfies these four properties. Knowing them helps you spot errors and answer "at least / at most" probability questions quickly:

CDF Properties
1.  0 ≤ F(x) ≤ 1   for all x 2.  F(x) is non-decreasing 3.  F(x) → 0 as x → −∞   and   F(x) → 1 as x → +∞ 4.  F(x) is right-continuous (step function with jumps at each mass point)

For a discrete distribution, the CDF is a staircase function, it remains flat between values of X and jumps upward at each value by an amount equal to P(X = x). This contrasts with a continuous distribution, where the CDF is a smooth, increasing curve.

Using the CDF for probability calculations

The CDF unlocks efficient computation of "between" and "at least" probabilities:

Useful identities
P(a < X ≤ b) = F(b) − F(a) P(X > a) = 1 − F(a) P(X = a) = F(a) − F(a−1)  [for integer-valued X]
Common Error: Strict vs. non-strict inequalities For discrete X, P(X < a) ≠ P(X ≤ a). Since X takes exact integer values, P(X < 3) = P(X ≤ 2) = F(2), not F(3). Always be careful about whether the boundary value is included.

§ 05Expected Value — The Weighted Average

The expected value E[X] (also called the mean or population mean, denoted μ) is the long-run average value of X over infinitely many independent repetitions of the experiment.

Definition — Expected Value
E[X] = μ = Σ x · P(X = x)

This is a weighted average of all possible values of X, where the weight of each value is its probability. Values that are more likely contribute more to the average.

Linearity of Expectation

One of the most powerful results in probability is that expectation is linear, regardless of whether the random variables are independent:

Linearity of Expectation
E[aX + b] = aE[X] + b E[X + Y] = E[X] + E[Y]

This means you can calculate the expected value of a sum by summing the individual expected values: even for dependent random variables. This property is used everywhere, from computing expected winnings in card games to analysing the average case complexity of algorithms.

Expected value of a function of X

Often we need E[g(X)] for some function g. The law of the unconscious statistician (LOTUS) states:

LOTUS
E[g(X)] = Σ g(x) · P(X = x)

This is used constantly when computing variance, as we shall see next.

§ 06Variance and Standard Deviation

The expected value tells us where the distribution is centred. The variance Var[X] (also written σ²) tells us how spread out the distribution is: how far typical values of X deviate from the mean.

Definition — Variance
Var[X] = σ² = E[(X − μ)²] = Σ (x − μ)² · P(X = x)

This is the expected squared deviation from the mean. Squaring ensures positive values and penalises large deviations more heavily.

The computational shortcut

Expanding (x − μ)² and applying linearity of expectation gives a far more convenient formula for calculation:

Computational Formula for Variance
Var[X] = E[X²] − (E[X])²

In words: variance equals the mean of the squares, minus the square of the mean. This formula is almost always faster to use in calculations because it avoids computing μ separately before working through each squared deviation.

Standard Deviation

The standard deviation σ = √Var[X] measures spread in the same units as X, making it directly interpretable. Variance is in squared units (e.g., goals², dollars²), which is why standard deviation is reported when describing real-world data.

Variance of a Linear Transformation
Var[aX + b] = a² · Var[X]

Note that adding a constant b shifts the distribution but does not change its spread, only multiplying by a stretches or compresses it. The b disappears because variance measures deviation from the mean, and adding a constant shifts both X and the mean by the same amount.

✦   ✦   ✦

§ 07Worked Examples

Ten fully worked examples, escalating from reading a PMF table to computing variance from scratch.

Example 01 — Verify a valid PMF
A random variable X has the following distribution. Determine the value of k and verify this is a valid PMF.

P(X = 1) = k,   P(X = 2) = 2k,   P(X = 3) = 3k,   P(X = 4) = 4k
  1. For a valid PMF, all probabilities must sum to 1:
    k + 2k + 3k + 4k = 1
  2. Collect terms:
    10k = 1  ⟹  k = 1/10
  3. The distribution is: P(1)=0.1, P(2)=0.2, P(3)=0.3, P(4)=0.4.
  4. Check axioms: all values ≥ 0 ✓, and 0.1+0.2+0.3+0.4 = 1 ✓
k = 1/10 = 0.1
Example 02 — Build the CDF
Using the PMF from Example 1 (with k = 0.1), write down the full CDF F(x) and use it to find P(X > 2).
  1. F(1) = P(X ≤ 1) = 0.1
  2. F(2) = P(X ≤ 2) = 0.1 + 0.2 = 0.3
  3. F(3) = P(X ≤ 3) = 0.3 + 0.3 = 0.6
  4. F(4) = P(X ≤ 4) = 0.6 + 0.4 = 1.0
  5. P(X > 2) = 1 − F(2) = 1 − 0.3 = 0.7
P(X > 2) = 0.7
Example 03 — Compute E[X]
Find the expected value E[X] for the distribution: P(X = 0) = 0.2, P(X = 1) = 0.5, P(X = 2) = 0.3.
  1. Apply the definition E[X] = Σ x · P(X = x):
  2. E[X] = 0(0.2) + 1(0.5) + 2(0.3)
  3. E[X] = 0 + 0.5 + 0.6 = 1.1
E[X] = 1.1
Example 04 — Compute Var[X] using the shortcut
Find the variance of X from Example 3 using the formula Var[X] = E[X²] − (E[X])².
  1. We already know E[X] = 1.1, so (E[X])² = 1.21.
  2. Compute E[X²] = Σ x² · P(X = x):
    E[X²] = 0²(0.2) + 1²(0.5) + 2²(0.3) = 0 + 0.5 + 1.2 = 1.7
  3. Apply the shortcut:
    Var[X] = 1.7 − 1.21 = 0.49
  4. Standard deviation: σ = √0.49 = 0.7
Var[X] = 0.49,   σ = 0.7
Example 05 — Dice problem
A fair six-sided die is rolled. Let X be the score. Find E[X], E[X²], and Var[X].
  1. Each outcome has probability 1/6. By symmetry or calculation:
    E[X] = (1+2+3+4+5+6)/6 = 21/6 = 3.5
  2. E[X²] = (1²+2²+3²+4²+5²+6²)/6 = (1+4+9+16+25+36)/6 = 91/6 ≈ 15.167
  3. Var[X] = E[X²] − (E[X])² = 91/6 − (7/2)² = 91/6 − 49/4
  4. Common denominator 12: 182/12 − 147/12 = 35/12 ≈ 2.917
E[X] = 3.5,  Var[X] = 35/12 ≈ 2.917
Example 06 — Linear transformation
If E[X] = 5 and Var[X] = 4, find E[3X − 2] and Var[3X − 2].
  1. Use E[aX + b] = aE[X] + b:
    E[3X − 2] = 3(5) − 2 = 13
  2. Use Var[aX + b] = a²Var[X]:
    Var[3X − 2] = 9 × 4 = 36
E[3X − 2] = 13,   Var[3X − 2] = 36
Example 07 — CDF computation with "between" probability
X has PMF: P(X=0)=0.05, P(X=1)=0.20, P(X=2)=0.35, P(X=3)=0.25, P(X=4)=0.15. Find P(1 ≤ X ≤ 3).
  1. Build the CDF: F(0)=0.05, F(1)=0.25, F(2)=0.60, F(3)=0.85, F(4)=1.
  2. P(1 ≤ X ≤ 3) = F(3) − F(0) = 0.85 − 0.05 = 0.80
  3. Alternatively, add directly: P(1)+P(2)+P(3) = 0.20+0.35+0.25 = 0.80 ✓
P(1 ≤ X ≤ 3) = 0.80
Example 08 — Geometric distribution basics
X ~ Geometric(p) counts the number of trials until the first success. The PMF is P(X = k) = (1−p)k−1p for k = 1, 2, 3, … Show that this is a valid PMF and state E[X].
  1. Sum the PMF over all k ≥ 1: Σk=1 (1−p)k−1p
  2. Factor out p: p · Σk=1 (1−p)k−1 = p · Σj=0 (1−p)j
  3. This is a geometric series with ratio r = (1−p) where |r| < 1 (since 0 < p ≤ 1):
    = p · 1/(1−(1−p)) = p · 1/p = 1 ✓
  4. The expected value is E[X] = 1/p. (Derivation uses differentiation of the geometric series.)
Valid PMF confirmed.   E[X] = 1/p
Example 09 — Determine a constant and compute variance
X has PMF P(X = x) = c/x for x = 1, 2, 3, 4, 5. Find c, then compute E[X] and Var[X].
  1. Σ P(X=x) = 1 ⟹ c(1 + 1/2 + 1/3 + 1/4 + 1/5) = 1
  2. Sum = (60+30+20+15+12)/60 = 137/60. So c = 60/137.
  3. E[X] = Σ x · (c/x) = Σ c = 5c = 300/137 ≈ 2.19
  4. E[X²] = Σ x² · (c/x) = c · Σ x = c(1+2+3+4+5) = 15c = 900/137 ≈ 6.57
  5. Var[X] = 6.57 − (2.19)² ≈ 6.57 − 4.80 ≈ 1.77
c = 60/137,   E[X] ≈ 2.19,   Var[X] ≈ 1.77
Example 10 — E[X²] via LOTUS
Suppose X can take values −2, −1, 0, 1, 2 each with probability 1/5. Find E[X], Var[X], and E[X² + 3X − 1].
  1. By symmetry, E[X] = 0.
  2. E[X²] = (4+1+0+1+4)/5 = 10/5 = 2
  3. Var[X] = E[X²] − (E[X])² = 2 − 0 = 2
  4. By linearity: E[X² + 3X − 1] = E[X²] + 3E[X] − 1 = 2 + 0 − 1 = 1
E[X] = 0,   Var[X] = 2,   E[X² + 3X − 1] = 1

§ 08Common Mistakes

Mistake 1 — Using the variance formula without squaring the mean Var[X] = E[X²] − (E[X])². Students frequently write E[X²] − E[X²] (leaving out the brackets) or forget to square E[X]. Always write (E[X])² explicitly.
Mistake 2 — Strict inequalities with the CDF For discrete X, P(X < 3) = F(2), not F(3). The CDF includes the boundary. P(X ≤ 3) = F(3). These differ by P(X = 3), which can be non-zero.
Mistake 3 — Forgetting to check PMF sums to 1 In exam questions with an unknown constant k, you must find k by setting Σ P(X=x) = 1 before computing anything else. Proceeding without finding k is a guaranteed mark loss.
Mistake 4 — Applying Var[X+Y] = Var[X] + Var[Y] for dependent variables This formula only holds when X and Y are independent. For dependent variables, Var[X+Y] = Var[X] + Var[Y] + 2Cov(X,Y).

§ 0910-Question Quiz

Test your understanding. Select an answer for each question, then click Check All Answers.

Score: 0 / 10
Question 01
Which of the following is NOT one of the two defining axioms of a probability mass function?
Question 02
X has PMF: P(X=1) = 0.1, P(X=2) = 0.4, P(X=3) = 0.3, P(X=4) = 0.2. What is F(3) = P(X ≤ 3)?
Question 03
Using the same PMF as Q2, find P(X > 2).
Question 04
For a discrete random variable X, which formula gives the expected value?
Question 05
A PMF is given by P(X = x) = kx for x = 1, 2, 3, 4. What is the value of k?
Question 06
If E[X] = 3 and E[X²] = 13, what is Var[X]?
Question 07
If E[X] = 4 and Var[X] = 9, find Var[2X + 5].
Question 08
The CDF of a discrete random variable is always:
Question 09
X takes values 0, 1, 2 with P(X=0) = 0.3, P(X=1) = 0.5, P(X=2) = 0.2. Find E[X² − 1].
Question 10
For the Geometric distribution X ~ Geom(p = 0.25), what is E[X]?

§ 10Continue in Probability

Now that you understand PMFs, CDFs, expected value, and variance, you are ready to study the named discrete distributions that apply these tools to real-world settings.

Cookie Settings