Educerie
Level

Educerie · IB Diploma · Mathematics: analysis and approaches

Topic 4 Statistics and probability · 4.7 Discrete random variables

Level
SL and HL. Nothing here is HL only, so every section is examinable for both.
Themes (key concepts)
quantity, modelling, generalization. A random variable turns uncertain outcomes into a quantity you can calculate with; its distribution is a model of what will happen; and its expected value generalizes from one trial to the long-run average of many.
The question this unit answers
when the result of a trial is a number, how do you describe every value it could take and how likely each one is, and what should you expect it to be on average?
Where it is examined
Paper 1 and Paper 2, as a Section A question of 5 to 7 marks or the middle of a Section B question: find an unknown constant so the probabilities add to 1 (2 to 3 marks), find P(X ≥ a) (1 to 2 marks), find E(X) (2 marks), use a given E(X) to find a second unknown (3 to 4 marks), and decide whether a game is fair or what prize would make it fair (2 to 4 marks). A distribution built from a tree diagram, often without replacement, is a favourite Section B route in. Everything here returns in 4.8, where the binomial distribution is a discrete random variable with a formula.

What you must be able to do

You must be able toLevelWhat it looks like in the exam
Explain what a discrete random variable is, and use the notation X, x and P(X = x)SL, HL"Write down the possible values of X" (1 mark)
Draw up a probability distribution from a situation, using a sample space diagram or a treeSL, HL"Find the probability distribution of X" (4 to 5 marks)
Use the fact that the probabilities add to 1, including to find an unknown constantSL, HL"Find the value of k" for a table or for a formula such as P(X = x) = k(x + 1) (2 to 3 marks)
Find probabilities such as P(X ≥ 2) and P(1 < X ≤ 3) from a distributionSL, HL"Find P(X > 1)" (1 to 2 marks)
Find the expected value E(X) = Σ x P(X = x), and interpret itSL, HL"Find E(X)" (2 marks); "Find a and b, given E(X) = 2.7" (4 marks)
Apply expected value to games and real decisions, and use E(X) = 0 for a fair gameSL, HL"Determine whether the game is fair"; "Find the prize that makes the game fair" (2 to 4 marks)

Before you start

You need 4.5 and 4.6: sample spaces, P(A′) = 1 − P(A), and tree diagrams with and without replacement. The idea of an expected number of occurrences from 4.5 is the seed of expected value. The formula booklet gives E(X) = Σ x P(X = x). The rule that the probabilities add to 1 is not printed as a formula, and it is the one you use most.


1The idea in one paragraph

Many trials produce a number: the score on a die, the number of heads in three tosses, the money you win in a game. A random variable is that number, named before you know its value. Its probability distribution lists every value it can take with the probability of each, in a table or as a formula, and because one of those values must happen, the probabilities add to 1. The expected value E(X) multiplies each value by its probability and adds the results: it is the average value of X over a very large number of trials, and it is where the distribution balances. When X is a player's gain in a game, E(X) = 0 means that, in the long run, neither the player nor the organiser comes out ahead: the game is fair.

2Random variables

A random variable is a quantity whose value is decided by the outcome of a trial. It is written with a capital letter, usually X. A particular value it might take is written with the lower-case letter, x. So P(X = x) means "the probability that the random variable X takes the value x", and P(X = 3) means the probability that it takes the value 3.

A random variable is discrete when its possible values can be listed separately, usually because they are counts: the number of sixes, the number of faulty items, a score. That matches the discrete data of 4.1. (Random variables that measure, such as a time or a mass, are continuous, and appear in 4.9 and, at HL, in 4.14.)

Here is the example used through this page. Two fair four-sided dice, each numbered 1 to 4, are rolled, and X is the larger of the two scores (if they are equal, X is that score). Figure 1 shows the 16 equally likely outcomes in a sample space diagram, each cell labelled with its value of X.

Figure 1 · A random variable turns outcomes into numbers Figure 1 · A random variable turns outcomes into numbers 1 1 2 2 3 3 4 4 1 2 3 4 2 2 3 4 3 3 3 4 4 4 4 4 first die second die x 1 2 3 4 cells 1 3 5 7 P(X = x) 1/16 3/16 5/16 7/16 amber: the 5 outcomes where X = 3 Two fair four-sided dice. X is the larger score. The 16 outcomes give only four values of X.
Figure 1 · A random variable turns outcomes into numbers

Sixteen outcomes collapse into four values, 1, 2, 3 and 4, and the values are not equally likely. Only (1, 1) gives X = 1. Five cells give X = 3: (3, 1), (3, 2), (3, 3), (1, 3), (2, 3). That is exactly the lesson of 4.5: count equally likely outcomes, then group them.

