A111 of 55
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

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 p. The top panel tracks the fraction of heads so far; the dashed line is p.
  • Look at the first 20 flips, then the last 400. How far does the fraction stray from p 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?

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 16. 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: P(not A)=1−P(A).
  • Or, for outcomes that can't happen together: P(A or B)=P(A)+P(B). A die shows 5 or 6 with probability 26.
  • And, for independent events (one tells you nothing about the other): P(A and B)=P(A)P(B). Two dice both show six with probability 136.

At least one. The chance that something happens at least once in n independent tries is easiest through "not":

P(at least once)=1−(1−p)n

If each of 1000 bits is wrong with probability 10−4, the chance a 1000-bit packet has at least one error is 1−(1−10−4)1000≈9.5%. For small p, that's close to np (here 10%) as long as np 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 P(sum=7)=16.

Expected counts. In n independent trials each with probability p, you expect about np successes. That's what the flat line on the dice histogram shows: n/6 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
  1. Use the complement. The chance of no losses in 500 packets is 0.999500=0.606
  2. At least one loss. 1−0.606=0.394
  3. Why adding overcounts. Adding 500×0.001=0.5 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
  1. 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 P=16
  2. Expected sevens. In 600 throws you expect about 600×16=100
  3. 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
  1. Use the complement. It's easier to find the chance that all 23 birthdays differ: P=365365×364365×⋯×343365=0.493
  2. At least one shared birthday. 1−0.493=0.507 better than even.
  3. Tags and hashes. The same arithmetic tells you how often random 16-bit tags collide: with 216 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 n independent parts work, each failing with probability p.

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°.

Explain why

A test finds 3 errors in 100 bits. Why shouldn't you conclude the error probability is 3%?

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.