A11 · Lesson 1 · Probability as long-run frequency
What "a one-in-six chance" actually predicts
Noise in an amplifier, bit errors on a link, the time between radioactive decays in a smoke detector: engineers deal constantly with things they can't predict one at a time. They can predict them in bulk. Roll a die once and anything can happen; roll it 60,000 times and you'll get very close to 10,000 sixes. Probability is the number that the fraction settles toward, and learning how fast it settles is what lets an engineer say a link has an error rate of one in a billion.
Play
- The coin lands heads with probability . The top panel tracks the fraction of heads so far; the dashed line is .
- Look at the first 20 flips, then the last 400. How far does the fraction stray from early on, and late?
- Press New samples several times. Does the early part look the same each time? The late part?
Predict
You roll a fair die 60 times, then 60,000 times. Which run is more likely to land within 1% of exactly one-sixth sixes?
The 60,000 rolls. With 60 rolls you'd need almost exactly 10 sixes, and you often get 7 or 13. With 60,000 the fraction is almost always within 1% of 1/6, though the count of sixes itself still wanders by a hundred or so. The fraction settles because its random wobble shrinks as (lesson 33 explains why); the count's wobble grows as , but more slowly than .
Name it
Probability
Long-run frequency. Repeat an experiment many times under the same conditions. The probability of an outcome is the fraction of trials in which it happens, in the limit of many trials. A fair die has six equally likely faces, so each has probability . The fraction in any finite run wobbles around that value, and the wobble shrinks as the run gets longer: the law of large numbers.
Rules. Probabilities are between 0 (never) and 1 (always), and the probabilities of all the possible outcomes add to 1.
- Not: .
- Or, for outcomes that can't happen together: . A die shows 5 or 6 with probability .
- And, for independent events (one tells you nothing about the other): . Two dice both show six with probability .
At least one. The chance that something happens at least once in independent tries is easiest through "not":
If each of 1000 bits is wrong with probability , the chance a 1000-bit packet has at least one error is . For small , that's close to (here 10%) as long as is small.
Counting. When outcomes are equally likely, probability is counting: favorable outcomes over all outcomes. Two dice have 36 equally likely results, and 6 of them sum to 7, so .
Expected counts. In independent trials each with probability , you expect about successes. That's what the flat line on the dice histogram shows: of each face.
Worked example
A link loses 1 packet in 1000, independently. What is the chance of at least one loss in a 500-packet transfer?
Show the solution
- Use the complement. The chance of no losses in 500 packets is
- At least one loss.
- Why adding overcounts. Adding would overcount, because it counts transfers with two or more losses several times.
Answer the chance of at least one loss is 0.394.
Worked example
Two dice are thrown 600 times. About how many sevens do you expect, and how many doubles?
Show the solution
- Count the sevens. Six of the 36 equally likely outcomes sum to 7: (1,6), (2,5), (3,4), (4,3), (5,2), (6,1). So
- Expected sevens. In 600 throws you expect about
- Doubles. Doubles are also 6 outcomes of 36, so you expect about 100 of them too.
Answer about 100 sevens and about 100 doubles.
Worked example
In a group of 23 people, what is the chance that two share a birthday?
Show the solution
- Use the complement. It's easier to find the chance that all 23 birthdays differ:
- At least one shared birthday. better than even.
- Tags and hashes. The same arithmetic tells you how often random 16-bit tags collide: with possible values, a few hundred tags already make a collision likely. Hash and ID designers size their fields with this "birthday bound".
Answer the chance that two of the 23 share a birthday is 0.507, better than even.
Check
You roll 3 fair dice. What is the probability that every one shows a six?
Check
Each bit of a block is wrong with probability 0.0001, independently. What is the chance that a 10000-bit block has at least one error?
Check
Two fair dice are rolled.
(a)
What is the probability that they sum to 3?
(b)
And that they don't sum to 3?
Check
A fair die is rolled 6000 times. About how many times do you expect a 2 or lower?
Check
A coin has landed heads 8 times in a row. What is the chance the next flip is heads?
Check
Each of 100 packets is lost independently with probability 0.001.
(a)
What is the chance of at least one loss?
(b)
What is the expected number of losses?
Check
A system works only if all independent parts work, each failing with probability .
Step 1
What is the chance it works?
Type it the way you would write it, like 3sin(2πft) or 3*sin(2*pi*f*t). Angles can be in radians or carry a degree sign, like 45°.
Step 2
What is the chance it fails?
Explain why
A test finds 3 errors in 100 bits. Why shouldn't you conclude the error probability is 3%?
In a short run, the fraction of errors wobbles a lot around the true probability: with only 100 bits, 3 errors could easily come from a true rate of 1% or 6%. Probability is the fraction in the long run, and the wobble shrinks only as the square root of the number of trials. To measure a rate reliably you need enough trials to see many errors, which is why bit error rate tests run for billions of bits.
Practice
Keep practicing
8 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.