IB Mathematics: Analysis and Approaches • Statistics and Probability

Discrete Random Variables — SL 4.5 Discrete random variables; expected value and variance (intro)

Learn to model chance outcomes with probability distributions and predict their long-run average and spread.

IB Mathematics Analysis and Approaches emblem with a function, curved graph, and sigma notation
Inside this lesson 10 sections 5 questions 11 figures

SECTION 1

Historical Context & Motivation

Long before statisticians had computers or calculators, people were fascinated by games of chance. Card games, dice, and lotteries drove early thinkers to ask a deceptively simple question: if I play this game many times, how much should I expect to win or lose on average? This quest to quantify randomness gave birth to the concept of a random variable — a way to assign numbers to the outcomes of chance experiments — and to the formulas for expected value and variance that we still use today.

1654 • Pascal & Fermat Correspondence

Blaise Pascal and Pierre de Fermat exchanged letters about the "Problem of Points" — how to fairly divide stakes in an interrupted game. Their work laid the foundations of probability theory and the idea of assigning numerical values to uncertain outcomes.

1713 • Bernoulli's Ars Conjectandi

Jacob Bernoulli published his groundbreaking book, which formalized the concept of expected value and introduced the Law of Large Numbers — the principle that averages stabilize as trials increase.

1812 • Laplace's Théorie Analytique

Pierre-Simon Laplace unified earlier probability ideas and developed the mathematical framework for discrete and continuous distributions, including formal definitions of variance and standard deviation.

1900s • Modern Probability Theory

Andrey Kolmogorov axiomatized probability in 1933, giving random variables and their properties the rigorous mathematical foundation used in the IB curriculum and across all modern statistics.

The central question these mathematicians tackled remains at the heart of SL 4.5: given a random experiment with numerical outcomes, how do we summarize the center and spread of its probability distribution? That is exactly what expected value and variance accomplish.

SECTION 2

Core Principles & Definitions

Before diving into formulas, it is important to build a clear vocabulary. A discrete random variable is a variable whose value is determined by the outcome of a random process and that can only take on a countable number of distinct values — think of the result of rolling a die (1, 2, 3, 4, 5, or 6) or the number of heads in five coin flips (0, 1, 2, 3, 4, or 5). The word "discrete" distinguishes these from continuous random variables, which can take any value in an interval.

1

Random Variable (X)

A function that assigns a numerical value to each outcome in a sample space. We use capital letters like X for the variable and lowercase x for specific values it can take.
2

Probability Distribution

A table, formula, or graph that lists every possible value of X alongside its probability P(X = x). The probabilities must satisfy two rules: each is between 0 and 1, and they all sum to exactly 1.
3

Expected Value E(X)

The long-run average of the random variable, calculated as the sum of each value multiplied by its probability. It tells you the 'center' of the distribution — often called the mean, μ.
4

Variance Var(X)

A measure of how spread out the values are around the expected value. Large variance means outcomes are scattered far from the mean; small variance means they cluster tightly.
5

Standard Deviation σ

The square root of the variance. Because it is in the same units as the random variable itself, standard deviation is often easier to interpret than variance.
✦

KEY TAKEAWAY

Think of expected value like a GPS prediction. If you drive to school every day, sometimes you hit green lights and arrive in 10 minutes, sometimes red lights make it 20 minutes. The expected value is like Google Maps telling you the trip will take about 14 minutes — it is the weighted average of all possible travel times, where more likely times count more. Variance tells you how reliably you can trust that prediction.

SECTION 3

Visualizing a Probability Distribution

The diagram below shows a probability distribution for a discrete random variable X representing the number of goals scored by a football team in a match. Each bar's height represents the probability of that outcome. Notice how all the bar heights add up to 1, and the dashed line marks the expected value — the balance point of the distribution.

Probability Distribution: Goals Scored per MatchP(X = x)x (Number of goals)00.10.20.30.40.500.1010.3020.3530.2040.05E(X) = 1.80
The bar chart shows P(X = x) for x = 0, 1, 2, 3, 4. The dashed pink line marks the expected value E(X) = 1.80 — the long-run average number of goals per match. Notice that E(X) need not be a value that X can actually take.

Two important observations stand out. First, the expected value of 1.80 is not an integer, even though the team can only score whole numbers of goals — the expected value represents the theoretical average over many matches, not a single game's result. Second, the distribution is not symmetric: the bars are taller on the left side, indicating the team is more likely to score 1 or 2 goals than 3 or 4. This asymmetry is captured numerically by the variance and standard deviation.

