MATH U113 · Tutorial companion · deep dive
Two Tutorial 2 problems, from zero
Q5 (the impurity test: Bayes after three experiments) and Q6 (the birthday problem), Devore §2.3–2.5, rebuilt one idea at a time. For when the hint and the compressed solution on the tutorial page aren't enough. Budget 45–60 minutes, pencil out, every green box attempted before you open it.
Neither question uses a fact you haven't met. Q5 stacks three Module 1 ideas — independence (§2.5), "exactly two of three" counted by listing sequences (§2.3), and Bayes (§2.4) — and hides the middle one: the sheet gives you per-test probabilities, but Bayes needs the probability of the whole three-test result. Q6 stacks two — the product rule (§2.3) and the complement trick (§2.2) — then asks you to repeat one calculation until a number crosses 0.5. Stacking is what makes them feel new; the pieces are old.
One more honest fact. Q5 uses the words prior and posterior. The Module 1 pages did not define them until today (they do now, notes §2.4). If those two words stopped you cold, that was a vocabulary gap, not a maths gap — and it's fixed in the first step below.
Q5 · The impurity test §2.4–2.5
Step 1Translate every sentence into a symbol before computing anything
Word problems in this chapter are lost or won at translation. Two events describe the truth: Pr = "impurity present", Ab = "impurity absent". Two describe one experiment's result: D = "detects", N = "does not detect". Now read the sheet one sentence at a time. The rule: whatever follows "if" or "given" goes to the right of the bar.
| The sheet says | Symbol | Value |
|---|---|---|
| prior probability of the impurity being present is 0.40 | P(Pr) | 0.40 |
| … being absent is 0.60 | P(Ab) | 0.60 |
| probability 0.80 of detecting the impurity if it is present | P(D | Pr) | 0.80 |
| (so, not detecting when present — the complement inside the same world) | P(N | Pr) | 0.20 |
| probability of not detecting the impurity if it is absent is 0.90 | P(N | Ab) | 0.90 |
| (so, a false alarm — detecting when absent) | P(D | Ab) | 0.10 |
| three separate experiments result in only two detections | the data, E = "exactly 2 of the 3 results are D" | ? |
| posterior probability that the impurity is present | wanted: P(Pr | E) | ? |
Prior = your probability for the truth before seeing data: P(Pr) = 0.4. Likelihood = how probable the data would be if a given truth held: P(E | Pr) and P(E | Ab). Posterior = your probability for the truth after the data: P(Pr | E). Bayes' theorem is the machine that takes priors and likelihoods in and returns the posterior. The question hands you the priors and the per-test numbers; you must build the likelihoods — that is Step 2, and it is the step the compressed solution skipped.
The sheet gives the non-detection rate when the impurity is absent. The number Bayes will need is the false-alarm rate P(D | Ab) = 1 − 0.90 = 0.10. Reading 0.90 as "the probability of detecting when absent" flips the whole problem. When a sentence has a "not" in it, write both the event and its complement in the table, as above.
Step 2Build the likelihood of the data — three tests, not one
Bayes needs P(E | Pr): if the impurity is present, how likely is it that exactly two of three experiments detect it? Nothing in the sheet states this number. We build it from two ideas.
Idea 1 — independence lets you multiply. "Three separate experiments" means: given the truth, each experiment's result does not affect the others. For independent events, the probability that all of them happen is the product of their probabilities (§2.5). So the probability of any specific sequence of three results is a product of three per-test numbers. If the impurity is present, the sequence "detect, detect, no-detect" (write it DDN) has probability
Unpack this step · why the 0.2 is there
The third experiment happened, and it produced "no detection" — an event whose probability (given present) is 0.2. Leave it out and 0.8 × 0.8 = 0.64 is the probability that the first two detect and the third does anything at all — a different, larger event. Every experiment that ran contributes one factor.
Idea 2 — "exactly two detections" is several sequences, so list them. Three experiments, each D or N: by the product rule there are 2 × 2 × 2 = 8 possible sequences. Write them down in a fixed order (the systematic-listing habit from the prerequisite kit) and mark the ones with exactly two D's:
Three sequences have exactly two D's: DDN, DND, NDD (the N can sit in any one of the three positions — that "3" is C(3, 1) = C(3, 2) = 3, if you like the formula; listing is just as good here). Order doesn't change a product, so each of the three has the same probability. And they are mutually exclusive — the three tests produce one sequence, not two — so the addition rule for disjoint events applies:
Same construction in the other world. If the impurity is absent, a detection is a false alarm with probability 0.1 and a non-detection has probability 0.9:
Check before moving on. In each row of the figure, the eight probabilities add to 1: 0.512 + 3(0.128) + 3(0.032) + 0.008 = 1 and 0.001 + 3(0.009) + 3(0.081) + 0.729 = 1. If your factors are wrong, this check fails — it is the one-line audit for this kind of counting.
"Exactly k successes in n independent tries, each with success probability p" has the general formula C(n, k) pk (1 − p)n−k — the binomial distribution of Module 2 §3.4. Here C(3, 2) · 0.8² · 0.2 = 0.384. You do not need the formula for Q5; you need the reasoning it compresses, which is exactly Ideas 1 and 2. When §3.4 arrives, the formula will look like an old friend.
Check yourself: what is P(exactly one detection | Pr)? And P(exactly one detection | Ab)?
One D in three positions: DNN, NDN, NND. Present: each is 0.8 × 0.2 × 0.2 = 0.032, total 3 × 0.032 = 0.096. Absent: each is 0.1 × 0.9 × 0.9 = 0.081, total 0.243. Notice: one detection is more likely when the impurity is absent (0.243) than when present (0.096) — a fact Step 5 uses.
Step 3Now Bayes, exactly as in the notes
The data E can happen "via" two mutually exclusive routes — the impurity is present, or it is absent — and those two routes cover everything. That is the setting for total probability and Bayes (notes §2.4). Multiply along each route:
| Route | prior | likelihood of E | product (joint) |
|---|---|---|---|
| impurity present, then exactly 2 of 3 detect | 0.40 | 0.384 | 0.40 × 0.384 = 0.1536 |
| impurity absent, then exactly 2 of 3 detect | 0.60 | 0.027 | 0.60 × 0.027 = 0.0162 |
| Total probability of seeing this data, P(E) | 0.1698 | ||
Bayes is the share of the data-world that belongs to the "present" route:
Answer: the posterior probability that the impurity is present is 0.1536/0.1698 = 0.9046, i.e. about 0.905 (to the quiz's five decimals: 0.90459).
Unpack this step · the same thing with 10,000 batches
Imagine 10,000 batches. Present in 4,000; of those, 0.384 × 4,000 = 1,536 would show exactly two detections. Absent in 6,000; of those, 0.027 × 6,000 = 162 would. So 1,698 batches look like ours, and 1,536 of them have the impurity: 1536/1698 = 0.905. Same arithmetic, no formula.
Step 4The picture that turns Bayes into an area
The tree is the exam tool. This second picture is for understanding why the answer is so lopsided. Draw a square for "all batches". Split its width by the prior: 0.4 of it is "present", 0.6 is "absent". In each column, shade a height equal to the likelihood — the fraction of those batches that would show exactly two detections.
The absent column is wider (0.6 versus 0.4), but its shading is a sliver: two detections out of three is a rare event when the impurity is absent. In numbers, the data is 0.384/0.027 ≈ 14 times more likely under "present" than under "absent", and that factor of 14 overwhelms the prior's 0.6 : 0.4 lean towards "absent". That is all Bayes ever does: start from the prior areas, keep only the part consistent with the data, re-normalise.
Step 5Read the answer — don't just report it
Exams increasingly ask "interpret". Rerunning Steps 2–3 for every possible number of detections shows what the three experiments can and can't tell the engineer:
| detections in 3 | P(data | Pr) | P(data | Ab) | Bayes | posterior P(Pr | data) |
|---|---|---|---|---|
| 0 | 0.008 | 0.729 | 0.0032 / (0.0032 + 0.4374) | 0.007 |
| 1 | 0.096 | 0.243 | 0.0384 / (0.0384 + 0.1458) | 0.208 |
| 2 | 0.384 | 0.027 | 0.1536 / (0.1536 + 0.0162) | 0.905 |
| 3 | 0.512 | 0.001 | 0.2048 / (0.2048 + 0.0006) | 0.997 |
Two things to say in an exam answer: the evidence raised the probability from 0.40 to 0.905, and it did so because two-of-three is about fourteen times likelier with the impurity than without. Note also the one-detection row from your check box: a single detection would have lowered the engineer's belief to 0.21 — knowing the data can point either way is the mark of understanding Bayes rather than executing it.
1) Reading 0.90 as P(D | Ab). It is P(N | Ab); the false-alarm rate is 0.10. Whatever follows "if" is the condition. 2) Using 0.8² = 0.64 for "two detections". That forgets the third test's non-detection factor (×0.2) and the three orderings (×3). Two detections in three tests means 3 × 0.8 × 0.8 × 0.2. 3) Dropping the priors. 0.384/(0.384 + 0.027) = 0.934 answers a different question — one where present and absent were equally likely to begin with. 4) Stopping at the likelihood. 0.384 is P(data | present), not P(present | data); the arrow points the wrong way. Bayes exists precisely to turn it around. 5) Rounding early. Carry 0.1536 and 0.0162 exactly; round once, at the end (the quiz wants five decimals: 0.90459).
Q6 · The birthday problem §2.2–2.4
Step 1Say the model out loud
Each person's birthday is one of 365 days, each with probability 1/365 ("equally likely"), and one person's birthday tells you nothing about another's ("randomly selected" — no twins in the sample). Dropping 29 February just makes the day count exactly 365 with all days equal. The outcome for k people is an ordered list of k days: (person 1's day, person 2's day, …). By the product rule there are 365 × 365 × ⋯ × 365 = 365k such lists, and because every day is equally likely for every person, the lists are equally likely. That last sentence is what licenses "favourable over total" (§2.2 trap 2 on the notes page: check equal likelihood before you count).
Step 2"At least two share" is a mess; its complement is one clean case
Try to count "at least two share a birthday" directly and you meet cases: exactly one pair shares; two different pairs; three people on one day; a pair and a triple; … The complement, "all k birthdays are different", is a single case with a clean count. So we compute that and subtract:
This is the same move as Tutorial 1 Q10 and the parallel-system rule in §2.5: whenever the question says "at least one", price the "none" event and take the complement.
Step 3Two ways to price "all different" — and they agree
View 1, counting (§2.3). Build a favourable list one person at a time. Person 1 may have any of 365 days. Person 2 must avoid that day: 364 choices. Person 3 must avoid both: 363. … Person 10 must avoid nine taken days: 356. Product rule: 365 × 364 × ⋯ × 356 favourable lists (a permutation, P10,365 in Devore's notation). Over 36510 equally likely lists:
View 2, a chain of conditional probabilities (§2.4). Pair each numerator factor with a denominator factor and the same fraction becomes a product of ten simple ones:
Read left to right, this is the multiplication rule applied nine times: the second person differs from the first with probability 364/365; given the first two differ, the third avoids both taken days with probability 363/365; and so on — the j-th new person must avoid j − 1 taken days, probability (365 − (j − 1))/365. Each factor lives in the world where everyone before already differs. Both views give the same number; View 2 is the one to compute with, because it never asks your calculator for 36510.
| person added | factor | running product = P(all different so far) | 1 − product |
|---|---|---|---|
| 1 | 365/365 = 1.00000 | 1.00000 | 0.00000 |
| 2 | 364/365 = 0.99726 | 0.99726 | 0.00274 |
| 3 | 363/365 = 0.99452 | 0.99180 | 0.00820 |
| 4 | 362/365 = 0.99178 | 0.98364 | 0.01636 |
| 5 | 361/365 = 0.98904 | 0.97286 | 0.02714 |
| 6 | 360/365 = 0.98630 | 0.95954 | 0.04046 |
| 7 | 359/365 = 0.98356 | 0.94376 | 0.05624 |
| 8 | 358/365 = 0.98082 | 0.92566 | 0.07434 |
| 9 | 357/365 = 0.97808 | 0.90538 | 0.09462 |
| 10 | 356/365 = 0.97534 | 0.88305 | 0.11695 |
Answer (a): P(all ten different) ≈ 0.883, so P(at least two share) = 1 − 0.883 ≈ 0.117.
Unpack this step · how to do it on a calculator without tears
Chain the fractions: type 364 ÷ 365 × 363 ÷ 365 × 362 ÷ 365 … and press = at the end, or after each pair to see the running product fall. Never compute 36510 ≈ 4.2 × 1025 and 365!/355! separately and divide — you lose digits and gain nothing. The running product also sanity-checks itself: it must stay in [0, 1] and only decrease.
Check yourself: with 12 months instead of 365 days, what is P(at least two of 4 people share a birth month)?
Chain: (12/12)(11/12)(10/12)(9/12) = 990/1728 ≈ 0.573 all different, so at least two share ≈ 0.427. Counting view: 12 · 11 · 10 · 9 = 11,880 favourable over 124 = 20,736 — same 0.573. Four people, 12 categories, and already a 43% chance of a shared month: the same effect the 365-day version shows more slowly.
Step 4Part (b): keep multiplying until the complement crosses one half
"At least a 50–50 chance that two or more share" means 1 − P(all different) ≥ 0.5, i.e. the running product has fallen to 0.5 or below. There is no algebra that solves this for k in one line — the honest method is to continue the chain and watch:
| k | P(all different) | P(at least two share) | ≥ 0.5? |
|---|---|---|---|
| 10 | 0.88305 | 0.11695 | not yet |
| 15 | 0.74710 | 0.25290 | not yet |
| 20 | 0.58856 | 0.41144 | not yet |
| 21 | 0.55631 | 0.44369 | not yet |
| 22 | 0.52430 | 0.47570 | not yet |
| 23 | 0.49270 | 0.50730 | ✓ first time ≥ 0.5 |
| 24 | 0.46166 | 0.53834 | |
| 25 | 0.43130 | 0.56870 | |
| 30 | 0.29368 | 0.70632 |
Answer (b): at k = 22 the chance is 0.476 — not yet 50–50. At k = 23 it is 0.507. So the smallest such k is 23. (Whether you read "at least 50–50" as ≥ 0.5 or > 0.5 makes no difference here; write the reading you took anyway.)
Move the slider: the readout gives the exact running product for that k, and "Simulate one room" draws k random birthdays on a 365-day calendar strip and flags any day hit twice. Run twenty rooms at k = 23 and about half of them will show a shared birthday — the long-run relative frequency settling on the computed probability, exactly as in §2.2.
Step 5Why 23 is so small — the pairs intuition
Twenty-three feels far too few for a 365-day year because the mind pictures 23 chances of a match. But a shared birthday happens between a pair of people, and 23 people form C(23, 2) = 253 pairs. Each pair matches with probability 1/365; 253 pairs each with a 1-in-365 chance means you'd expect about 253/365 ≈ 0.69 matching pairs in the room. Once the expected number of matches is around 0.7, a room with at least one match being a coin flip is no longer surprising. (This is intuition, not a computation of the answer — pairs share people and are not independent, so adding pair probabilities overcounts; the chain in Steps 3–4 is the exact method.)
1) Answering a different question: "someone shares my birthday" is 1 − (364/365)k−1 — only 0.059 for k = 23, and it needs 254 people to reach 50–50. The grey dashed curve in the widget is this question; the sheet asks about any two people. 2) Adding pair probabilities, C(k, 2)/365: it overcounts rooms with two matches. At k = 10 it gives 0.123 against the true 0.117 (close, which is how it fools people); at k = 23 it gives 0.69 against 0.507. 3) Computing 36510 and 365 · … · 356 separately. Chain the fractions instead. 4) Stopping at "all different". Part (a) asks for both numbers; part (b) is about the complement — read which one the sentence wants.
What the two questions teach
Bayes with a hidden likelihood. When the "data" is a compound event — exactly k of n tests, a run of results, a sum — no sheet will hand you P(data | hypothesis). Build it first (independence → multiply within a sequence; disjoint sequences → add), then run Bayes as usual. Last year's Quiz 1 Q1(ii) was exactly this pattern, so expect it to recur.
"At least" → complement → a chain of shrinking fractions. "At least two share", "at least one defective", "at least one works" — price the "none / all different" event as a product and subtract from 1. When the question then asks for a threshold ("smallest k such that…"), tabulate the running product; there is no algebraic shortcut, and that is fine.
Both patterns are now in the Module 1 notes (§2.4 for the vocabulary and the compound-evidence rule, §2.5 for repeated independent trials and the all-different chain), and the practice drill's "tree-Bayes" family generates fresh Q5-shaped problems.
"Give me a Devore §2.4–2.5 problem where the evidence is 'exactly k of n' independent tests with a prior over two hypotheses, different numbers from the impurity problem. Don't solve it. After I post my two likelihoods, check those first — then check my posterior."
"Give me three 'at least two share' problems with categories other than 365 days (dice faces, months, floors of a building). I'll compute each by chaining fractions and show the running product; tell me where I go wrong, not the answer."
Recompute any final decimal an AI gives you; confident arithmetic slips are common.