Discrete Random Variables and Probability Distributions

April 13, 2026

Problem

Let X = the number of heads in 3 coin flips. List all 8 outcomes, build the probability distribution table, and graph P(X = k) as a bar chart.

Explanation

What is a discrete random variable?

A random variable is a numeric function of the outcome of a random experiment. A discrete random variable takes values in a countable set — typically the integers 0,1,2,0, 1, 2, \ldots.

Its behavior is summarized by a probability mass function (PMF) p(k)=P(X=k)p(k) = P(X = k), which must satisfy:

  • p(k)0p(k) \ge 0 for every kk,
  • kp(k)=1\sum_k p(k) = 1.

Step-by-step construction

Setup: Flip a fair coin 3 times. Each of the 23=82^3 = 8 ordered outcomes is equally likely (probability 1/81/8). Let XX count the number of heads.

Step 1 — Enumerate all 8 outcomes and their XX values:

  • TTT → 0
  • HTT, THT, TTH → 1
  • HHT, HTH, THH → 2
  • HHH → 3

Step 2 — Count favorable outcomes for each XX value:

  • X=0X = 0: 1 outcome.
  • X=1X = 1: 3 outcomes.
  • X=2X = 2: 3 outcomes.
  • X=3X = 3: 1 outcome.

Step 3 — Build the PMF (each entry is count divided by 8):

  • P(X=0)=1/8P(X = 0) = 1/8
  • P(X=1)=3/8P(X = 1) = 3/8
  • P(X=2)=3/8P(X = 2) = 3/8
  • P(X=3)=1/8P(X = 3) = 1/8

Step 4 — Check the total: 1/8+3/8+3/8+1/8=8/8=11/8 + 3/8 + 3/8 + 1/8 = 8/8 = 1 ✓.

Summary statistics

Expected value (mean): E(X)=kkP(X=k)=018+138+238+318=128=1.5E(X) = \sum_k k \cdot P(X = k) = 0 \cdot \tfrac{1}{8} + 1 \cdot \tfrac{3}{8} + 2 \cdot \tfrac{3}{8} + 3 \cdot \tfrac{1}{8} = \tfrac{12}{8} = 1.5

Variance: Var(X)=E(X2)(E(X))2=32.25=0.75\text{Var}(X) = E(X^2) - (E(X))^2 = 3 - 2.25 = 0.75

where E(X2)=0+3/8+12/8+9/8=24/8=3E(X^2) = 0 + 3/8 + 12/8 + 9/8 = 24/8 = 3.

Standard deviation: σ=0.750.866\sigma = \sqrt{0.75} \approx 0.866.

Recognizing the pattern

The counts 1,3,3,11, 3, 3, 1 are row 3 of Pascal's triangle. This is no coincidence: XX is Binomial(n=3,p=1/2n = 3, p = 1/2), and P(X=k)=(3k)(1/2)3P(X = k) = \binom{3}{k} (1/2)^3.

Cumulative distribution function (CDF)

F(k)=P(Xk)F(k) = P(X \le k) sums the PMF from the left:

  • F(0)=1/8F(0) = 1/8
  • F(1)=4/8F(1) = 4/8
  • F(2)=7/8F(2) = 7/8
  • F(3)=8/8=1F(3) = 8/8 = 1

A discrete CDF is a step function jumping at each possible value.

Common mistakes

  • Forgetting to enumerate ordered outcomes. HTT, THT, TTH are three different outcomes that all give X=1X = 1; collapsing them under-counts.
  • Confusing PMF with CDF. PMF gives point probabilities; CDF accumulates from the left.
  • Assuming probabilities must be fractions with nice denominators. Any nonnegative numbers that sum to 1 form a valid PMF.

Try it in the visualization

Adjust nn (number of flips) and pp (heads probability) sliders. The sample-space grid highlights each outcome, and the bar chart of P(X=k)P(X = k) reshapes to match. Toggle to show the CDF as a cumulative line.

Interactive Visualization

Parameters

Your turn

Got your own math or physics problem?

Turn any problem into an interactive visualization like this one — powered by AI, generated in seconds. Free to try, no credit card required.

Sign Up Free to Try It30 free visualizations every day