3Probability distributions

The probability distribution of a discrete random variable gives every possible value with its probability. From Figure 1:

x1234
P(X = x)1/163/165/167/16

Figure 2 draws it as a bar chart, one bar per value.

Figure 2 · The probability distribution of X Figure 2 · The probability distribution of X 0.1 0.2 0.3 0.4 0.5 x, the larger score P(X = x) 1 1/16 2 3/16 3 5/16 4 7/16 Every bar is a probability between 0 and 1, and the four bars add to 16/16 = 1.
Figure 2 · The probability distribution of X

Every probability distribution obeys two rules, and questions test both.

0 ≤ P(X = x) ≤ 1 for every x, and Σ P(X = x) = 1. The probabilities add to 1 because X must take exactly one of its values.

Check: 1/16 + 3/16 + 5/16 + 7/16 = 16/16 = 1. A distribution that does not add to 1 has an error in it; find it before going on.

Reading probabilities off a distribution. Add the probabilities of the values that fit, and watch the inequality signs carefully, because for a discrete variable < and ≤ give different answers.

P(X ≥ 3) = P(X = 3) + P(X = 4) = 5/16 + 7/16 = 12/16 = 3/4
P(X < 3) = P(X = 1) + P(X = 2) = 4/16 = 1/4or 1 − P(X ≥ 3)
P(1 < X ≤ 3) = P(X = 2) + P(X = 3) = 8/16 = 1/21 is excluded, 3 is included

Conditional probability from 4.6 works on a distribution too. Given that X is at least 3, the chance that it is 4 is

P(X = 4 | X ≥ 3) = P(X = 4) / P(X ≥ 3) = (7/16) / (12/16) = 7/12

The top is P(X = 4 and X ≥ 3), which is just P(X = 4), since X = 4 already satisfies X ≥ 3.

4Distributions with an unknown constant

The guide says distributions will be given as a table or as a formula. Either way, a common first part gives the probabilities in terms of an unknown and asks you to find it. There is only one fact to use: the probabilities add to 1.

From a formula. A random variable has P(X = x) = k(x² + 2) for x ∈ {0, 1, 2, 3}. Find k.

P(X = 0) + P(X = 1) + P(X = 2) + P(X = 3) = 1
k(0 + 2) + k(1 + 2) + k(4 + 2) + k(9 + 2) = 1
2k + 3k + 6k + 11k = 1
22k = 1, so k = 1/22

Write out each term, as here, rather than trying to add in your head: the method mark is for showing the substitution of every value. The distribution is then 2/22, 3/22, 6/22, 11/22, shown in Figure 3. It is fine to leave these unsimplified until the end; 6/22 and 3/11 are the same.

Figure 3 · A distribution given by a formula Figure 3 · A distribution given by a formula 0.1 0.2 0.3 0.4 0.5 0.6 x P(X = x) 0 2/22 1 3/22 2 6/22 3 11/22 P(X = x) = (x² + 2)/22 for x = 0, 1, 2, 3. The constant k = 1/22 makes the bars add to 1.
Figure 3 · A distribution given by a formula
P(X ≥ 2) = 6/22 + 11/22 = 17/22

From a table. The same idea handles a table with an unknown in it.

x0123
P(X = x)0.253c0.3c

Then 0.25 + 3c + 0.3 + c = 1, so 4c = 0.45 and c = 0.1125. Check every probability afterwards: each must lie between 0 and 1. If an unknown comes out making some probability negative or greater than 1, the value is impossible and something earlier is wrong. When the equation is quadratic, for example when some probabilities are written as k² and others as k, this check is how you reject one root.

5Expected value

Suppose you rolled the two four-sided dice 1600 times. You would expect X = 1 about 1600 × 1/16 = 100 times, X = 2 about 300 times, X = 3 about 500 times and X = 4 about 700 times, using the expected-number rule from 4.5. The mean of all 1600 values would then be

(1 × 100 + 2 × 300 + 3 × 500 + 4 × 700) / 1600 = 5000 / 1600 = 3.125

Each value is multiplied by the fraction of the time it occurs, which is its probability. The 1600 cancels, and that is the definition.

E(X) = Σ x P(X = x): multiply each value by its probability, and add. This is the expected value, or mean, of X.

E(X) = 1 × 1/16 + 2 × 3/16 + 3 × 5/16 + 4 × 7/16
= (1 + 6 + 15 + 28) / 16
= 50/16 = 25/8 = 3.125

