Conditional Probability and Tree Diagrams

AP Statistics · Unit 2 — Probability, Random Variables, and Probability Distributions

Conditioning shrinks the sample space

The conditional probability of $A$ given $B$ is the chance of $A$ once you know $B$ has happened:

$$P(A\mid B)=\frac{P(A\cap B)}{P(B)}$$

Rearranged, this is the general multiplication rule $P(A\cap B)=P(B)\,P(A\mid B)$, which works whether or not the events are independent. From a two-way table, $P(A\mid B)$ is the count in the $A$-and-$B$ cell divided by the row or column total for $B$ — not by the grand total. Independence is the special case $P(A\mid B)=P(A)$: knowing $B$ changes nothing.

Tree diagrams

A tree diagram organises a two-stage process: first-stage branches carry unconditional probabilities, second-stage branches carry conditional ones. Multiply along a path to get the joint probability of that path; add across paths that lead to the same outcome. Example: a disease affects $2\%$ of people; the test is positive for $95\%$ of the sick and for $8\%$ of the healthy. Then $P(\text{positive})=0{,}02\cdot0{,}95+0{,}98\cdot0{,}08=0{,}019+0{,}0784=0{,}0974$.

Reversing the condition

The exam's favourite question runs the tree backwards: given a positive test, what is the chance of disease?

$$P(\text{disease}\mid\text{positive})=\frac{0{,}019}{0{,}0974}\approx0{,}195$$

Only about one positive in five is a true case, because the healthy group is so much larger that its $8\%$ false positives outnumber the sick group's true positives. The numerator is one path; the denominator is every path ending in "positive".

disease 0.02 none 0.98 positive 0.95 negative 0.05 positive 0.08 negative 0.92 0,02×0,95 = 0,0190 0,02×0,05 = 0,0010 0,98×0,08 = 0,0784 0,98×0,92 = 0,9016 start
Reading a tree diagram. The first branch is "has the disease or not", the second branch is the test result given the first branch. The two bold paths both end at "positive": adding them gives $P(\text{positive})=0.0974$; to get $P(\text{disease}\mid\text{positive})$, take the upper path divided by the sum of the two bold paths. The false-positive path ($0.0784$) is four times as large as the true-positive path ($0.0190$) — that is why a “$95\%$ accurate” test still gives mostly false alarms among positive cases.

Worked example: reversing a condition with a tree diagram

A company buys components from two factories: factory A supplies $60\%$ with a defect rate of $3\%$, factory B supplies $40\%$ with a defect rate of $5\%$. A component is chosen at random. (a) What is the probability it is defective? (b) Given that it is defective, what is the probability it came from factory B? (c) Are origin and defect status independent?

Solution

Build the tree: first branch A ($0.60$) / B ($0.40$); second branch defective / not defective with conditional probabilities $0.03$ and $0.05$.

(a) Add the two paths that end at "defective": $P(D)=0.60\cdot0.03+0.40\cdot0.05=0.018+0.020=0.038$.

(b) $P(B\mid D)=\dfrac{P(B\cap D)}{P(D)}=\dfrac{0.020}{0.038}\approx0.526$. Although B supplies only $40\%$ of the components, more than half of the defective components come from B because B's defect rate is higher.

(c) Compare $P(D\mid B)=0.05$ with $P(D)=0.038$: they differ, so not independent — knowing the origin changes the probability of a defect.

Conclusion in context: if you want to reduce defects, factory B is the place to inspect first, even though it supplies fewer goods.

Common mistake

$P(A\mid B)$ and $P(B\mid A)$ are two different numbers; a question that gives "$95\%$ of sick people test positive" and then asks about "positive people being sick" is checking whether you swap the two. From a two-way table, the denominator of a conditional probability is the row/column total, not the grand total. And two mutually exclusive events (cannot occur together) are dependent, not independent — knowing one occurs means the other certainly does not.

Key takeaway

$P(A\mid B)=P(A\cap B)/P(B)$; the condition shrinks the sample space. Tree diagram: multiply along, add across. Reversing a condition: numerator one path, denominator all paths with the same outcome. Independent when $P(A\mid B)=P(A)$.

← Probability Rules · All AP Statistics lessons · Practice AP Statistics questions (free, instant scoring) · Random Variables and Their Combinations →