SECTION 4

Mathematical Framework

Now let's formalize the ideas with the formulas you will use on the IB exam. All of them boil down to one principle: multiply each value by its probability and add up the results.

VALIDITY CONDITION

∑P(X=xi)=1and0≤P(X=xi)≤1foralli∑ P(X = xᵢ) = 1 and 0 ≤ P(X = xᵢ) ≤ 1 for all i

For a valid probability distribution, every individual probability must be between 0 and 1 (inclusive), and all the probabilities must sum to exactly 1.

EXPECTED VALUE (MEAN)

E(X)=μ=∑xi⋅P(X=xi)E(X) = μ = ∑ xᵢ · P(X = xᵢ)

Multiply each possible value xᵢ by its probability, then sum all such products. The result, μ (mu), is the long-run average.

VARIANCE (DEFINITION FORM)

Var(X)=σ2=∑(xi−μ)2⋅P(X=xi)Var(X) = σ² = ∑ (xᵢ − μ)² · P(X = xᵢ)

For each value, compute its squared deviation from the mean, multiply by its probability, and sum. This gives the average squared distance from the mean — the variance σ².

VARIANCE (SHORTCUT FORM)

Var(X)=E(X2)−[E(X)]2Var(X) = E(X²) − [E(X)]²

An equivalent and often faster formula. First compute E(X²) = ∑ xᵢ² · P(X = xᵢ), then subtract the square of the mean. This form is provided in the IB formula booklet.

STANDARD DEVIATION

σ=√Var(X)σ = √Var(X)

The standard deviation is simply the square root of the variance, returning the measure of spread to the same units as X.

💡

IB Formula Booklet

On the IB exam you are given the formulas E(X) = ∑ x · P(X = x) and Var(X) = E(X²) − [E(X)]². You do not need to memorize them, but you do need to know how to apply them correctly using a probability distribution table.

SECTION 5

Building and Interpreting Probability Tables

In many IB problems, you are given a partially completed probability table and must find a missing probability before computing E(X) or Var(X). The key constraint is that the probabilities must sum to 1. The table below shows the distribution from our football example, along with the intermediate columns needed for calculating E(X) and E(X²).

xP(X = x)x · P(X = x)x²x² · P(X = x)
00.100.0000.00
10.300.3010.30
20.350.7041.40
30.200.6091.80
40.050.20160.80
Totals1.001.80—4.30

Complete probability distribution with calculation columns

From the totals row, we read off E(X) = 1.80 and E(X²) = 4.30. Using the shortcut variance formula: Var(X) = 4.30 − 1.80² = 4.30 − 3.24 = 1.06. The standard deviation is σ = √1.06 ≈ 1.03 goals. This tells us that on a typical match, the team's score deviates from the average by about 1 goal.

How E(X) and Var(X) Are ComputedSTEP 1List all values xand probabilities P(X = x)STEP 2Check: ∑P(X = x) = 1(Valid distribution?)STEP 3Compute eachx · P(X = x)STEP 4 — Expected ValueE(X) = ∑ x · P(X = x)Sum the products from Step 3STEP 5 — E(X²)E(X²) = ∑ x² · P(X = x)Square each x first, then weightSTEP 6 — Variance & Std DevVar(X) = E(X²) − [E(X)]²σ = √Var(X)
A step-by-step flowchart showing the process for computing expected value and variance from a probability distribution table. Follow the arrows from listing values (Step 1) through to computing σ (Step 6).

SECTION 6

Worked Example

A spinner is divided into four sections. The random variable X represents the prize (in dollars) a player wins on each spin. The probability distribution is shown below. Find the expected value E(X), the variance Var(X), and the standard deviation σ.

x (dollars)P(X = x)
00.40
20.30
50.20
100.10

Spinner prize distribution