Three facts about E(X) prevent most misunderstandings.

  • It is a long-run average, not a prediction for one trial. In any single roll X is 1, 2, 3 or 4. Over many rolls the average of the values settles near 3.125.
  • It need not be a value X can take. 3.125 is not a possible score, just as the mean number of children in a family is not a whole number.
  • It is the balance point of the distribution. Imagine each bar in Figure 4 as a weight on a beam, placed at its value of x and as heavy as its probability. The beam balances at E(X). The bars lean towards 4, so the balance point sits above the middle value of 2.5.
Figure 4 · E(X) is where the distribution balances Figure 4 · E(X) is where the distribution balances 0.1 0.2 0.3 0.4 0.5 x, the larger score P(X = x) 1 1/16 2 3/16 3 5/16 4 7/16 E(X) = 3.125 Treat each bar as a weight on a beam. The beam balances at E(X) = 25/8 = 3.125, which is not a value X can take. It is the long-run average of many observations.
Figure 4 · E(X) is where the distribution balances

For the formula distribution of section 4:

E(X) = 0 × 2/22 + 1 × 3/22 + 2 × 6/22 + 3 × 11/22
= (0 + 3 + 12 + 33) / 22 = 48/22 = 24/11 ≈ 2.18

Using E(X) to find a second unknown. Two unknowns need two equations: the probabilities add to 1, and E(X) is given.

x1234
P(X = x)0.2a0.3b

Given E(X) = 2.7, find a and b.

0.2 + a + 0.3 + b = 1, so a + b = 0.5probabilities add to 1
1(0.2) + 2a + 3(0.3) + 4b = 2.7, so 2a + 4b = 1.6E(X) = 2.7
a + 2b = 0.8
subtract: (a + 2b) − (a + b) = 0.8 − 0.5, so b = 0.3
a = 0.5 − 0.3 = 0.2
check: E(X) = 0.2 + 0.4 + 0.9 + 1.2 = 2.7

On Paper 1 solve the pair by hand as here. On Paper 2 the GDC's simultaneous equation solver is quicker, but write both equations first; they carry the method marks.

Variance is not on this page. The spread of a random variable, Var(X), is HL content (4.14). At SL you need only E(X).

6Applications: games, fairness and decisions

The guide's application is games of chance. Let X be the player's gain: what the player wins minus what they paid to play. Then E(X) is the average gain per game over many games.

A game is fair when E(X) = 0, where X is the player's gain. If E(X) < 0 the organiser profits in the long run; if E(X) > 0 the player does.

A worked game. At a school fair a player pays $4 and rolls one fair die. A 6 wins $12, a 4 or a 5 wins $4, and anything else wins nothing. Is the game fair?

Work in gains, not prizes, because the $4 stake is paid every time. A 6 gives 12 − 4 = $8; a 4 or 5 gives 4 − 4 = $0; a 1, 2 or 3 gives 0 − 4 = −$4.

gain, x ($)−408
P(X = x)1/21/31/6
E(X) = −4 × 1/2 + 0 × 1/3 + 8 × 1/6
= −2 + 0 + 4/3
= −2/3 ≈ −0.67

The expected gain is −$0.67. The game is not fair: on average a player loses about 67 cents a game, and the fair raises about that much per game in the long run. Figure 5(a) shows the distribution with its balance point below zero.

Making it fair. What prize for a 6 would make the game fair? Call the prize p. The gain on a 6 becomes p − 4, and the other gains do not change.

E(X) = −4 × 1/2 + 0 × 1/3 + (p − 4) × 1/6 = 0
(p − 4)/6 = 2
p − 4 = 12, so p = 16

A $16 prize makes the game fair, as Figure 5(b) shows: the gain on a 6 is now $12, and the beam balances at 0.

Figure 5 · The player's gain, before and after the prize is changed Figure 5 · The player's gain, before and after the prize is changed (a) Prize $12 for a six 0.2 0.4 0.6 gain, x ($) P(X = x) −4 1/2 0 1/3 8 1/6 E(X) = −2/3 (b) Prize $16 for a six 0.2 0.4 0.6 gain, x ($) P(X = x) −4 1/2 0 1/3 12 1/6 E(X) = 0 Stake $4. Left: a six wins $12, so E(gain) = −$0.67 and the organiser profits. Right: a six wins $16, the gain on a six becomes $12, and E(gain) = 0: a fair game.
Figure 5 · The player's gain, before and after the prize is changed

Alternatively keep the prizes and change the stake. The expected prize is 12 × 1/6 + 4 × 2/6 + 0 × 3/6 = 2 + 4/3 = 10/3, so a stake of $3.33 (3 s.f.) would make the game fair. A fair game charges exactly the expected prize. Real casinos and lotteries never do: every game they run has E(X) < 0 for the player, which is how they pay their costs and make a profit. Whether that is "fair" in the everyday sense is a good question for TOK; in the mathematical sense it is not.

