Discrete and Continuous Random Variables
Theory
A random variable is a number whose value is decided by a random experiment. This Year 11 Mathematics Advanced page shows how to tell discrete (counted) from continuous (measured) random variables, list the possible values of \(X\), and estimate probabilities such as \(P(X=2)\) and \(P(X\ge 2)\) from frequency tables using relative frequency.
A random variable is a variable whose value is the numerical outcome of a random experiment. It is named with a capital letter, such as \(X\), and a particular value it takes is written with a lower-case letter, \(x\). For example, toss four coins and let \(X\) be the number of heads; then \(X\) can be \(0, 1, 2, 3\) or \(4\). The random variable is the number of heads, not the outcome (the list of heads and tails) itself. A probability such as \(0.5\) is not a random variable.
A discrete random variable takes separate values that can be listed, usually because it counts something: passengers on a bus, faulty phones in a box, correct answers on a quiz. There may be no largest value (the number of calls a salesperson makes until the first sale can be \(1, 2, 3, \ldots\)), but the values are still separate, so it is still discrete.
A continuous random variable can take any value in an interval, because it is measured: time, mass, length, height, temperature, volume. A measurement may be recorded to the nearest second or millimetre, but the quantity itself can lie anywhere in between, so it is still continuous.
The probability that \(X\) takes the value \(x\) is written \(P(X=x)\). From experimental data it is estimated by the relative frequency. Continuous data are usually grouped into class intervals such as \(5\le t\lt 10\).
| Discrete | Continuous |
|---|---|
| counted | measured |
| separate values that can be listed | any value in an interval |
| number of heads, passengers, faulty phones, quiz scores | time, mass, length, height, volume |
| \(X\in\{0,1,2,\ldots\}\) | for example \(0\le T\lt 20\) |
Discrete or continuous?
- Ask whether the value is counted or measured.
- Counted (separate whole-number steps, or other separate steps such as half shoe sizes): discrete. List the values if asked.
- Measured (time, mass, length, temperature): continuous, even if it is rounded when recorded.
- Give the reason in words: “\(X\) counts passengers, so it takes the separate values \(0,1,2,\ldots\)”.
Estimating a probability from a frequency table
- Find the number of trials: add the frequencies, or read it from the question.
- Add the frequencies of the values in the event, for example \(x=2,3,4\) for \(X\ge 2\).
- Divide and simplify: \(P(X\ge 2)\approx\dfrac{\text{that total}}{\text{number of trials}}\).
- Unknown frequencies: use a given relative frequency (frequency \(=\) relative frequency \(\times\) trials), then make the frequencies add to the total.
- Compare with theory when asked: list the sample space \(S\), count the favourable outcomes, and find \(\dfrac{\text{favourable}}{|S|}\).
(i) \(R\), the number of red cars in a car park holding \(50\) cars
(ii) \(M\), the mass in kilograms of a newborn baby
(iii) \(C\), the temperature at 3 pm, recorded to the nearest \(0.1^\circ\)C
(iv) \(N\), the number of tosses of a coin until the first head
Ask: counted or measured?
(i) \(R\) counts cars: \(R\in\{0,1,\ldots,50\}\). \(\therefore\ R\) is discrete.
(ii) Mass is measured and can be any value in an interval, such as \(3.418\) kg. \(\therefore\ M\) is continuous.
(iii) Temperature is measured. Rounding to \(0.1^\circ\)C limits the recording, not the temperature itself. \(\therefore\ C\) is continuous.
(iv) \(N\) counts tosses: \(N\in\{1,2,3,\ldots\}\). There is no largest value, but the values are separate. \(\therefore\ N\) is discrete.
(i) \(X\) is the sum of the two numbers. List the possible values of \(X\). How many are there?
(ii) \(Y\) is the product of the two numbers. How many different values can \(Y\) take?
(i) Smallest sum \(1+1=2\); largest sum \(4+4=8\). Every whole number between can occur (for example \(5=1+4\)).
| \(X\) | \(\in\) | \(\{2,3,4,5,6,7,8\}\) |
| \(\text{Number of values}\) | \(=\) | \(8-2+1\) |
| \(\) | \(=\) | \(\mathbf{7}\) |
(ii) Products do not fill every number in a range, so list them in a table:
| \(\times\) | \(1\) | \(2\) | \(3\) | \(4\) |
|---|---|---|---|---|
| \(1\) | \(1\) | \(2\) | \(3\) | \(4\) |
| \(2\) | \(2\) | \(4\) | \(6\) | \(8\) |
| \(3\) | \(3\) | \(6\) | \(9\) | \(12\) |
| \(4\) | \(4\) | \(8\) | \(12\) | \(16\) |
\(Y\in\{1,2,3,4,6,8,9,12,16\}\), so \(Y\) can take \(\mathbf{9}\) different values. Values such as \(5\), \(7\) and \(10\) are impossible.
| \(x\) | \(0\) | \(1\) | \(2\) | \(3\) | \(4\) |
|---|---|---|---|---|---|
| Frequency | \(20\) | \(32\) | \(14\) | \(8\) | \(6\) |
(ii) Estimate \(P(X\ge 2)\).
(iii) Estimate how many of \(500\) students at the school have no pets.
Give fractions in simplest form.
(i) Relative frequency \(=\) frequency \(\div\) number of trials:
| \(P(X=1)\) | \(\approx\) | \(\dfrac{32}{80}\) |
| \(\) | \(=\) | \(\mathbf{\dfrac{2}{5}}\) |
(ii) Add the frequencies for \(X=2\), \(3\) and \(4\): \(14+8+6=28\).
| \(P(X\ge 2)\) | \(\approx\) | \(\dfrac{28}{80}\) |
| \(\) | \(=\) | \(\mathbf{\dfrac{7}{20}}\) |
(iii) \(P(X=0)\approx\dfrac{20}{80}=0.25\).
| \(\text{Expected number}\) | \(\approx\) | \(0.25\times 500\) |
| \(\) | \(=\) | \(\mathbf{125}\) |
\(\therefore\) about \(125\) students have no pets.
| \(x\) | \(0\) | \(1\) | \(2\) |
|---|---|---|---|
| Frequency | \(a\) | \(62\) | \(b\) |
(i) Find \(a\) and \(b\).
(ii) Use the data to estimate \(P(X\ge 1)\).
(iii) Use the sample space to find the theoretical value of \(P(X\ge 1)\) and compare.
(i) Relative frequency of \(X=0\):
| \(\dfrac{a}{120}\) | \(=\) | \(0.2\) |
| \(a\) | \(=\) | \(\mathbf{24}\) |
| \(24+62+b\) | \(=\) | \(120\) |
| \(b\) | \(=\) | \(\mathbf{34}\) |
(ii) \(X\ge 1\): \(62+34=96\) of \(120\) trials.
| \(P(X\ge 1)\) | \(\approx\) | \(\dfrac{96}{120}\) |
| \(\) | \(=\) | \(\mathbf{\dfrac{4}{5}}\) |
(iii) \(S=\{HH,HT,TH,TT\}\), so \(|S|=4\). At least one head: \(HH,HT,TH\).
| \(P(X\ge 1)\) | \(=\) | \(\mathbf{\dfrac{3}{4}}\) |
The estimate \(\dfrac{4}{5}=0.8\) is close to \(\dfrac{3}{4}=0.75\); more trials would be expected to bring it closer.
Common pitfalls
Frequently asked questions
What is a random variable?
A random variable is a variable whose value is the numerical outcome of a random experiment, such as \(X=\) the number of heads when four coins are tossed.
What is the difference between discrete and continuous random variables?
A discrete random variable is counted and takes separate values that can be listed, like \(0,1,2,3\). A continuous random variable is measured and can take any value in an interval, like a time or a mass.
Is time a discrete or continuous random variable?
Time is continuous, because it is measured and can take any value in an interval. Recording it to the nearest second does not change that.
Can a discrete random variable have infinitely many values?
Yes. The number of calls a salesperson makes until the first sale can be \(1, 2, 3, \ldots\) with no largest value, but the values are separate, so it is discrete.
How do you estimate P(X = x) from a frequency table?
Divide the frequency of \(x\) by the total number of trials. For \(P(X\ge 2)\), add the frequencies of \(2\) and above first.