AP Statistics · Probability, random variables and probability distributions
Conditional probability and independence
1Conditional probability
The conditional probability of $A$ given $B$ is the probability that $A$ happens when we know $B$ has happened:
$$P(A \mid B) = \frac{P(A \cap B)}{P(B)}$$
In a table, restrict attention to the row or column for $B$.
500 adults; 200 are smokers, 60 of whom have a cough; 300 non-smokers, 45 with a cough.
- $P(\text{cough} \mid \text{smoker}) = \frac{60}{200} = 0.30$.
- $P(\text{smoker} \mid \text{cough}) = \frac{60}{105} \approx 0.571$.
Note: $P(A \mid B)$ is usually not the same as $P(B \mid A)$.
Check yourself
P(A and B) = 0.12 and P(B) = 0.4. P(A | B) =
Show the answer
0.3
0.12/0.4.
2The multiplication rule and tree diagrams
General multiplication rule:
$$P(A \cap B) = P(A) \cdot P(B \mid A)$$
A tree diagram shows sequential events: multiply along branches, add the probabilities of branches that lead to the event you want.
2% of people have a disease. A test is positive for 95% of people with the disease and for 8% of people without it.
- $P(D \cap +) = 0.02 \times 0.95 = 0.019$.
- $P(D^C \cap +) = 0.98 \times 0.08 = 0.0784$.
- $P(+) = 0.0974$.
- $P(D \mid +) = \frac{0.019}{0.0974} \approx 0.195$.
Even with a positive test, only about 20% actually have the disease, because the disease is rare.
A tree diagram for a screening test: multiply along branches, then condition on a positive result
Check yourself
In the disease example, P(+) is found by:
Show the answer
Adding the probabilities of both branches ending in +
Total probability.
3Independence
Events $A$ and $B$ are independent if knowing one occurred does not change the probability of the other:
$$P(A \mid B) = P(A)$$
For independent events, $P(A \cap B) = P(A) \cdot P(B)$.
check independence in the smoking table.
- $P(\text{cough}) = \frac{105}{500} = 0.21$.
- $P(\text{cough} \mid \text{smoker}) = 0.30 \ne 0.21$.
- So cough and smoking are not independent.
two independent machines each fail with probability 0.05. $P(\text{both fail}) = 0.05^2 = 0.0025$.
Check yourself
A and B are independent with P(A) = 0.6 and P(B) = 0.5. P(A and B) =
Show the answer
0.3
Multiply.
4Sampling without replacement
When sampling without replacement from a small population, probabilities change after each draw, so draws are not independent.
a bag has 5 red and 3 blue balls. Draw two without replacement.
- $P(\text{both red}) = \frac{5}{8} \times \frac{4}{7} = \frac{20}{56} \approx 0.357$.
With replacement it would be $\left(\frac{5}{8}\right)^2 \approx 0.391$.
If the sample is less than 10% of the population, draws are treated as approximately independent (the 10% condition).
Check yourself
Drawing 2 cards without replacement from a deck, P(both aces) =
Show the answer
(4/52)(3/51)
One ace is gone after the first draw.
5Going deeper: tree diagrams, false positives and testing for independence
Conditional probability: the probability of A given that B has occurred:
$$P(A \mid B) = \frac{P(A \text{ and } B)}{P(B)}$$
The condition (what comes after "given") is the denominator: we look only within B.
General multiplication rule: $P(A \text{ and } B) = P(A) \times P(B \mid A)$.
Independence: A and B are independent if knowing that one has occurred does not change the probability of the other:
P(A | B) = P(A), or equivalently P(A and B) = P(A) × P(B).
To test for independence, compute and compare. Do not assume it.
Worked example (checking independence): of 200 students, 80 are seniors; 50 students drive to school, of whom 32 are seniors.
- P(drives) = 50 ÷ 200 = 0.25.
- P(drives | senior) = 32 ÷ 80 = 0.40.
- These are not equal, so driving and being a senior are not independent: seniors are more likely to drive.
Independent is not mutually exclusive. If A and B are mutually exclusive (with non-zero probabilities), knowing that A occurred tells you B did not: they are as dependent as can be.
Sampling without replacement: probabilities change after each selection.
two cards are drawn without replacement from a standard deck. Find the probability that both are aces.
- P(first ace) = 4 ÷ 52.
- P(second ace | first ace) = 3 ÷ 51.
- P(both) = (4 ÷ 52)(3 ÷ 51) = 0.0045.
Tree diagrams organize events that happen in stages.
- Multiply along the branches to find the probability of a path.
- Add the paths that lead to the event of interest.
- The branches from any one point total 1.
Worked example (medical testing): a disease affects 1% of a population. A test is positive for 95% of those who have it (sensitivity) and falsely positive for 5% of those who do not.
- Paths: disease and positive: 0.01 × 0.95 = 0.0095. No disease and positive: 0.99 × 0.05 = 0.0495.
- P(positive) = 0.0095 + 0.0495 = 0.059.
- P(disease | positive) = 0.0095 ÷ 0.059 = 0.161.
- Only about 16% of those who test positive have the disease. Because the disease is rare, false positives from the large healthy group outnumber true positives.
The same reasoning with counts: imagine 10,000 people. 100 have the disease, of whom 95 test positive. 9900 do not, of whom 495 test positive. Of 590 positives, 95 are real: 16%. Many people find a table of counts clearer than the formula.
Do not reverse the condition. P(positive | disease) = 0.95 is not P(disease | positive) = 0.16. Confusing the two is a famous error in medicine and in law.
From a two-way table: conditional probabilities are read directly: restrict attention to the row or column named in the condition.
a factory has two machines. Machine A makes 60% of the items, 2% of them defective. Machine B makes 40%, 5% defective.
- P(defective) = 0.60(0.02) + 0.40(0.05) = 0.012 + 0.020 = 0.032.
- P(from B | defective) = 0.020 ÷ 0.032 = 0.625.
- Although B makes fewer items, most defective items come from B.
Independent repetitions: for independent events, multiply: the probability that three independent free throws at 80% all succeed is 0.8³ = 0.512.
The 10% condition: when sampling without replacement from a population at least ten times the sample size, treating the selections as independent introduces little error.
Notation: P(A | B) is read "the probability of A given B." State events in words before using symbols, for example "let D = has the disease, T = tests positive."
Common mistakes
- Dividing by the wrong total (the condition goes underneath).
- Confusing P(A | B) with P(B | A).
- Assuming independence and multiplying P(A) × P(B) when the events are related.
- Calling mutually exclusive events independent.
- Adding along the branches of a tree.
- Forgetting to change the denominator when sampling without replacement.
Check yourself
A test for a rare condition is 99% accurate for people who have it. A person tests positive. Why might the probability that they have the condition still be low?
Show the answer
Because the condition is rare, false positives among the many healthy people can outnumber true positives
P(condition | positive) depends on how common the condition is, not only on the test's accuracy.
6For top marks
- Write conditional probabilities in words and symbols, identifying the "given" event.
- Check independence by comparing $P(A \mid B)$ with $P(A)$ (or $P(A \cap B)$ with $P(A)P(B)$), showing the numbers.
- Use tree diagrams for multi-stage problems, and Bayes-type reasoning for "reverse" conditional probabilities.
- State the 10% condition when treating draws without replacement as independent.
"Since $P(\text{late} \mid \text{rain}) = 0.4$ but $P(\text{late}) = 0.15$, being late and rain are not independent: rain makes lateness more likely."
Check yourself
To check independence, compare:
Show the answer
P(A | B) with P(A)
Does B change A's probability?
Now test yourself
This lesson has a 8-question quiz and 5 exam-style questions with mark schemes in Impera. Free, with your progress saved.
Practise in Impera