The law of total probability and Bayes' theorem
Goals
- Use the law of total probability to find the probability of an event case by case.
- Use Bayes' theorem to find the probability of a case once the result is known.
- Draw a tree diagram for a two-stage problem and read both formulas from it.
- Explain why a positive test for a rare disease can still be unlikely to mean the disease.
Remember
- Total probability: ; in general, add over a partition.
- Bayes: .
- On a tree diagram: multiply along each path; is the sum of the paths to ; Bayes is "one path divided by the sum".
- For a rare disease, the false positives from the huge healthy group can dominate, so can be small.
- is not .
Exercises
Exercise 1
Given , and , find and .
Exercise 2
A school has two campuses: of its students are at campus 1 and at campus 2. The proportions who cycle to school at the two campuses are and . A student of the school is chosen at random. Find the probability that the student cycles. If the student cycles, what is the probability that the student is at campus 2?
Exercise 3
Box I holds red and blue balls; box II holds red and blue balls. A die is rolled: a or a chooses box I, anything else chooses box II; then one ball is drawn at random from the chosen box. Find the probability of a red ball and the probability that a red ball came from box I.
Exercise 4
The first box holds white and black balls; the second box holds white and black balls. One ball is moved at random from the first box to the second, and then one ball is drawn at random from the second box. Find the probability that this last ball is white.
Exercise 5
The probability of rain on a given morning is . If it rains, the bus is late with probability ; if it does not rain, the bus is late with probability . Is each claim true or false?
a) The probability that the bus is late is .
b) The probability that the bus is late when it does not rain is .
c) Given that the bus is late, the probability of rain is .
d) Given that the bus is not late, the probability of rain is less than .
Exercise 6
Three factories supply parts to a phone maker in the proportions , , , with defect rates , , . A part chosen at random is defective. Find the probability that it came from the first factory. Give your answer to 2 decimal places.
Exercise 7
In a company's inbox, of emails are spam. The phrase "you have won" appears in of spam emails but in only of ordinary emails. A new email contains "you have won". Find the probability that it is spam, as a percentage to 1 decimal place.
Exercise 8 Review
Machine A makes items, of them defective; machine B makes items, of them defective. All the items are mixed and one is picked at random. Find the probability that it is defective in two ways: by direct counting and with the law of total probability. If the item is defective, what is the probability that machine B made it?
Exercise 9 Review
Box I holds red and white balls; box II holds red and white balls. One box is chosen at random (each with probability ), and then balls are drawn at random together from that box. Find the probability of getting red balls. If red balls are drawn, what is the probability that box I was chosen?
Exercise 10 Challenge
A disease affects of the population. A test is positive for of people with the disease and gives a false positive for of people without it. a) A person tests positive; find the probability that the person has the disease. b) The person retakes the test and is positive again (the two results are independent for each person); find the probability of the disease again.
Mini test
15 minutes, without looking back at the lesson. Part I: circle one letter; Part II: write T or F for each statement; Part III: write the answer in the box.
Part I. Multiple choice
Part II. True or false
| a) The probability that the item is defective is . | T / F |
| b) The probability that the item is defective, given that it is from workshop II, is . | T / F |
| c) Given that the item is defective, the probability that it is from workshop II is . | T / F |
| d) Given that the item is not defective, the probability that it is from workshop I is greater than . | T / F |
Part III. Short answer
Score: ........ / 10
Hints (only when stuck)
What you need: the law of total probability and Bayes' theorem.
Steps:
- .
- Find , then divide by .
What you need: the two campuses are two complementary cases.
Steps:
- Add the two paths that lead to "cycles".
- Divide the path through campus 2 by the total.
What you need: .
Steps:
- .
- Use Bayes' theorem.
What you need: two cases: the ball moved is white or black; after the move, the second box has balls.
Steps:
- Moving a white ball (probability ): the second box has white out of .
- Moving a black ball (probability ): the second box has white out of .
What you need: the law of total probability and Bayes' theorem; .
Steps:
- Find .
- Apply Bayes' theorem to "late" and to "not late".
What you need: the general form of the law of total probability and of Bayes' theorem with three cases.
Steps:
- Find as a sum of three products.
- Divide by that sum.
What you need: Bayes' theorem; this is how a simple spam filter works.
Steps:
- Find .
- Divide by that result.
What you need: conditional probability by counting (see conditional probability).
Steps:
- Counting: .
- Formula: , , and similarly for machine B.
What you need: counting with combinations (see permutations, arrangements and combinations): each box gives ways to draw balls.
Steps:
- and .
- Use the law of total probability, then Bayes' theorem.
What you need: Bayes' theorem; with two independent tests, the probability of two positives is with the disease and without it.
Steps:
- a) Numerator ; the denominator adds .
- b) Replace by and by .
Self-check
| # | Did it alone | Needed a hint | Not yet |
|---|---|---|---|
| 1 | ☐ | ☐ | ☐ |
| 2 | ☐ | ☐ | ☐ |
| 3 | ☐ | ☐ | ☐ |
| 4 | ☐ | ☐ | ☐ |
| 5 | ☐ | ☐ | ☐ |
| 6 | ☐ | ☐ | ☐ |
| 7 | ☐ | ☐ | ☐ |
| 8 | ☐ | ☐ | ☐ |
| 9 | ☐ | ☐ | ☐ |
| 10 | ☐ | ☐ | ☐ |
Redo the ones you missed after: ☐ 1 day ☐ 3 days ☐ 7 days
Scan for step-by-step solutions