- Probability rules — addition and multiplication
- Combined events
- Venn diagrams for probability
- The binomial distribution
- Independence and conditional probability · coming soon
The ball nobody looked at
The last lecture ended with a bag of 3 red balls and 7 blue balls. Two balls were drawn, and the first one was put back before the second draw. So the bag was the same both times, and the two draws were independent.
Now change one thing. The first ball is taken out and not put back. Nobody looks at it. It goes straight into a pocket. Then a second ball is drawn.
What is the probability that the second ball is red?
This looks like a question with no answer. The second draw depends on the first. If the first ball was red, the bag now holds 2 reds out of 9. If it was blue, the bag holds 3 reds out of 9. And nobody knows which happened.
Make a guess, and keep it. You will test it later in this lecture, and most people's first guess is wrong. To answer the question, you need a way to see every possible history of the bag at once. A tree diagram does exactly that.
Every way the two draws can go
A tree diagram draws a process one stage at a time. From a starting point, one branch goes out for each possible result of the first stage. The probability of that result is written on the branch. From the end of each branch, a new set of branches shows the possible results of the next stage.
Look closely at the second stage. After a red first ball, 9 balls are left: 2 red and 7 blue. So those branches read and . After a blue first ball, the 9 balls left are 3 red and 6 blue. So those branches read and . The two branches from any one point add to 1, because one of them must happen.
The branch fractions are not simplified: , not . This is deliberate. The 9 shows how many balls are left, and that is the number you most need to check.
The second-stage numbers are a new kind of probability. Each one is not simply "the probability of red". It is the probability of red given what has already happened on that path. This is called a conditional probability, and it has its own notation:
Read the vertical bar as "given". The line says: the probability that the second ball is red, given that the first ball was red, is .
Multiply along a path
One complete path through the tree is one complete history, such as red then red. To find its probability, multiply the fractions along the path:
Why multiply? Count. Imagine the balls numbered from 1 to 10. The first draw can be any of the 10 balls, and the second can be any of the 9 that are left. So there are ordered pairs, all equally likely. The first ball is red in 3 ways. For each of those, the second ball is red in 2 ways. So of the 90 pairs are red then red.
That is it. That is the whole idea. Multiplying along a path takes a fraction of a fraction. In three tenths of all runs, the first ball is red. In two ninths of those runs, the second ball is red too.
This is the multiplication rule from the last lecture, made general. There, the second fraction stayed the same whatever happened first, because the events were independent. Here it changes, so you use the conditional one.
It is true for any two events. When A and B are independent, , and the rule becomes the one from the last lecture.
Add between paths
In one run of the process, exactly one path happens. So different paths are mutually exclusive. When an event can happen along several paths, add the probabilities of those paths.
"Exactly one red ball" happens along two paths: red then blue, and blue then red.
The four paths together cover every possible history. So their probabilities must add to exactly 1:
The total is 1 ✓. This check takes a few seconds, and it catches most mistakes on a tree. Do it every time.
Why do the second-stage branches change when the ball is not put back, but stay the same when it is?
Show the answer
With replacement, the bag is back to 3 red and 7 blue before every draw. So whatever came first, the second-stage branches read and . Both sets of branches are identical, which means : the draws are independent. Without replacement, the bag remembers the first draw. Independence is not a separate rule to learn. It is what a tree looks like when every set of branches at a stage is the same.
Back to the ball nobody looked at
You now have the tool for the opening question. Use the tree in the figure above, or trust your first guess.
A bag holds 3 red and 7 blue balls. The first ball is removed without anyone looking at it. What is the probability that the second ball is red? Choose before you read on.
The probability that the second ball is red is , the same as for the first ball. Red then red gives , blue then red gives , and together they make .
The tree gives the answer in one line. The second ball is red along two paths: red then red, and blue then red.
There is also a reason you can see without any arithmetic. Line up all 10 balls in the order they would be drawn. Each ball is just as likely to stand in second place as in first place. So the chance of a red ball in second place is the same as in first place: 3 in 10. The first ball does change the bag. But nobody knows how it changed, so it gives no information, and the chance stays where it started.
The explorer below lets you test this on other bags.
Change the numbers of red and blue balls, and switch between drawing with and without replacement. Watch the second-stage fractions, and watch the probability that the second ball is red.
Red balls: 3
Blue balls: 7
The figure shows the bag of 3 red and 7 blue balls with replacement. Compare it with the tree without replacement above. The table gives results for other bags.
| Bag | Draws | P(2nd red) | P(same colour) |
|---|---|---|---|
| 3 red, 7 blue | without | 3/10 | 48/90 = 8/15 |
| 3 red, 7 blue | with | 3/10 | 58/100 = 29/50 |
| 4 red, 3 blue | without | 4/7 | 18/42 = 3/7 |
| 4 red, 3 blue | with | 4/7 | 25/49 |
| 1 red, 1 blue | without | 1/2 | 0 |
In every row, the probability that the second ball is red equals the fraction of red balls in the bag. Replacement changes the branches and the chance of "same colour", but not that.
Two things should stand out. Without replacement, the second-stage fractions change from path to path, and their bottom numbers drop by one. Yet the probability that the second ball is red never moves when you switch replacement on and off. It always equals the fraction of red balls in the bag.
Reading a tree backwards
A tree can also answer a question in the other direction. Here is an example, with invented numbers. On any day, the chance of rain is 0.3. On a rainy day, Kofi takes an umbrella with probability 0.9. On a dry day, he takes one with probability 0.2.
Forwards first. Kofi takes an umbrella along two paths, so P(umbrella) is the sum of those two paths:
Check the four paths: ✓.
Now the backwards question. You see Kofi arrive with an umbrella. What is the probability that it rained?
The tree has a branch that reads 0.9, so 0.9 is tempting. But 0.9 answers a different question: the probability of an umbrella, given rain. You want the probability of rain, given an umbrella.
Think about 100 days. Rain would fall on about 30 of them, and Kofi would carry an umbrella on 27 of those. Of the 70 dry days, he would carry one on 14. So he carries an umbrella on days, and it rains on 27 of those 41.
This is the hard part of the lecture. Spend time here. Knowing that Kofi has an umbrella removes every path without one. Only the umbrella days are left, and the question is what share of those days had rain. A share of a group is a division:
, where is not 0.
Given that B happened, only the outcomes in B are left. is the share of those in which A happens too.
Multiply both sides by and you get , the multiplication rule again. So reading forwards and reading backwards use one rule, not two.
Is the same as ?
Show the answer
No. : out of 30 rainy days, 27 have an umbrella. : out of 41 umbrella days, 27 have rain. The top number is the same, 27, but the bottom number counts a different group of days. Swapping the two sides of the bar changes the question.
Worked examples
A bag holds 4 red and 3 blue balls. Two are drawn without replacement. Find the probability that both are the same colour.
First stage: , . After a red ball, 6 are left, 3 red and 3 blue: branches and . After a blue ball, 4 red and 2 blue are left: branches and .
"Same colour" is two paths, RR and BB.
Check: RB and BR are each, and ✓. The second-stage bottom numbers are 6, not 7, because one ball has gone.
A biased coin lands heads with probability 0.6. It is flipped three times. Find the probability of exactly two heads.
A three-stage tree has paths. You only need the ones with exactly two heads: HHT, HTH and THH. The flips are independent, so every set of branches reads 0.6 and 0.4.
Each of the three paths multiplies two 0.6s and one 0.4, in a different order, so each is .
So the probability of exactly two heads is
Check: no heads , one head , three heads . The four totals add to ✓. "Count the paths, then multiply by the probability of one path" is the idea behind the binomial distribution, later in this unit.
A box holds 10 bulbs, and 2 of them are faulty. Bulbs are tested one at a time, without replacement, until the first faulty one is found. Find the probability that it is found on the third test.
A faulty bulb ends the testing, so a "faulty" branch is the end of its path. Only "good" branches grow further. Found on the third test means good, good, faulty:
Each bottom number drops by one, because each tested bulb is set aside. On the third test, 8 bulbs are left, and both faulty bulbs are still among them.
Check another way. The chance of finding a faulty bulb within three tests is . Its complement, three good bulbs, is , and ✓.
Use the bag from Worked Example 1. You are told that exactly one of the two balls is red. Find the probability that the first ball was the red one.
Exactly one red happens along RB and BR, each , so . The first ball was red only on RB:
Check by reasoning: one red and one blue ball came out, and each of the two balls was equally likely to be drawn first. So a half is right ✓.
Without replacement, every second-stage branch has a bottom number one less than the first stage: , not . Before you multiply, ask what is left in the bag at that point of the tree.
"One red and one blue" is two paths, red then blue and blue then red. Counting only one of them gives half the answer. List every path that fits the event before you add.
and are different numbers. Kofi carries an umbrella on 90% of rainy days, but only about 66% of his umbrella days are rainy. Ask which group of outcomes you are left with, and divide by its probability.
Work each one on paper first. Open a hint only when you are stuck.
-
A jar holds 5 green and 3 yellow sweets. Leila takes two sweets without replacement. Find the probability that (a) both are green, (b) at least one is yellow.
Hint 1
Draw the tree. After a green sweet, how many green and yellow are left?
Hint 2
For (b), "at least one yellow" is the complement of "both green".
Full answer
(a) . (b) . Check by the paths: GY , YG , YY , and , so ✓.
-
Sofia passes her driving test at the first attempt with probability 0.6. If she fails, she passes at the second attempt with probability 0.7. (a) Find the probability that she passes within two attempts. (b) Given that she passed within two attempts, find the probability that she passed first time.
Hint 1
The "pass" branch at the first attempt ends its path. Only "fail" grows a second stage.
Hint 2
For (b), divide the probability of passing first time by your answer to (a).
Full answer
(a) . Check: failing both is , and ✓. (b) . Passing first time is part of "passed within two", so the top of the division is just 0.6.
-
A factory has two machines. Machine A makes 70% of the items, and 2% of its items are faulty. Machine B makes 30%, and 5% of its items are faulty. An item is chosen at random. (a) Find the probability that it is faulty. (b) It is faulty. Find the probability that it came from Machine B.
Hint 1
First stage: which machine. Second stage: faulty or not, given the machine.
Hint 2
For (b), only the two "faulty" paths are left. What share of their total comes from B?
Full answer
(a) . (b) . Machine B makes less than a third of the items, but just over half of the faulty ones. Check: , and ✓.
-
Two cards are dealt from a standard pack of 52, without replacement. (a) Find the probability that the second card is an ace. (b) Given that the second card is an ace, find the probability that the first card was an ace too.
Hint 1
The second card is an ace along two paths: ace then ace, and not-ace then ace.
Hint 2
For (b), divide P(ace, ace) by your answer to (a).
Full answer
(a) . This is , the same as for the first card, for the same reason as the ball nobody looked at. (b) . Check by reasoning: if the second card is an ace, the other 51 cards hold 3 aces, and the first card is any one of those 51, so ✓.
Reading a tree backwards has a famous name. Thomas Bayes, an English minister, worked out a way to reason from what you observe back to its likely cause. He died in 1761. His friend Richard Price found the work among his papers, and it was published by the Royal Society of London in 1763. Today, "Bayes' theorem" means the conditional probability rule used in exactly this way: start with a probability, then update it when new evidence arrives.
The backwards answer can be a shock. Here is an invented example. A condition affects 1 person in 100. A test is positive for 90% of people who have the condition, and also for 9% of people who do not. Someone tests positive. How likely is it that they have the condition?
Think about 10 000 people. 100 have the condition, and 90 of them test positive. The other 9 900 do not have it, but 891 of them test positive anyway. So 981 people test positive, and only 90 of them have the condition.
So the probability of having the condition, given a positive test, is
That is fewer than 1 in 10. The test is good, but the condition is rare, so most positive results come from the much larger group without it. This is one reason why a positive result from a screening test is often checked with a second test. A tree, read backwards, makes the reason visible.
- A tree diagram shows a process stage by stage, and each branch carries the probability of its result given everything earlier on its path.
- Multiply along a path, , because a path's probability is a fraction of a fraction.
- Add between paths, because different paths are mutually exclusive, and check that all the paths together add to 1.
- Without replacement, the second-stage fractions change and their bottom numbers drop by one; with replacement, every set of branches is the same, which is what independence looks like.
- Reading backwards uses : given B, only B's outcomes are left, and you take A's share of them.
- and are different numbers that answer different questions.