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".
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.