Finding E(X), Var(X), and σ

  1. 1

    Step 1 — Verify the Distribution

    Check that the probabilities sum to 1: 0.40 + 0.30 + 0.20 + 0.10 = 1.00. ✓ Each probability is between 0 and 1. ✓ This is a valid probability distribution.
    ∑P = 1.00 ✓
  2. 2

    Step 2 — Calculate E(X)

    E(X) = ∑ x · P(X = x) = (0)(0.40) + (2)(0.30) + (5)(0.20) + (10)(0.10) = 0 + 0.60 + 1.00 + 1.00 = 2.60.
    E(X) = $2.60
  3. 3

    Step 3 — Calculate E(X²)

    E(X²) = ∑ x² · P(X = x) = (0²)(0.40) + (2²)(0.30) + (5²)(0.20) + (10²)(0.10) = 0 + (4)(0.30) + (25)(0.20) + (100)(0.10) = 0 + 1.20 + 5.00 + 10.00 = 16.20.
    E(X²) = 16.20
  4. 4

    Step 4 — Apply the Variance Formula

    Var(X) = E(X²) − [E(X)]² = 16.20 − (2.60)² = 16.20 − 6.76 = 9.44.
    Var(X) = 9.44
  5. 5

    Step 5 — Find the Standard Deviation

    σ = √Var(X) = √9.44 ≈ 3.07. On average, a player's prize deviates from the mean of $2.60 by about $3.07, which indicates fairly high variability relative to the mean.
    σ ≈ $3.07

SECTION 7

Key Properties and Common Pitfalls

When working with expected value and variance, certain properties save time and help avoid mistakes on IB exams. The table below summarizes the most important rules alongside the common errors students make.

