Educerie · IB Diploma · Mathematics: analysis and approaches
IB Mathematics AA 4.7 · SL and HL
Discrete random variables
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?
What you will learn
Understand a discrete random variable as a number decided by chance, with values that can be listed.
Know that a probability distribution, as a table or a formula, has probabilities that add to 1.
Understand expected value as the long-run average of a random variable.
Know that a game is fair when the player's expected gain is zero.
You must be able to
Calculate E(X) from a table or a formula.
Find an unknown constant using the fact that the probabilities add to 1.
Draw up a probability distribution from a sample space or a tree diagram.
Determine whether a game is fair, and find the prize or stake that makes it fair.
Calculate two unknown probabilities from the sum to 1 and a given E(X).
Calculate probabilities such as P(X ≥ 2) from a distribution.
In the exam. Paper 1 and Paper 2, as a Section A question of 5 to 7 marks or the middle of a Section B question: an unknown constant from the sum to 1 (2 to 3 marks, 1 to 2 more when a quadratic root must be rejected), P(X≥a) (1 to 2 marks), E(X) (2 marks), a second unknown from a given E(X) (3 to 4 marks), and whether a game is fair or what prize makes it fair (2 to 4 marks). A distribution built from a tree, often without replacement, is a common way into Section B, and "show that" an equation or a probability is frequent. It all returns in 4.8, where the binomial distribution is a discrete random variable with a formula.
1Random variables
A random variable = a quantity whose value is decided by the outcome of a trial. It gets a capital letter, usually X. A value it might take gets the lower-case letter, x.
P(X=x) reads "the probability that X takes the value x". Events become short: "the larger score is at least 3" is X≥3.
A random variable is discrete when its values can be listed one by one. They are usually counts or scores: the discrete data of 4.1, with chance attached.
The values need not be positive or whole. Shoe sizes, or a gain of −4 dollars, are fine.
The list may never end, like the number of throws needed for a first six (section 3).
A quantity measured on a scale, such as a time or a mass, is continuous (4.9 and, at HL, 4.14). The test is count or measure:
Quantity
Type
Why
Emails received in one hour
discrete
counted: 0,1,2,…
Time taken to download a file
continuous
measured: any value in an interval
A mark out of 40
discrete
only listed values
Example: two fair four-sided dice, each numbered 1 to 4, are rolled. X is the larger of the two scores (if they match, X is that score). Figure 1 lays out the 16 equally likely outcomes in a sample space diagram. Each cell shows its value of X.
Figure 1 · A random variable turns outcomes into numbers
Sixteen outcomes collapse into four unequally likely values. Only (1,1) gives X=1. Five cells give X=3: (3,1), (3,2), (3,3), (1,3), (2,3).
That is the method of 4.5: count equally likely outcomes, then group them by value.
2Probability distributions
The probability distribution of a discrete random variable = every possible value with its probability. From Figure 1:
x
1
2
3
4
P(X=x)
161
163
165
167
Figure 2 draws it as a bar chart with one bar per value.
Figure 2 · The probability distribution of X
Two rules hold for every probability distribution, and questions test both.
0≤P(X=x)≤1 for every x, and ∑P(X=x)=1. The total is 1 because X takes exactly one of its values.
Here 161+163+165+167=1616=1. A total other than 1 means an error: find it first.
When all n values are equally likely, each has probability n1 and X is called uniform. The score on one fair die is uniform. The larger score here is not.
Reading probabilities off a distribution. Add the probabilities of the values that qualify. For a discrete variable < and ≤ differ, so list those values first.
P(X≥3)=P(X=3)+P(X=4)=165+167=43P(X<3)=P(X=1)+P(X=2)=164=41or 1−P(X≥3)P(1<X≤3)=P(X=2)+P(X=3)=168=211 excluded, 3 included
Conditional probability from 4.6 works on a distribution too. Given that X is at least 3, the chance it is 4 is
P(X=4∣X≥3)=P(X≥3)P(X=4)=12/167/16=127
The numerator is P(X=4 and X≥3), which is just P(X=4).
Mode and median
The mode is the value with the greatest probability, here x=4.
The median is the first value at which the running total of probabilities reaches or passes 21. P(X≤2)=164 falls short and P(X≤3)=169 is enough, so the median is 3.
The mean (section 5) is a third measure of centre.
3Building a distribution
Questions rarely hand you the table. The first marks are for making it: list the values, find each probability, tabulate, and check the total. Figure 1 was one route, a sample space. Here are three more.
From a tree without replacement
Example: a tray holds 9 seedlings, 3 white-flowered and 6 purple. Two are picked at random, one after the other, without replacement. Let X be the number of white-flowered seedlings picked, so X∈{0,1,2}. The second branch has 8 seedlings left, so the denominators change.
P(X=0)=96×85=7230=125P(X=1)=96×83+93×86=7236=21two routes, so two products addedP(X=2)=93×82=726=121
x
0
1
2
P(X=x)
125
126
121
A common denominator makes the check quick: 1212=1.
The usual slip is to record one route for X=1 and then wonder why the total is short.
From observed frequencies
Example: a survey of 40 households records the number of cars.
6 have none, 18 have one, 12 have two, 4 have three.
Dividing each frequency by 40 gives a model for a household chosen at random.
x
0
1
2
3
P(X=x)
0.15
0.45
0.3
0.1
When the values never stop
Example: a learner driver passes the test with probability 0.3 at each attempt. X is the number of attempts up to and including the first pass. X can be 1,2,3,… with no largest value, and P(X=x)=0.7x−1×0.3 (x−1 fails, then a pass).
For P(X≤3), add three terms, 0.3+0.21+0.147=0.657. Or use the complement, 1−0.73=0.657.
The infinitely many probabilities still add to 1. That is the sum to infinity of a geometric series (1.8).
4Distributions with an unknown constant
The guide says a distribution will be given as a table or a formula. A usual first part puts an unknown in it. One fact finds it: the probabilities add to 1.
From a formula. Example: a random variable has P(X=x)=k(x2+2) for x∈{0,1,2,3}. Find k.
P(X=0)+P(X=1)+P(X=2)+P(X=3)=1k(0+2)+k(1+2)+k(4+2)+k(9+2)=12k+3k+6k+11k=122k=1, so k=221
Write each term, as here: the method mark is for showing every value substituted.
The distribution is 222,223,226,2211, drawn in Figure 3.
Figure 3 · A distribution given by a formula
P(X≥2)=226+2211=2217
From a table. Collect the unknown terms, move the known ones across.
x
1
2
3
4
5
P(X=x)
0.1
2m
0.2
m
0.1
Then 0.1+2m+0.2+m+0.1=1, so 3m=0.6 and m=0.2.
Always substitute back. The probabilities are 0.1,0.4,0.2,0.2,0.1, each between 0 and 1, total 1. A value of the unknown that pushes any probability below 0 or above 1 is impossible.
A quadratic in the unknown. When the table has both t and t2, the sum-to-1 equation is quadratic and has two roots. The extra mark is for rejecting one with a reason.
x
0
1
2
3
P(X=x)
0.35
3t2
t
0.33
0.35+3t2+t+0.33=13t2+t−0.32=0a "show that" part often gives this linet=6−1±1+3.84=6−1±2.2, so t=0.2 or t=−158
t=−158 would make P(X=2)=t negative, which no probability can be, so t=0.2.
Name the probability that fails; "it does not work" earns nothing.
The probabilities are 0.35,0.12,0.2,0.33, total 1. Carry only t=0.2 forward.
A range for the unknown. Every probability must lie between 0 and 1, and that can limit the unknown.
Example: P(X=1)=0.4, P(X=2)=q and P(X=3)=0.6−q. Then q≥0 and 0.6−q≥0, so 0≤q≤0.6. The mean, using section 5, is
E(X)=0.4+2q+3(0.6−q)=2.2−q
so E(X) falls as q rises, from 2.2 at q=0 down to 1.6 at q=0.6. A question asking for the greatest possible value of E(X) wants the end of that range: 2.2, when q=0.
5Expected value
Roll the two four-sided dice 1600 times. By the expected-number rule of 4.5 you would expect:
X=1 about 1600×161=100 times
X=2 about 300 times
X=3 about 500 times
X=4 about 700 times
The mean of those 1600 values is
16001×100+2×300+3×500+4×700=16005000=3.125
Each value is weighted by how often it occurs, which is its probability. The 1600 cancels. That is the definition.
E(X)=∑xP(X=x): multiply each value by its probability, and add. This is the expected value, or mean, of X.
For the car survey of section 3, E(X)=0+0.45+0.6+0.3=1.35 cars per household.
So 200 households would be expected to own about 200×1.35=270 cars. Multiply by the number of trials to turn a mean into a total.
Using E(X) to find a second unknown. Two unknowns need two equations: the total is 1, and E(X) is given.
x
1
2
3
4
P(X=x)
0.1
a
b
0.3
Given E(X)=2.9, find a and b.
0.1+a+b+0.3=1, so a+b=0.6probabilities add to 11(0.1)+2a+3b+4(0.3)=2.9, so 2a+3b=1.6E(X)=2.9substitute a=0.6−b: 1.2−2b+3b=1.6, so b=0.4a=0.6−0.4=0.2check: E(X)=0.1+0.4+1.2+1.2=2.9
On Paper 1 solve the pair by hand. On Paper 2 the GDC's equation solver is quicker, but write both equations first: they carry the method marks.
The GDC can also sum the products from two lists (values, probabilities). Write the substitution anyway, so a mistyped entry still earns method marks.
A payoff that depends on X
For the mean of a quantity worked out from X, add a row of the new values (a charge of $5 per item plus a $2 fee, say).
Then use ∑(value)×P(X=x).
The shortcut E(aX+b)=aE(X)+b and the variance Var(X) are HL content (4.14). At SL the tabulated route is all you need.
6Applications: games, fairness and decisions
The guide's application is games of chance. Let X be the player's gain: what they receive minus what they paid. E(X) is then 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. Example: 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 is paid every time.
A 6 gives 12−4=$8.
A 4 or 5 gives 4−4=$0.
A 1, 2 or 3 gives −$4.
gain, x($)
−4
0
8
P(X=x)
21
31
61
E(X)=−4×21+0×31+8×61=−2+0+34=−32≈−0.67
The expected gain is −$0.67, so the game is not fair. A player loses about 67 cents a game on average, and the organiser keeps it. Figure 5(a) shows the balance point below zero.
Making it fair. What prize p for a 6 would make the game fair? The gain on a 6 becomes p−4. The other gains stay.
E(X)=−4×21+0×31+(p−4)×61=06p−4=2p−4=12, so p=16
A $16 prize makes the game fair. Figure 5(b) shows the gain on a 6 at $12 and the beam balancing at 0.
Figure 5 · The player's gain, before and after the prize is changed
Or keep the prizes and change the stake. The expected prize is 12×61+4×62=2+34=310. A stake of $3.33 (3 s.f.) makes the game fair.
That is because a fair game charges exactly the expected prize.
An unknown probability
The unknown can sit in the prize, the stake or a probability. The method never changes: write E(X) with the unknown in it and set it equal to 0.
Example: in a card game a player's gain is $10 with probability w and −$2 otherwise. Fair means 10w−2(1−w)=0, so 12w=2 and w=61.
Casinos and lotteries never run fair games. E(X)<0 for the player is how they cover costs and profit.
Whether that is "fair" in the everyday sense is a TOK question; mathematically it is not.
Pricing risk. Example (invented figures): an electronics shop sells a two-year warranty for $45. From its records, a warranty leads to a $200 repair with probability 0.10, a $480 replacement with probability 0.03, and no claim otherwise. Let Y be the shop's profit on one warranty.