MATH U113 · Doubt clinic · topic page

Total probability and Bayes, with a tree

Cases that cannot overlap and cover everything; one product per route; add the routes; Bayes is one route over the sum. Notes: §2.4; deep dive: Tutorial 2 Q5; quiz Q1. Cards are collapsed — open one, or use the buttons. Newest at the bottom. Back to the clinic index.

Problem set Q13 · 14 SepFour boxes, one component drawnBoxes of different sizes and defect rates, a box chosen at random: P(defective) — the size decoy.
Q13 · problem set Box 1: 2000 components, 5% defective. Box 2: 500, 40% defective. Boxes 3 and 4: 1000 each, 10% defective. A box is chosen at random and one component drawn. P(defective)? (Key: 0.1625.)

Where this lives Notes §2.4 · total probability · Tutorial 2 Q5 from zero (tree) · Devore §2.4

The doubt, named

The box sizes are a decoy. "A box is chosen at random" means each of the four boxes has probability ¼, whatever it holds. The sizes would matter only if a component were drawn from all 4500 pooled — the twin below.

Step 1Tree: four branches of ¼, then the defect rate of that box

Every box is equally likely to be picked. The defective leaves add up.
P(D) = ¼(0.05) + ¼(0.40) + ¼(0.10) + ¼(0.10) = ¼ × 0.65 = 0.1625

Because the priors are all equal, the answer is simply the average of the four defect rates.

Classic traps

1) Weighting by box size. (100 + 200 + 100 + 100)/4500 = 0.111 answers a different experiment (one component from the pooled pile). 2) Counting boxes 3 and 4 once. There are four boxes; "two other boxes each contain…" gives two branches of ¼, not one of ½ — same number here by luck, but not in general.

Try the twin: all 4500 components are poured into one pile and one is drawn. P(defective)?

Defectives: 100 + 200 + 100 + 100 = 500 of 4500: 1/9 ≈ 0.11111. Now the sizes matter — this is the trap value, in the situation where it is right.

Problem set Q14 · 14 SepBall moved to box 2 and backP(red then red); P(box 1 ends as it began) — the eleven-ball denominator.
Q14 · problem set Box 1: 6 red, 4 green. Box 2: 7 red, 3 green. A ball is moved from box 1 to box 2; then a ball is moved from box 2 back to box 1. (a) P(red from box 1 and red from box 2)? (b) P(box 1 ends with the same red/green counts it started with)? (Key: 0.436, 0.581.)

Where this lives Notes §2.4 · multiplication rule, total probability · the two-bags slide below (same transfer) · Devore §2.4

The doubt, named

After the first move, box 2 has eleven balls and its colour split depends on what was moved. That is the whole difficulty: the second draw's probability changes with the first, so it is a tree with two levels, and (b) is a sum over two branches.

Step 1The tree, with box 2's contents written on each branch

Write the updated box 2 on each first-level branch before reading the second-level probabilities.

If a red goes to box 2, it holds 8R 3G (11 balls): a red comes back with probability 8/11. If a green goes, it holds 7R 4G: a green comes back with probability 4/11.

Step 2(a) one branch; (b) two branches

(a)  P(R1 ∩ R2) = 610 · 811 = 48110 = 2455 ≈ 0.43636

(b) Box 1 is unchanged exactly when the colour that comes back equals the colour that left: RR or GG. Disjoint branches — add:

P = 610 · 811 + 410 · 411 = 48 + 16110 = 3255 ≈ 0.58182

Check by adding all four leaves: RR 48 + RG 18 + GR 28 + GG 16 = 110 ✓. Re-adding the leaves is the two-second habit that catches a wrong second-level denominator.

Classic traps

1) Box 2 still has 10 balls. After the transfer it has 11; every second-level denominator is 11. 2) (b) as (a) only. "Unchanged" also happens via green-out, green-back. 3) Using box 2's original 7/10 for the return draw. The composition changed — that is the point of the problem.

Try the twin: P(the ball returned to box 1 is green)?

Green comes back via RG or GG: (6/10)(3/11) + (4/10)(4/11) = 18/110 + 16/110 = 34/110 = 17/55 ≈ 0.30909.

Problem set Q18 · 14 SepThree director candidates, new syllabusChances 4 : 2 : 3, syllabus probabilities 0.3, 0.5, 0.8: P(new syllabus); P(Z | new syllabus).
Q18 · problem set · key not visible in the photo, answers below are recomputed Three candidates for director, X, Y, Z, with chances in the ratio 4 : 2 : 3. If appointed, they would introduce a new syllabus with probabilities 0.3, 0.5, 0.8. (a) P(new syllabus)? (b) Given a new syllabus, P(Z was appointed)?