Property / RuleFormulaCommon Mistake
Probabilities sum to 1∑ P(X = xᵢ) = 1Forgetting to use this to find a missing probability before proceeding
E(X) need not be a possible value of X—Rounding E(X) to the nearest integer because 'it should be a real outcome'
Linear transformation of E(X)E(aX + b) = aE(X) + bApplying this rule to variance (variance treats constants differently)
Linear transformation of Var(X)Var(aX + b) = a²Var(X)Including the +b term (adding a constant shifts values but doesn't change spread)
Variance is always ≥ 0σ² ≥ 0Getting a negative variance (usually a calculation error — recheck your work)

Key properties of E(X) and Var(X) alongside common student errors

✦

KEY TAKEAWAY

The linear transformation rules are like converting currencies. If you earn X dollars and the exchange rate is a euros per dollar with a fixed fee of b euros, your average earning in euros is aE(X) + b. But the spread of your earnings changes only by the scaling factor — the fixed fee doesn't make your earnings more or less variable.

SECTION 8

Connection to Advanced Topics

The concepts you have learned here form the foundation for several more advanced topics in the IB course and beyond. Understanding expected value and variance now will make the jump to named distributions, hypothesis testing, and even the normal distribution much smoother.

What You Know Now (SL 4.5)Where It Leads
General discrete distributions with tablesBinomial distribution (SL 4.7) — a specific formula for counting successes in repeated trials
E(X) as a weighted averageContinuous distributions where E(X) becomes an integral (HL)
Var(X) as a measure of spreadNormal distribution (SL 4.9) where μ and σ fully define the bell curve
Checking if a distribution is validChi-squared goodness of fit tests — comparing observed data to expected distributions

How SL 4.5 concepts extend to later topics

In particular, the binomial distribution you will encounter next is simply a specific type of discrete random variable where each trial has exactly two outcomes (success or failure). Its expected value and variance have their own neat shortcut formulas, but they are derived from the same ∑ xᵢ · P(X = xᵢ) principle you practiced here. Mastering the general case now means you already understand the engine that powers every named distribution.

SECTION 9

Practice Problems

Question 1: CONCEPTUAL

A fair six-sided die is rolled. The random variable X represents the number showing on the top face. Without calculating, explain why E(X) = 3.5 even though 3.5 is not a possible outcome of the die roll.
Show answer
The expected value is a weighted average of all possible outcomes, not a value that must actually occur in a single trial. Since the die is fair, each face has probability 1/6. The sum (1 + 2 + 3 + 4 + 5 + 6)/6 = 21/6 = 3.5. This tells us that if we rolled the die thousands of times and averaged the results, the average would be very close to 3.5. Expected value describes the long-run center of the distribution, which can fall between actual outcomes when the distribution is symmetric over integers.

Question 2: BASIC CALCULATION

A discrete random variable X has the following distribution: P(X = 1) = 0.25, P(X = 3) = 0.35, P(X = 5) = 0.25, P(X = 7) = 0.15. Calculate E(X) and Var(X).
Show answer
First verify: 0.25 + 0.35 + 0.25 + 0.15 = 1.00 ✓. E(X) = (1)(0.25) + (3)(0.35) + (5)(0.25) + (7)(0.15) = 0.25 + 1.05 + 1.25 + 1.05 = 3.60. Next, E(X²) = (1)(0.25) + (9)(0.35) + (25)(0.25) + (49)(0.15) = 0.25 + 3.15 + 6.25 + 7.35 = 17.00. Therefore Var(X) = E(X²) − [E(X)]² = 17.00 − (3.60)² = 17.00 − 12.96 = 4.04. The standard deviation is σ = √4.04 ≈ 2.01.

Question 3: INTERMEDIATE

The random variable X has the probability distribution shown: P(X = 0) = k, P(X = 1) = 0.3, P(X = 2) = 0.2, P(X = 3) = 2k. Find the value of k, then calculate E(X) and the standard deviation of X.
Show answer
Since all probabilities must sum to 1: k + 0.3 + 0.2 + 2k = 1, so 3k + 0.5 = 1, giving 3k = 0.5 and k = 1/6 ≈ 0.1667. Therefore P(X = 0) = 1/6, P(X = 3) = 2/6 = 1/3. E(X) = (0)(1/6) + (1)(0.3) + (2)(0.2) + (3)(1/3) = 0 + 0.3 + 0.4 + 1.0 = 1.70. E(X²) = (0)(1/6) + (1)(0.3) + (4)(0.2) + (9)(1/3) = 0 + 0.3 + 0.8 + 3.0 = 4.10. Var(X) = 4.10 − (1.70)² = 4.10 − 2.89 = 1.21. The standard deviation is σ = √1.21 = 1.10.

Question 4: APPLIED

A carnival game costs $4 to play. The random variable W represents the amount won (before subtracting the cost) with distribution: P(W = 0) = 0.50, P(W = 3) = 0.30, P(W = 10) = 0.15, P(W = 20) = 0.05. Let Y = W − 4 represent the net profit. Find E(Y) and interpret your answer. Should you play this game?
Show answer
First find E(W) = (0)(0.50) + (3)(0.30) + (10)(0.15) + (20)(0.05) = 0 + 0.90 + 1.50 + 1.00 = 3.40. Since Y = W − 4, we use the linear property: E(Y) = E(W) − 4 = 3.40 − 4 = −0.60. This means that on average, a player loses $0.60 per game. Over many plays, the carnival makes money and the player loses money, so from a purely financial perspective you should not play. The negative expected value indicates this is not a fair game — it is designed in the carnival's favor, which is how the business stays profitable.

Question 5: CRITICAL THINKING

Two discrete random variables, A and B, both have E(A) = E(B) = 5. Variable A has Var(A) = 0.5, while Var(B) = 12. Describe, with reasoning, a real-world context where you would prefer A over B, and another context where you would prefer B over A.
Show answer
Both variables have the same average, so the key difference is in their spread. Variable A has low variance (σ ≈ 0.71), meaning its outcomes cluster tightly around 5. Variable B has high variance (σ ≈ 3.46), so outcomes are much more spread out. You would prefer A in a situation where consistency matters — for example, if A represents a factory machine's output of 5 items per hour, low variance means reliable production and easier scheduling. You would prefer B if you benefit from occasional extreme outcomes — for instance, if B represents the number of goals a football player scores and you need a 'big game' to win a tournament, the high variance gives you a better chance of scoring 8+ goals even though the average is the same. This illustrates that expected value alone doesn't tell the whole story: risk-averse decisions favor low variance, while risk-seeking situations may benefit from high variance.

SUMMARY

Lesson Summary

Summary

A discrete random variable assigns numerical values to the outcomes of a random experiment, and its probability distribution lists every possible value alongside its probability. For the distribution to be valid, all probabilities must be between 0 and 1, and they must sum to exactly 1. The expected value E(X) = ∑ x · P(X = x) gives the long-run average — the center of the distribution. It does not need to be a value the variable can actually take.

The variance Var(X) = E(X²) − [E(X)]² measures how spread out the distribution is, and the standard deviation σ = √Var(X) expresses that spread in the original units of the variable. Under linear transformations, E(aX + b) = aE(X) + b but Var(aX + b) = a²Var(X), because adding a constant shifts the center without affecting the spread. These tools form the foundation for every named distribution — especially the binomial and normal distributions — you will study later in the IB course.

Varsity Tutors • IB Mathematics: Analysis and Approaches • Discrete Random Variables — SL 4.5