Experimental and theoretical probability¶
Probability · level 3, lesson 5 of 6
A question to start¶
Flip a fair coin 10 times and count the heads. The chance of heads is \(\tfrac12\), so you "should" get 5 heads.
Here is a surprise: most of the time, you will not get exactly 5. Getting exactly 5 heads out of 10 happens only about one time in four. Three times out of four you get some other number, like 4, or 6, or 3.
So what does "the chance of heads is \(\tfrac12\)" really promise? This lesson answers that, with real numbers from a computer that flipped a coin a thousand times.
The idea¶
Two ways to find a probability¶
So far you have found probabilities by thinking: count the equally likely outcomes, and make a fraction. A coin has 2 faces, so \(P(\text{heads}) = \tfrac12\). This is called the theoretical probability. "Theoretical" means it comes from reasoning, before anything is actually tried.
There is a second way: do the experiment many times, and count. If you flip a coin 100 times and get 43 heads, then heads happened in \(\tfrac{43}{100}\) of the flips. This fraction is called the experimental probability, or the relative frequency:
"Frequency" means how often something happens. "Relative" means compared with the number of tries. 43 heads is a lot out of 100, but very few out of 10 000; the fraction tells you how often it happened for its size.
It is often easier to compare relative frequencies as decimals: \(\tfrac{43}{100} = 0.43\), and the theoretical probability \(\tfrac12 = 0.5\).
What a computer saw¶
A computer flipped a fair (pretend) coin 1000 times and kept count as it went. Here is how many heads it had seen after different numbers of flips.
| Flips so far | 10 | 20 | 50 | 100 | 200 | 500 | 1000 |
|---|---|---|---|---|---|---|---|
| Heads so far | 3 | 6 | 19 | 43 | 94 | 232 | 495 |
| Relative frequency | 0.3 | 0.3 | 0.38 | 0.43 | 0.47 | 0.464 | 0.495 |
After 10 flips, only 3 were heads: 0.3, a long way from 0.5. That is not a broken coin. Small numbers of tries jump around a lot. The same computer then did five more separate runs of 10 flips and got 6, 6, 3, 4 and 4 heads. Not one of them was exactly 5.
But look at what happens as the number of flips grows. Here is the relative frequency of heads after every flip, from the first to the thousandth.
At the left the line leaps up and down: after 1 flip the fraction of heads can only be 0 or 1! As the flips pile up, the line settles down and hugs the dashed line at one half.
The law of large numbers, in plain words¶
What you see in the picture always happens, and it has a name: the law of large numbers. In plain words:
If you repeat an experiment many, many times, the relative frequency of an event usually gets closer and closer to its probability.
That is what a probability of \(\tfrac12\) promises. Not exactly 5 heads in 10 flips, but that in the long run about half the flips are heads.
Why does the line settle down? Think about what one flip can do to the fraction.
- After 2 flips, one new flip changes the fraction a lot. Going from 1 head out of 2 (0.5) to 1 head out of 3 (about 0.33) is a big jump.
- After 1000 flips, one new flip is only one part in a thousand. Going from 495 out of 1000 to 495 out of 1001 hardly moves the fraction at all.
The more tries you already have, the less any single surprise can push the fraction around. Lucky and unlucky streaks still happen, but they get swamped by everything else.
What does not settle down¶
Here is something careful. The fraction of heads gets closer to \(\tfrac12\). But the number of heads does not get closer to exactly half.
- After 10 flips: 3 heads, 7 tails. Tails were ahead by 4.
- After 1000 flips: 495 heads, 505 tails. Tails were ahead by 10.
The gap in the counts got bigger, from 4 to 10, but the fraction got much closer to one half, from 0.3 to 0.495. That is because 10 out of 1000 is a tiny part, while 4 out of 10 is a big part. The coin does not "catch up" by throwing extra heads. It does not need to: the gap just becomes small compared with the number of flips.
Using experiments¶
Experiments are useful in three ways.
- To check a theory. If you think a die is fair, roll it 600 times. You expect each face roughly 100 times. If the 6 came up 180 times, something is probably wrong with the die.
- To find a probability you cannot work out by thinking. Will a thumbtack land point up? Will a piece of toast land butter side down? There are no equally likely outcomes to count, so experiments are the main way to find out (more in lesson 6).
- To guess what is hidden. In level 2 you drew from a hidden bag many times to guess what was inside. Relative frequency turns that guess into numbers.
Worked examples¶
1. Working out a relative frequency. A die is rolled 60 times and shows a 6 on 13 of them.
- Relative frequency of a 6: \(\tfrac{13}{60}\), which is about 0.22.
- Theoretical probability: \(\tfrac16\), about 0.17.
- 13 is a bit more than the 10 you might expect, but 60 rolls is not many. This is not good evidence that the die is unfair. (Rolling 30 sixes in 60 rolls would be very strong evidence; with a fair die that is almost impossible.)
2. Guessing the inside of a bag. A bag holds 10 marbles, some red and some white. You may not look. You draw a marble, note its colour, put it back, shake, and repeat. After 200 draws you have 61 red.
- Relative frequency of red: \(\tfrac{61}{200} = 0.305\).
- If there were \(r\) red marbles out of 10, the probability of red would be \(\tfrac{r}{10}\): 0.1, 0.2, 0.3, and so on.
- The closest is 0.3. So the best guess is 3 red and 7 white. (You cannot be certain. But 2 red would give about 40 reds in 200 draws, and 4 red about 80, and 61 is much closer to the 60 that 3 red would give.)
3. Is 5 heads out of 10 the most likely? Yes, it is the single most likely number, but it is still not likely. Among the \(2 \times 2 \times \dots \times 2 = 1024\) equally likely lists of 10 flips, 252 have exactly 5 heads. So \(P(\text{exactly 5 heads}) = \tfrac{252}{1024}\), about 0.25. Getting 4, 5 or 6 heads covers about 0.66: roughly two times in three. The other third of the time you see 3 or fewer, or 7 or more.
4. Comparing classes. Two classes test a spinner that should land on blue with probability \(\tfrac14\).
- Class A: 12 blues in 40 spins, relative frequency \(\tfrac{12}{40} = 0.3\).
- Class B: 255 blues in 1000 spins, relative frequency \(\tfrac{255}{1000} = 0.255\).
Class B's answer is closer to 0.25, and also more trustworthy, because it comes from far more spins. The best single estimate uses all the spins together: \(\tfrac{12 + 255}{40 + 1000} = \tfrac{267}{1040}\), about 0.257.
Try it¶
- A coin is flipped 50 times and lands heads 28 times. What is the relative frequency of heads, as a fraction and a decimal? What is the theoretical probability?
- A spinner is spun 80 times and lands on green 20 times. Estimate \(P(\text{green})\).
- A die is rolled 300 times. About how many times would you expect a 1? Would 47 be surprising? Would 150?
- Mia flips a coin 4 times and gets 4 heads. She says "the coin must be unfair". Is she right?
- After 100 flips a coin has shown 46 heads; after 1000 flips, 488 heads. For each, find the relative frequency of heads and how far the number of heads is from half the flips. Which got closer to \(\tfrac12\), and which got further from half?
- A bag has 5 marbles, some blue. You draw with replacement 100 times and get blue 59 times. How many blue marbles do you think are in the bag?
- Why is it impossible for the relative frequency of heads to be exactly 0.5 after 7 flips?
Answers
- \(\tfrac{28}{50} = 0.56\). The theoretical probability is \(\tfrac12 = 0.5\).
- \(\tfrac{20}{80} = \tfrac14 = 0.25\).
- \(P(1) = \tfrac16\), and a sixth of 300 is 50. 47 is close to 50: not surprising at all. 150 would be hugely surprising (half the rolls!) and would suggest the die is not fair.
- No. With only 4 flips this happens to a fair coin quite often: 1 of the 16 equally likely lists is HHHH, so the chance is \(\tfrac{1}{16}\). She would need many more flips to have real evidence.
- 100 flips: \(0.46\), and 46 is 4 below 50. 1000 flips: \(0.488\), and 488 is 12 below 500. The relative frequency got closer to 0.5 (0.04 away, then 0.012 away), while the gap in the count grew from 4 to 12. Just like the computer's coin.
- \(\tfrac{59}{100} = 0.59\). With \(b\) blue out of 5, the chance is \(\tfrac{b}{5}\): 0.2, 0.4, 0.6, 0.8 or 1. The closest to 0.59 is 0.6, so probably 3 blue.
- Half of 7 is 3.5, and you cannot have 3.5 heads. The fraction can be \(\tfrac37\) (about 0.43) or \(\tfrac47\) (about 0.57), but never exactly \(\tfrac12\).
Common mistake¶
Expecting the experiment to match the theory exactly. A fair coin flipped 10 times gives exactly 5 heads only about a quarter of the time. "Close" is the most you can expect, and close gets closer only with many tries.
Thinking the coin "catches up". The law of large numbers does not mean that after lots of tails, heads become more likely. Each flip is still \(\tfrac12\). The fraction settles because each new flip matters less and less, not because the coin remembers. (Level 2's chance has no memory is the same idea.)
Where it leads¶
- Back: Two dice · Next: Equally likely or not, where experiments are the only way in.
- Level 3 page · Probability topic page
- Using experiments on purpose, with dice or a computer, to estimate hard probabilities: level 4, simulations. How far off the counts usually are: level 4, expected counts.
- The law of large numbers, stated properly: level 8.
- Collecting and describing real data: Statistics.
- Turning fractions into decimals: Numbers level 3.