A business application. The same calculation prices risk. An insurer sells phone cover for $60 a year. From its records (invented figures), in a year a policy leads to a $150 repair with probability 0.12, a $600 replacement with probability 0.04, and no claim otherwise. Let Y be the insurer's profit on one policy.

profit, y ($)6060 − 150 = −9060 − 600 = −540
P(Y = y)0.840.120.04
E(Y) = 60(0.84) + (−90)(0.12) + (−540)(0.04)
= 50.4 − 10.8 − 21.6
= 18

The insurer expects $18 profit per policy, so across 5000 policies about 5000 × 18 = $90,000, before its running costs. That is expected value and expected number of occurrences working together. The first probability, 0.84, came from 1 − 0.12 − 0.04: the probabilities must add to 1, even when the question only mentions two of them.

7Where marks are lost

Probabilities that do not add to 1. Always check the total. A missing value of x, often 0, is the usual cause.

Working with prizes instead of gains. A fair-game question is about the gain, prize minus stake. Forgetting to subtract the stake from every outcome, including the losing ones, gives the wrong E(X).

Dividing by the number of values. E(X) is not the ordinary average of the x-values. (1 + 2 + 3 + 4) ÷ 4 = 2.5 is wrong for the dice example because the values are not equally likely. Weight each value by its probability.

Rounding E(X) to a possible value. E(X) = 3.125 stays 3.125. It does not have to be a value of X.

Misreading < and ≤. For a discrete variable, P(X < 3) excludes 3 and P(X ≤ 3) includes it. Write out which values are included before adding.

Not checking the unknown. A value of k that makes any probability negative or larger than 1 is impossible. With a quadratic in k, this is how you choose between the roots.

Leaving out the zero term. In E(X), the value x = 0 contributes 0, but a table with P(X = 0) still needs that probability in the sum to 1.

8Work it right

  1. State the possible values of X before calculating anything.
  2. Build the distribution from a sample space diagram or a tree, and present it as a table with x in the top row and P(X = x) below.
  3. Check that the probabilities add to 1, and write the check.
  4. For an unknown constant, write the sum of all the probabilities, term by term, equal to 1.
  5. For E(X), write Σ x P(X = x) with every term shown, then the total.
  6. For a game, define X as the player's gain and subtract the stake from every outcome; fair means E(X) = 0.
  7. Paper 1: fractions, exact. Paper 2: 3 significant figures, and money to the nearest cent where it makes sense.

9Try it

Marks in brackets. Q1 to Q3 are Paper 1 style, no calculator. Q4 and Q5 are Paper 2 style, with a GDC.

Q1. The probability distribution of a discrete random variable X is shown.

x0123
P(X = x)0.13k0.3k

(a) Find the value of k. 2 marks

(b) Find P(X ≥ 2). 1 mark

(c) Find E(X). 2 marks

(d) Find P(X = 1 | X ≥ 1). 2 marks

Q2. A discrete random variable X has P(X = x) = kx for x ∈ {2, 3, 4, 5}.

(a) Find the value of k. 2 marks

(b) Find P(X > 3). 2 marks

(c) Find E(X), giving your answer as a fraction. 2 marks

Q3. The random variable X has the distribution below, and E(X) = 0.6.

x−1025
P(X = x)p0.4q0.1

Find the value of p and the value of q. 5 marks

Q4. At a charity event, a player pays $3 to take one ball at random from a bag of 10 balls: 1 gold, 3 silver and 6 white. A gold ball wins $15, a silver ball wins $4, and a white ball wins nothing. Let X be the player's gain in dollars.

(a) Write down the probability distribution of X. 3 marks

(b) Find E(X), and state whether the game is fair. 3 marks

(c) The organiser wants to change only the prize for a gold ball so that the game is fair. Find the new prize. 2 marks

(d) With the original prizes, the game is played 400 times. Find the charity's expected profit. 2 marks

Q5. A bag holds 4 red and 2 blue counters. Two counters are taken at random without replacement. Let X be the number of blue counters taken.

(a) Show that P(X = 2) = 1/15. 2 marks

(b) Find the probability distribution of X. 3 marks

(c) Find E(X). 2 marks

10In one breath

