A11 · Lesson 4 · Conditional probability
Updating chances when you learn something
A network loses 1% of its packets. A packet has just been lost: what's the chance the next one is lost too? If losses were unrelated, still 1%. On a real link, where interference comes in bursts, it might be 40%. Knowing that one thing happened changes the chances of another, and conditional probability is the arithmetic of that change. It's also the tool for any process that happens in stages: which factory line made a chip, then whether that chip is bad.
- Two dice are thrown 20,000 times. Each bar is one of the 36 outcomes, numbered row by row: bars 1 to 6 have the first die showing 1, bars 7 to 12 have it showing 2, and so on.
- Event : the first die shows . Event : the sum is at least . The readouts measure , and their ratio.
- Set and . Knowing the first die is a 6, how likely is a sum of 10 or more? Compare with the chance before you knew.
Predict
A chip comes from line 1 (60% of production, 2% defective) or line 2 (40%, 5% defective). What fraction of all chips is defective?
3.2%. Split by line: . Each defect rate is a conditional probability, the chance of a defect given the line, and the overall rate weights each by how much that line makes. The plain average would be right only if the lines made equal shares.
Name it
Conditional probability
The probability of given is
Learning that happened shrinks the sample space to ; the outcomes of that are still possible are those in , and dividing by rescales so the new sample space has probability 1. With equally likely outcomes it's just counting inside : of the 6 outcomes with the first die showing 6, three have a sum of 10 or more, so , against before.
A conditional probability is a probability: it obeys all the axioms, so for example .
The multiplication rule
Turned around, the definition gives the chance that two things both happen, one stage at a time:
Drawing two parts from 10, of which 3 are bad: . The second factor is conditional, because the first draw changed what's left.
Total probability
If split the sample space into pieces that don't overlap (which line made the chip, which symbol was sent), then
Draw it as a tree: the first branches are the with their chances, the second branches are or not, given each . Multiply along a path to get that path's chance, and add the paths that end in .
Order matters
and are different numbers. The chance a defective chip came from line 2 is not the chance a line-2 chip is defective. Lesson 5 turns one into the other.
Worked example
A link loses 1% of packets, and 0.4% of consecutive pairs are both lost. Given that a packet was lost, what is the chance the next one is lost?
Show the solution
- Apply the definition. Write for this packet lost and for the next one lost:
- Losses come in bursts. One loss makes the next 40 times more likely than average.
- Why it matters. A retransmission scheme that assumes independent losses would badly underestimate how often two copies in a row fail.
Answer given a loss, the next packet is lost with chance 0.4.
Worked example
A box has 10 fuses, 3 of them blown. You take two without looking. What is the chance that exactly one is blown?
Show the solution
- Blown, then good. This is one of the two paths in the tree that give exactly one blown fuse:
- Good, then blown. This is the other:
- Add the two paths.
- Check by counting.
Answer the chance that exactly one is blown is 0.467.
Worked example
60% of parts come from supplier A, with 1% defective, and 40% from B, with 3% defective. What fraction of parts are defective?
Show the solution
- Split by supplier. By the law of total probability:
- Read it. 1.8% is a weighted average of the two rates.
- Turning it around. Lesson 5 asks the reverse question: given a bad part, how likely is it to be from B?
Answer 1.8% of parts are defective.
Check
= 0.05 and = 0.2. What is ?
Check
Two dice are thrown, and the first shows 5. What is the chance that the sum is 9 or more?
Check
Line 1 makes 0.6 of the chips with a defect rate of 0.01; line 2 makes the rest with a defect rate of 0.05. What fraction of all chips is defective?
Check
A box holds 10 parts, 3 of them defective. You draw two without replacement. What is the chance both are defective?
Check
A link loses a fraction 0.01 of its packets, and a fraction 0.003 of consecutive pairs are both lost. Given a loss, what is the chance the next packet is lost?
Check
A test catches 99% of bad boards. Does that mean 99% of the boards it flags are bad?
Check
A fraction 0.6 of parts come from supplier A, with defect rate 0.01; the rest from B, with defect rate 0.05.
(a)
What fraction of all parts are defective?
Check
A link loses a fraction of packets, and a fraction of consecutive pairs are both lost.
Step 1
Given one packet was lost, what is the chance the next one is too?
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
How many times more likely is that than if losses were independent?
Explain why
Why does divide by ?
Once you know happened, the only outcomes still possible are the ones in , so they become the whole sample space. Their chances have to be scaled up so they add to 1, and dividing by does that. Within that smaller space, the outcomes where also happens are , so the new chance of is rescaled: .
Practice
Keep practicing
9 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.