Skip to main content
Examonaut

Topic 3 · Lesson 2 of 4

Tree diagrams and conditional probability

Tree diagrams

A tree diagram shows events in sequence. Each set of branches from one point covers every possibility, so its probabilities add to 1. To find the probability of a path, multiply along the branches; to combine paths, add them.

The probabilities on the second set of branches can depend on the first. A bag holds 5 red and 3 blue balls, and two are taken without replacement. After a red is taken, 4 of the 7 left are red, so the second branch is 47\frac{4}{7}, not 58\frac{5}{8}. The diagram shows the whole tree.

5/8R3/8B4/7R3/7B5/7R2/7BRR: 20/56RB: 15/56BR: 15/56BB: 6/56first ballsecond ball

How to use a tree diagram

  1. Step 1: Draw one set of branches for each stage, labelling outcomes and probabilities.
  2. Step 2: For later stages, ask "what has changed?" (balls removed, a result known).
  3. Step 3: Multiply along each path you need.
  4. Step 4: Add the paths for the event asked about. Check all paths total 1.

Worked example

Without replacement

For the bag above, find the probability that the two balls are the same colour, and the probability that at least one is blue.

Show solution
  1. Same colour: RR or BB. 58×47+38×27=2056+656=2656=1328\frac{5}{8} \times \frac{4}{7} + \frac{3}{8} \times \frac{2}{7} = \frac{20}{56} + \frac{6}{56} = \frac{26}{56} = \frac{13}{28}.
  2. At least one blue: the complement of "both red", which is quicker than adding three paths: 1−2056=3656=9141 - \frac{20}{56} = \frac{36}{56} = \frac{9}{14}.

"At least one" questions are almost always easiest with 1−P(none)1 - P(\text{none}).

Conditional probabilityA level only

P(A∣B)P(A \mid B) means "the probability of AA given that BB has happened". Knowing BB happened shrinks the sample space: we now look only inside BB. Of that, the part where AA also happens is A∩BA \cap B. So

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

In the Venn diagram below, BB is shaded: it is the new "whole". P(A∣B)=0.10.1+0.4=0.2P(A \mid B) = \frac{0.1}{0.1 + 0.4} = 0.2, while P(A)=0.4P(A) = 0.4. Knowing BB happened makes AA less likely, so AA and BB are not independent. In general, AA and BB are independent exactly when P(A∣B)=P(A)P(A \mid B) = P(A).

AB0.30.10.40.2given B: B becomes the whole space

Rearranging gives the multiplication rule, P(A∩B)=P(B)×P(A∣B)P(A \cap B) = P(B) \times P(A \mid B): this is exactly what you do when you multiply along a tree's branches, since the second branches are conditional probabilities.

Two-way tables are the easiest place to see it: "given smoker" means use only the smoker row. From the table, P(cough∣smoker)=1830=0.6P(\text{cough} \mid \text{smoker}) = \frac{18}{30} = 0.6, but P(cough∣non-smoker)=2790=0.3P(\text{cough} \mid \text{non-smoker}) = \frac{27}{90} = 0.3.

coughno coughtotalsmoker181230non-smoker276390total4575120P(cough | smoker) = 18/30

Worked example

A medical testtop gradeA level

A disease affects 2% of a population. A test gives a positive result for 95% of people with the disease, and for 10% of people without it. A person tests positive. Find the probability that they have the disease.

Show solution
  1. Set up the tree: first branch disease DD (0.02) or not D′D' (0.98); second branch positive ++ or negative.
  2. P(D∩+)=0.02×0.95=0.019P(D \cap +) = 0.02 \times 0.95 = 0.019. P(D′∩+)=0.98×0.10=0.098P(D' \cap +) = 0.98 \times 0.10 = 0.098.
  3. P(+)=0.019+0.098=0.117P(+) = 0.019 + 0.098 = 0.117 (add the two paths that end in "positive").
  4. P(D∣+)=P(D∩+)P(+)=0.0190.117=0.162P(D \mid +) = \frac{P(D \cap +)}{P(+)} = \frac{0.019}{0.117} = 0.162.

Only about 16% of people who test positive have the disease. Because the disease is rare, false positives from the large healthy group outnumber true positives. The question reversed the direction of the tree ("given positive" rather than "given disease"), which is the hallmark of a hard conditional probability question: always use the formula, don't read a branch.

Practise this topic

Both are part of Premium.