Sub topic 16
Reversing a conditional probability
This chapter assumes you can compute P(A and B) with the general multiplication rule, read a tree diagram, and use the law of total probability. Here you will use those tools to turn P(B | A) into P(A | B).
Why the direction matters
P(A | B) and P(B | A) are different numbers. P(A | B) asks how likely A is among the outcomes where B happened. P(B | A) asks how likely B is among the outcomes where A happened.
Many word problems give you one direction and ask for the other. A problem might say "3% of items from machine A are defective" and then ask "this item is defective, so what is the chance it came from machine A?" The first statement is P(defective | A). The question is P(A | defective).
| Statement | Notation | Sample space it uses |
|---|---|---|
| 3% of machine A's items are defective | P(defective given A) | Items from machine A |
| This defective item came from machine A | P(A given defective) | All defective items |
Swapping the two is the most common error in this kind of problem. A rule can fix it: write the event after the word "given" in the denominator.
The reversing formula
Start from the general multiplication rule, which you can write in two ways:
- P(A and B) = P(A) × P(B | A)
- P(A and B) = P(B) × P(A | B)
Both expressions equal the same quantity, so set them equal and solve for P(A | B):
P(A | B) = P(A and B) / P(B)
This is the definition of conditional probability. It becomes a reversing tool when you compute the top and bottom from the information you were given:
- The numerator is P(A and B) = P(A) × P(B | A). It uses the direction the problem stated.
- The denominator is P(B), found with the law of total probability. You add up every path that leads to B.
Written out for two causes, A and "not A", this is Bayes' rule:
P(A | B) = P(A) × P(B | A) / [P(A) × P(B | A) + P(not A) × P(B | not A)]
You do not need to memorize this form for the GRE. The method is the same each time: list the paths, find the paths that end in B, and take the share that went through A.
A worked example
A factory has two machines. Machine A makes 60% of the items and 3% of its items are defective. Machine B makes 40% of the items and 5% of its items are defective. One item is chosen at random and it is defective. What is the probability it came from machine A?
- Find the path probabilities. P(A and defective) = 0.6 × 0.03 = 0.018. P(B and defective) = 0.4 × 0.05 = 0.020.
- Add the paths that end in "defective". P(defective) = 0.018 + 0.020 = 0.038.
- Divide. P(A | defective) = 0.018 / 0.038 = 9/19, which is about 0.47.
Machine A makes more items, yet it is slightly less likely than not to be the source. Its lower defect rate offsets its larger share of production.
The tree makes the structure visible. Forward questions follow a branch from the root. A reversed question starts at the leaves: you keep only the leaves that match the observed result and ask what share of them came from each branch.
Checking the answer with code
This script computes the same result with exact fractions. It avoids rounding, so you can see that the answer is exactly 9/19.
from fractions import Fraction
p_a = Fraction(6, 10) # P(machine A)
p_b = Fraction(4, 10) # P(machine B)
p_def_given_a = Fraction(3, 100) # P(defective | A)
p_def_given_b = Fraction(5, 100) # P(defective | B)
path_a = p_a * p_def_given_a # P(A and defective) = 9/500
path_b = p_b * p_def_given_b # P(B and defective) = 1/50
p_defective = path_a + path_b # law of total probability
p_a_given_def = path_a / p_defective
print(p_defective) # 19/500
print(p_a_given_def) # 9/19
print(float(p_a_given_def))Using counts instead of probabilities
Percentages in a reversing problem are easy to mix up. A reliable alternative is to invent a population and count people. Pick a total that makes every share a whole number.
Suppose 2% of a population has a condition. A test is positive for 90% of people who have it, and positive for 10% of people who do not. Take 1,000 people:
- 20 have the condition. Of these, 90% test positive, which is 18 people.
- 980 do not have it. Of these, 10% test positive, which is 98 people.
- In total, 18 + 98 = 116 people test positive.
Among the 116 positives, 18 have the condition, so P(condition | positive) = 18/116 = 9/58, which is about 15.5%.
Many people expect this answer to be near 90%. The test is accurate, but the condition is rare. The 980 healthy people produce far more false positives than the 20 sick people produce true positives. The base rate, the starting share of 2%, has a large effect on the answer.
A step-by-step method
- Name the events and write each given number in conditional notation, such as P(defective | A).
- Identify which conditional the question asks for. The event after "given" is the one you already know happened.
- Build the tree or table. Multiply along each branch to get path probabilities.
- Add every path that ends in the observed result. This is the denominator.
- Divide the path through the event you are asking about by that total.
- Check that the answer is plausible. The reversed probabilities across all causes should add to 1. In the factory problem, P(A | defective) + P(B | defective) = 9/19 + 10/19 = 1.
Edge cases and common errors
- Forgetting a path. If three machines exist, the denominator needs three terms. Leaving one out gives an answer that is too large.
- Using the wrong denominator. Dividing by P(A) instead of P(defective) gives back the forward probability, 0.03.
- Ignoring the base rate. When one cause is much rarer than the others, its reversed probability is often far lower than its forward probability suggests.
- Treating the posterior as independent of the prior. If the groups are equally likely, the prior terms cancel. Then P(A | B) depends only on the relative sizes of P(B | A) and P(B | not A). That is a useful shortcut, but only when the groups really are equally likely.
- Mixing percents and counts. Pick one scheme. If you use counts, make sure every group's size is consistent with the stated percents.
Exercises
Exercise
Bag X holds 2 red and 2 blue marbles. Bag Y holds 3 red and 1 blue marble. A fair coin flip chooses a bag, and then one marble is drawn at random from that bag. The marble is red. What is the probability that it came from Bag X?
Show answer
P(X and red) = 1/2 × 2/4 = 1/4. P(Y and red) = 1/2 × 3/4 = 3/8. P(red) = 1/4 + 3/8 = 5/8. So P(X | red) = (1/4) / (5/8) = 2/5.
Exercise
In a town, 1% of people have a certain allergy. A screening gives a positive result for 95% of people with the allergy and for 5% of people without it. Using a group of 10,000 people, find the probability that a person who tests positive has the allergy. Give the answer as a fraction in lowest terms.
Show answer
Of 10,000 people, 100 have the allergy and 95 of them test positive. The other 9,900 have no allergy, and 5% of them, which is 495, test positive. Total positives = 95 + 495 = 590. P(allergy | positive) = 95/590 = 19/118, which is about 16%.
Exercise
A student says, "A defective item is 5% likely from machine B, so P(B | defective) = 0.05." Which conditional probability did the student actually use, and what is missing from the calculation?
Show answer
The student used P(defective | B), the forward direction. To find P(B | defective), you must divide the path probability P(B and defective) by P(defective), which includes the paths through every machine. In the factory problem this gives 0.020 / 0.038 = 10/19.