A number for every outcome
Roll a fair dice and call the score X. Every outcome of the roll comes with a number: the face showing 4 gives X = 4. A variable whose value is decided by the outcome of an experiment is called a random variable.
A capital letter names the variable, and a small letter names one value it can take. The dice can give the values 1, 2, 3, 4, 5 and 6, and each value has its own probability: , and the same for every other face.
The score on a fair dice. Each of the six values has the same probability, , so all six lines have the same height.
Two coins, one count
Toss two fair coins and let X be the number of heads. The four outcomes HH, HT, TH and TT are equally likely, each with probability . HH gives X = 2, HT and TH both give X = 1, and TT gives X = 0.
So X takes three values: , and . Two outcomes give the same value, so the value 1 collects both their probabilities.
One experiment can carry more than one random variable. For the same two coins, the number of tails is another one, and it is always 2 − X.
The first coin, then the second. Each of the four paths has probability , and the end of each path shows the number of heads it gives. The middle two paths both give X = 1.
Discrete: values you can list
The number of heads in two tosses can be 0, 1 or 2, and nothing in between: there is no toss with 1.5 heads. A random variable whose values can be listed one by one is called discrete.
Counts are the usual discrete variables: the number of sixes in ten rolls is one of 0, 1, 2, up to 10. A list may have no last value and still be a list: the number of tosses until the first head is 1, 2, 3, and so on. Shoe sizes that come in half steps, 7, 7½, 8, are discrete too, because the sizes can be listed.
Each value of a discrete variable has its own probability, and the probabilities add up to 1. For the two coins, .
The number of heads in two tosses: one line for each value that can be listed, and nothing between them. The line at 1 is twice as tall, because and the other two are .
Continuous: any value in a range
The time a bus journey takes can be 5 minutes, or 5.2, or 5.21, or any value in between. Between any two possible times there is always another. A random variable that can take any value in a range is called continuous. Heights, masses and times are continuous.
The values of a continuous variable cannot be listed, so there is no bar for each one. Its distribution is drawn as a curve called a probability density, and a probability is the area under the curve over a range of values. The total area under the curve is 1.
One exact value, such as a journey of exactly 5 minutes, has probability 0, because there is no area above a single point. The questions are about ranges instead, such as the probability that a journey takes between 4 and 6 minutes.
A density for the time a journey takes, highest at 5 minutes. The shaded area between 4 and 6 minutes is the probability that a journey takes between 4 and 6 minutes: about 0.52 of the whole area under the curve, which is 1.
Telling them apart
Ask whether the values can be listed. If they can, the variable is discrete; if it can land anywhere in a range, it is continuous. A variable that gives a number is always one or the other.
Whole numbers are not the test. A height recorded to the nearest centimeter looks like a list of whole numbers, but the height itself is continuous: the rounding happened when it was written down. A shoe size of 7½ is not a whole number, and the size is still discrete.
An application
In the application below, the waiting time at a clinic is a continuous random variable. Its density is a straight line falling to 0 at 10 minutes, so each probability is the area of a triangle.
Worked example: Waiting Time at a Walk-In Clinic with a Triangular Density, a Long Wait and the Median Wait
Question The time W minutes that a patient waits at a walk-in clinic has probability density f(w) = k(10 − w) for 0 ≤ w ≤ 10, and f(w) = 0 otherwise. (a) Find k, and the probability that a patient waits more than 6 minutes. (b) Find the median waiting time.
1.The graph of f is a triangle with base 10 and height f(0) = 10k. The total area is 1: 12 × 10 × 10k = 50k = 1, so k = 150 = 0.02.
The density is a triangle of base 10 and height 10k, and its area must be 1: k = 0.02. 2.A wait of more than 6 minutes is the small triangle from w = 6 to w = 10. Its height is f(6) = 0.02 × 4 = 0.08, so its area is 12 × 4 × 0.08 = 0.16.
A wait of more than 6 minutes is the small shaded triangle: 12 × 4 × 0.08 = 0.16. 3.(a) k = 0.02 and P(W > 6) = 0.16.
(a) k = 0.02 and P(W > 6) = 0.16. 4.The area to the right of the median m is a triangle with base 10 − m and height 0.02(10 − m), and it must be 0.5: 12 × 0.02(10 − m)2 = 0.5, so (10 − m)2 = 50.
The median m leaves an area of 0.5 to its right: 12 × 0.02(10 − m)2 = 0.5, so (10 − m)2 = 50. 5.Then 10 − m = √50 = 7.071, so m = 2.929; the negative root would give m = 17.07, outside 0 ≤ w ≤ 10, and is rejected. (b) The median wait is 2.93 minutes, below 5 because short waits are the most likely. Check: 0.01 × 7.0712 = 0.500.
(b) m = 10 − √50 = 2.93 minutes, well below 5, because short waits are the most likely.
Answer: (a) k = 0.02 and P(W > 6) = 0.16; (b) 2.93 minutes
Common mistakes
- Setting the height f(0) = 1, which gives k = 0.1. The height of a density is not a probability; it is the area under the graph that must equal 1.
- Taking the median as 5 minutes, the middle of the range. The density is highest for short waits, so half of the area is used up well before 5 minutes.
More probability distributions problems, worked step by step →