Where this lives Notes §2.4 · total probability, Bayes, prior/likelihood/posterior · Quiz post-mortem Q1 (same two steps) · Devore §2.4

The doubt, named

Two small things: turning a ratio into priors that add to 1, and recognising (b) as the reverse question — Bayes — whose denominator is the answer to (a).

Step 1Priors from the ratio

4 : 2 : 3 has total 9, so P(X) = 4/9, P(Y) = 2/9, P(Z) = 3/9. Likelihoods: P(N | X) = 0.3, P(N | Y) = 0.5, P(N | Z) = 0.8, where N = "new syllabus".

Three routes to a new syllabus. (a) adds them; (b) is Z's share of the sum.

Step 2(a) total probability, (b) Bayes

(a)  P(N) = 49(0.3) + 29(0.5) + 39(0.8) = 1.2 + 1.0 + 2.49 = 4.69 ≈ 0.51111
(b)  P(Z | N) = (3/9)(0.8)P(N) = 2.44.6 = 1223 ≈ 0.52174

Sanity: Z's prior was 1/3; the evidence (a new syllabus, which Z is most likely to bring) raised it to 0.52 ✓. The three posteriors 1.2/4.6, 1.0/4.6, 2.4/4.6 add to 1 ✓.

Classic traps

1) Using 4, 2, 3 as probabilities. Divide by 9 first; a "probability" above 1 in (a) is the alarm. 2) (b) as 0.8. That is P(N | Z); the question asks P(Z | N). 3) Dropping the 1/9 inconsistently. It cancels in (b) only if it is present in every term of the denominator.

Try the twin: given there is NO new syllabus, P(X was appointed)?

P(Nc) = 1 − 4.6/9 = 4.4/9. Numerator (4/9)(0.7) = 2.8/9. Posterior 2.8/4.4 = 7/11 ≈ 0.63636. X's prior 0.444 rose — X is the least likely to change the syllabus.

Lecture slides · 14 SepTwo slides: the strike; the two bagsP(completed on time) = 0.488 and P(black from bag 2) = 38/63 — why the products add.
Two lecture examples · total probability Strike. P(strike) = 0.65; P(on time | no strike) = 0.80; P(on time | strike) = 0.32. P(on time)? (Slide: 0.488.)
Two bags. Bag 1: 4W 3B; bag 2: 3W 5B. One ball moves from bag 1 to bag 2 unseen; then one is drawn from bag 2. P(black)? (Slide: 38/63.)

Where this lives Notes §2.4 · total probability · Q13, Q14, Q18 above are the same rule three more times · Devore §2.4

The doubt, named

Both slides use one rule and skip saying why it applies. The rule: if the world splits into cases that cannot both happen and cover everything (strike / no strike; white moved / black moved), then P(event) = Σ P(case) · P(event | case). Each product is one route through the tree; routes through different cases are disjoint, so they add.

Step 1Strike: two cases, two routes

The slide's line P(A) = P(B)P(A|B) + P(B′)P(A|B′) is these two routes added.

The cases are "strike" and "no strike" — one of them must happen, never both. P(on time) = 0.65 × 0.32 + 0.35 × 0.80 = 0.208 + 0.280 = 0.488. Note the 0.35 is not on the slide's data list; it is 1 − 0.65 — the complement inside the same case.

Step 2Two bags: the cases are what was moved

Before drawing from bag 2 you do not know its contents; they depend on the unseen transfer. Cases: white moved (4/7) → bag 2 is 4W 5B, black with probability 5/9; black moved (3/7) → bag 2 is 3W 6B, black with probability 6/9.

P(black from bag 2) = 47 · 59 + 37 · 69 = 20 + 1863 = 3863 ≈ 0.60317

Sanity: bag 2 started 5/8 = 0.625 black; adding one ball from a whiter bag should pull that down a little — 0.603 ✓. And Q14 is this exact problem with a second transfer.

Classic traps

1) Cases that are not exhaustive. If your cases don't cover every possibility, the products don't add up to P(event). 2) Forgetting bag 2 now has 9 balls. Same slip as Q14's eleven. 3) Using the "if" the wrong way round. "0.80 that the job is completed on time if there is no strike" is P(on time | no strike); the thing after "if" goes right of the bar.

Try the twin (Bayes on the strike slide): the job was completed on time. P(there was a strike)?

P(B | A) = 0.208/0.488 ≈ 0.42623 — down from the prior 0.65, because on-time completion is more typical of the no-strike world.