A discrete random variable X is a number decided by chance, with values you can list; P(X = x) is the probability it takes the value x. Its probability distribution gives every value with its probability, as a table or a formula, built by counting equally likely outcomes or multiplying along a tree, and every probability lies between 0 and 1 and they all add to 1, which is how you find an unknown constant. Add the right probabilities for P(X ≥ a), watching < against ≤. The expected value E(X) = Σ x P(X = x) weights each value by its probability: it is the long-run average and the balance point, and it need not be a possible value. Given E(X), you get a second equation for a second unknown. With X as a player's gain, prize minus stake, a game is fair exactly when E(X) = 0; E(X) < 0 means the house wins in the long run.


Answers

Q1. (a) 0.1 + 3k + 0.3 + k = 1, so 4k = 0.6 and k = 0.15. M1 for summing the probabilities to 1, A1 for 0.15. (b) P(X ≥ 2) = 0.3 + 0.15 = 0.45. A1. Follow-through from their k. (c) E(X) = 0(0.1) + 1(0.45) + 2(0.3) + 3(0.15) = 0 + 0.45 + 0.6 + 0.45 = 1.5. M1 for Σ x P(X = x) with their values, A1 for 1.5. (d) P(X ≥ 1) = 1 − 0.1 = 0.9, so P(X = 1 | X ≥ 1) = 0.45 ÷ 0.9 = 0.5. M1 for dividing by P(X ≥ 1), A1 for 0.5.

Q2. (a) 2k + 3k + 4k + 5k = 1, so 14k = 1 and k = 1/14. M1 for substituting all four values and summing to 1, A1 for 1/14. (b) P(X > 3) = P(X = 4) + P(X = 5) = 4/14 + 5/14 = 9/14. M1 for using x = 4 and 5 only, A1 for 9/14. Including x = 3 gives 12/14 and scores M0. (c) E(X) = 2(2/14) + 3(3/14) + 4(4/14) + 5(5/14) = (4 + 9 + 16 + 25)/14 = 54/14 = 27/7. M1 for Σ x P(X = x), A1 for 27/7.

Q3. Sum to 1: p + 0.4 + q + 0.1 = 1, so p + q = 0.5. Expected value: −p + 0 + 2q + 0.5 = 0.6, so −p + 2q = 0.1. Adding the two equations: 3q = 0.6, so q = 0.2 and p = 0.3. Check: E(X) = −0.3 + 0.4 + 0.5 = 0.6. M1 for the sum-to-1 equation, M1 for the E(X) equation, M1 for solving the pair, A1 for q = 0.2, A1 for p = 0.3.

Q4. (a) Gold: 15 − 3 = 12, probability 0.1. Silver: 4 − 3 = 1, probability 0.3. White: −3, probability 0.6.

x−3112
P(X = x)0.60.30.1

A1 for the three gains −3, 1 and 12, A1 for the probabilities, A1 for a correct table. Using prizes 0, 4 and 15 instead of gains scores A0 for the values. (b) E(X) = −3(0.6) + 1(0.3) + 12(0.1) = −1.8 + 0.3 + 1.2 = −0.3, so the expected gain is −$0.30. E(X) ≠ 0, so the game is not fair (it favours the charity). M1 for Σ x P(X = x), A1 for −0.3, R1 for "not fair because E(X) ≠ 0". (c) With prize g for gold, the gain is g − 3: (g − 3)(0.1) + 1(0.3) − 3(0.6) = 0, so 0.1g − 0.3 + 0.3 − 1.8 = 0, 0.1g = 1.8 and g = $18. M1 for setting their E(X) with the unknown prize equal to 0, A1 for $18. (d) Each game the charity expects to gain $0.30, so 400 × 0.30 = $120. M1 for 400 × 0.3, A1 for $120.

Q5. (a) P(X = 2) = P(blue, blue) = 2/6 × 1/5 = 2/30 = 1/15. M1 for 2/6 × 1/5, A1 for simplifying to the given answer (AG). (b) P(X = 0) = 4/6 × 3/5 = 12/30 = 2/5. P(X = 1) = 4/6 × 2/5 + 2/6 × 4/5 = 8/30 + 8/30 = 16/30 = 8/15. Check: 2/5 + 8/15 + 1/15 = 6/15 + 8/15 + 1/15 = 1.

x012
P(X = x)2/58/151/15

A1 for P(X = 0), M1 for two paths added for P(X = 1), A1 for 8/15. P(X = 1) = 8/30 (one path only) scores M0 A0. (c) E(X) = 0 × 2/5 + 1 × 8/15 + 2 × 1/15 = 10/15 = 2/3. M1 for Σ x P(X = x), A1 for 2/3 or 0.667.


Educerie · written from the published IB Diploma Programme Mathematics: analysis and approaches guide, first assessment 2021, section 4.7 Discrete random variables. Original text, examples and questions. Diagrams drawn by Educerie. Last reviewed 25 September 2026.

Mocks: in the future, hold tight!