{"base":{"id":"alcm-35-05","subject":"Combined Maths","title":"Bayes' theorem","scene":"alcm","steps":[{"mode":"fig","work":{"title":"Write it like this","lines":["P(A ∩ B) = P(A | B)P(B) = P(B | A)P(A)",{"t":"P(Aᵢ | B) = P(B | Aᵢ)P(Aᵢ) / Σⱼ P(B | Aⱼ)P(Aⱼ)","note":"general form"},"the denominator is the total probability of B"]},"say":["Tap for the theorem.","Two ways to write \"and\".","General form.","The bottom line."],"actions":[{"id":"step","label":"Show the next step"}],"eyebrow":"The theorem","title":"Turning a condition round","body":"Bayes’ theorem finds P(A | B) from P(B | A): P(A | B) = P(B | A)P(A)/P(B), with P(B) from the law of total probability."},{"mode":"fig","work":{"title":"Write it like this","lines":["P(F) = 0.6 × 0.02 + 0.4 × 0.05","= 0.012 + 0.020 = 0.032",{"t":"P(A | F) = 0.012/0.032 = 0.375","note":"A makes more, yet is less likely to blame"}]},"say":["Tap to solve.","Total faulty.","Add.","Bayes."],"actions":[{"id":"step","label":"Show the next step"}],"eyebrow":"Machines","title":"Which machine made the faulty item?","body":"Machine A makes 60% of items with 2% faulty; machine B makes 40% with 5% faulty. An item is faulty. Find the probability A made it."},{"mode":"plot","controls":[{"id":"p","label":"prevalence p","min":0.005,"max":0.3,"step":0.005,"value":0.01},{"id":"f","label":"false positive f","min":0.01,"max":0.2,"step":0.01,"value":0.05}],"view":[0,-0.05,0.31,1.05],"axes":{"xs":0.05,"ys":0.2,"xl":"p","yl":"P"},"fns":[{"e":"0.95*x/(0.95*x+f*(1-x))","col":"b","from":0.001}],"pts":[{"x":"p","y":"0.95*p/(0.95*p+f*(1-p))","col":"r"}],"ptitle":"Bayes for a test","rows":["p = {p|3},  f = {f|2}",["P(+) = {0.95*p+f*(1-p)|4}","k"],["P(disease | +) = {0.95*p/(0.95*p+f*(1-p))|3}","r"],["P(healthy | −) = {0.95*(1-p)/(0.95*(1-p)+0.05*p)|4}","b"]],"note":"With p = 1% and f = 5%, only about 16% of positives have the disease: most positives are false alarms.","st":"P(D | +) = {0.95*p/(0.95*p+f*(1-p))|3}","eyebrow":"Explore","title":"A positive medical test","body":"A disease affects a fraction p of people. The test detects it 95% of the time but wrongly says \"positive\" for f of healthy people. The curve shows P(disease | positive)."},{"mode":"fig","work":{"title":"Write it like this","lines":["P(D ∩ +) = 0.01 × 0.95 = 0.0095","P(D′ ∩ +) = 0.99 × 0.05 = 0.0495","P(+) = 0.059",{"t":"P(D | +) = 0.0095/0.059 ≈ 0.161","note":"about 1 in 6"}]},"say":["Tap to work it out.","True positives.","False positives.","All positives.","Bayes."],"actions":[{"id":"step","label":"Show the next step"}],"eyebrow":"Working","title":"The test numbers, step by step","body":"p = 0.01, sensitivity 0.95, false positive rate 0.05. Use a tree, then divide the \"disease and positive\" branch by all positive branches."},{"mode":"quiz","look":"fig","fig":{"view":[0,0,10,10],"items":[{"k":"txt","p":[5,5],"t":"P(A | B) = ?","size":84,"col":"v","max":1400}]},"eyebrow":"Check yourself","title":"Bayes","body":"Divide the branch by the total.","question":"P(A) = 0.5, P(B | A) = 0.6, P(B | A′) = 0.2. P(A | B) = ?","options":["0.6","0.75","0.3"],"answer":1,"right":"Correct. 0.3/0.4.","wrong":"Not quite. P(B) = 0.3 + 0.1 = 0.4."}],"more":[{"type":"cards","id":"detail","eyebrow":"The ideas in detail","title":"Bayes in detail","items":[{"tag":"Prior and posterior","title":"Updating beliefs","body":"P(A) is the prior (before the evidence B); P(A | B) is the posterior (after). Bayes’ theorem updates the prior using the evidence."},{"tag":"Many causes","title":"Three machines","body":"With three causes A₁, A₂, A₃, compute each P(B | Aᵢ)P(Aᵢ), add them for P(B), then divide each by the sum. The posteriors add to 1."},{"tag":"Why it surprises","title":"Base rates matter","body":"When the condition is rare, even a good test gives many false positives, because healthy people vastly outnumber sick ones."}]},{"type":"cards","id":"ideas","eyebrow":"Marks lost in the exam","title":"Common mistakes","items":[{"tag":"Common mistake","title":"Confusing P(A | B) with P(B | A)","body":"P(positive | disease) = 0.95 does not mean P(disease | positive) = 0.95."},{"tag":"Common mistake","title":"Forgetting a branch in P(B)","body":"P(B) must include every route to B, including the A′ branches."}]},{"type":"quiz","id":"quiz","eyebrow":"Go further","title":"Thirty questions: easy, medium, hard","questions":[{"level":"easy","question":"Bayes' theorem: P(A | B) = ?","options":["P(A)P(B)","P(B | A)P(A)/P(B)","P(B | A)/P(A)"],"answer":1,"right":"Correct. Bayes basics.","wrong":"Not quite. Swap the condition using P(A ∩ B)."},{"level":"easy","question":"The denominator P(B) is found by…","options":["the law of total probability","P(A) alone","subtraction"],"answer":0,"right":"Correct. Bayes basics.","wrong":"Not quite. Swap the condition using P(A ∩ B)."},{"level":"easy","question":"P(A) before evidence is called…","options":["the posterior","the prior","the likelihood"],"answer":1,"right":"Correct. Bayes basics.","wrong":"Not quite. Swap the condition using P(A ∩ B)."},{"level":"easy","question":"P(A | B) after evidence B is…","options":["the prior","zero","the posterior"],"answer":2,"right":"Correct. Bayes basics.","wrong":"Not quite. Swap the condition using P(A ∩ B)."},{"level":"easy","question":"P(B | A) is generally… P(A | B)","options":["equal to","not equal to","double"],"answer":1,"right":"Correct. Bayes basics.","wrong":"Not quite. Swap the condition using P(A ∩ B)."},{"level":"easy","question":"Two boxes chosen with equal chance: box 1 has 3 red, 1 blue; box 2 has 1 red, 3 blue. A red ball is drawn. P(red)?","options":["1/2","3/4","1/4"],"answer":0,"right":"Correct. Branch probability ÷ total probability of the evidence.","wrong":"Not quite. P(red) = ½·¾ + ½·¼."},{"level":"easy","question":"Two boxes chosen with equal chance: box 1 has 3 red, 1 blue; box 2 has 1 red, 3 blue. A red ball is drawn. P(box 1 | red)?","options":["1/2","3/8","3/4"],"answer":2,"right":"Correct. Branch probability ÷ total probability of the evidence.","wrong":"Not quite. P(red) = ½·¾ + ½·¼."},{"level":"easy","question":"Two boxes chosen with equal chance: box 1 has 3 red, 1 blue; box 2 has 1 red, 3 blue. A red ball is drawn. P(box 2 | red)?","options":["1/2","1/8","1/4"],"answer":2,"right":"Correct. Branch probability ÷ total probability of the evidence.","wrong":"Not quite. P(red) = ½·¾ + ½·¼."},{"level":"easy","question":"Two boxes chosen with equal chance: box 1 has 3 red, 1 blue; box 2 has 1 red, 3 blue. A red ball is drawn. P(red ∩ box 1)?","options":["3/8","3/4","1/2"],"answer":0,"right":"Correct. Branch probability ÷ total probability of the evidence.","wrong":"Not quite. P(red) = ½·¾ + ½·¼."},{"level":"easy","question":"Two boxes chosen with equal chance: box 1 has 3 red, 1 blue; box 2 has 1 red, 3 blue. A red ball is drawn. If a blue ball were drawn, P(box 2 | blue)?","options":["1/4","3/4","1/2"],"answer":1,"right":"Correct. Branch probability ÷ total probability of the evidence.","wrong":"Not quite. P(red) = ½·¾ + ½·¼."},{"level":"medium","question":"Machines A, B, C make 50%, 30%, 20% with 1%, 2%, 3% faulty. P(faulty)?","options":["0.017","0.02","0.06"],"answer":0,"right":"Correct. Compute each branch, sum for the denominator.","wrong":"Not quite. P(C | F) = 0.2·0.03/0.017."},{"level":"medium","question":"…P(A | faulty)?","options":["0.5","0.01","0.294"],"answer":2,"right":"Correct. Compute each branch, sum for the denominator.","wrong":"Not quite. P(C | F) = 0.2·0.03/0.017."},{"level":"medium","question":"…P(C | faulty)?","options":["0.2","0.03","0.353"],"answer":2,"right":"Correct. Compute each branch, sum for the denominator.","wrong":"Not quite. P(C | F) = 0.2·0.03/0.017."},{"level":"medium","question":"A disease affects 2%; test detects 90% of cases with 5% false positives. P(positive)?","options":["0.067","0.95","0.018"],"answer":0,"right":"Correct. Compute each branch, sum for the denominator.","wrong":"Not quite. P(C | F) = 0.2·0.03/0.017."},{"level":"medium","question":"…P(disease | positive)?","options":["0.9","0.269","0.02"],"answer":1,"right":"Correct. Compute each branch, sum for the denominator.","wrong":"Not quite. P(C | F) = 0.2·0.03/0.017."},{"level":"medium","question":"P(A) = 0.3, P(B | A) = 0.8, P(B | A′) = 0.4. P(B)?","options":["1.2","0.24","0.52"],"answer":2,"right":"Correct. P(A | B) = P(A ∩ B)/P(B).","wrong":"Not quite. Draw the tree."},{"level":"medium","question":"…P(A | B)?","options":["0.8","0.462","0.3"],"answer":1,"right":"Correct. P(A | B) = P(A ∩ B)/P(B).","wrong":"Not quite. Draw the tree."},{"level":"medium","question":"…P(A | B′)?","options":["0.2","0.125","0.3"],"answer":1,"right":"Correct. P(A | B) = P(A ∩ B)/P(B).","wrong":"Not quite. Draw the tree."},{"level":"medium","question":"A student guesses on a 4-option question with probability 0.4, else knows the answer. Correct answer given. P(guessed)?","options":["0.143","0.4","0.25"],"answer":0,"right":"Correct. P(A | B) = P(A ∩ B)/P(B).","wrong":"Not quite. Draw the tree."},{"level":"medium","question":"In Bayes problems, a tree diagram helps to…","options":["avoid fractions","find every path to the evidence","guess"],"answer":1,"right":"Correct. P(A | B) = P(A ∩ B)/P(B).","wrong":"Not quite. Draw the tree."},{"level":"hard","question":"A test for a disease with prevalence 0.1%: sensitivity 99%, false positive 1%. P(disease | positive) ≈ ?","options":["0.99","0.090","0.5"],"answer":1,"right":"Correct. Apply Bayes step by step with a tree.","wrong":"Not quite. Base rates strongly affect the answer."},{"level":"hard","question":"…after a second independent positive test, P(disease) ≈ ?","options":["0.907","0.99","0.18"],"answer":0,"right":"Correct. Apply Bayes step by step with a tree.","wrong":"Not quite. Base rates strongly affect the answer."},{"level":"hard","question":"Three urns (equal chance): U1 2W 3B, U2 3W 2B, U3 4W 1B. A white is drawn. P(U3 | white)?","options":["1/3","4/5","4/9"],"answer":2,"right":"Correct. Apply Bayes step by step with a tree.","wrong":"Not quite. Base rates strongly affect the answer."},{"level":"hard","question":"A coin is chosen from a fair coin and a coin with P(H) = 3/4; two heads are seen. P(biased coin)?","options":["9/13","3/4","1/2"],"answer":0,"right":"Correct. Apply Bayes step by step with a tree.","wrong":"Not quite. Base rates strongly affect the answer."},{"level":"hard","question":"If P(B | A) = 1 and P(A) = 0.2, P(B) = 0.5, then P(A | B) = ?","options":["0.4","0.2","1"],"answer":0,"right":"Correct. Apply Bayes step by step with a tree.","wrong":"Not quite. Base rates strongly affect the answer."},{"level":"hard","question":"Bayes with equally likely causes reduces to…","options":["equal posteriors","zero","comparing the likelihoods P(B | Aᵢ)"],"answer":2,"right":"Correct. Apply Bayes step by step with a tree.","wrong":"Not quite. Base rates strongly affect the answer."},{"level":"hard","question":"Rain is forecast; P(rain) = 0.3. Forecast is correct 80% of the time either way. Forecast says rain. P(rain)?","options":["0.8","0.632","0.3"],"answer":1,"right":"Correct. Apply Bayes step by step with a tree.","wrong":"Not quite. Base rates strongly affect the answer."},{"level":"hard","question":"The posterior probabilities over all causes sum to…","options":["1","0","P(B)"],"answer":0,"right":"Correct. Apply Bayes step by step with a tree.","wrong":"Not quite. Base rates strongly affect the answer."},{"level":"hard","question":"If evidence B is equally likely under all causes, posteriors equal…","options":["zero","1/2","the priors"],"answer":2,"right":"Correct. Apply Bayes step by step with a tree.","wrong":"Not quite. Base rates strongly affect the answer."},{"level":"hard","question":"P(A | B) > P(A) means B makes A…","options":["less likely","more likely","impossible"],"answer":1,"right":"Correct. Apply Bayes step by step with a tree.","wrong":"Not quite. Base rates strongly affect the answer."}]},{"type":"keywords","id":"words","title":"Key words","items":[{"word":"Bayes' theorem","meaning":"P(A | B) = P(B | A)P(A)/P(B)."},{"word":"Prior","meaning":"Probability before evidence."},{"word":"Posterior","meaning":"Probability after evidence."},{"word":"Sensitivity","meaning":"P(positive | disease)."},{"word":"False positive","meaning":"A positive result for a healthy person."},{"word":"Base rate","meaning":"How common a condition is."}]},{"type":"checklist","id":"check","title":"I can…","items":["state and prove Bayes' theorem","find which cause most likely produced an outcome","interpret test results using base rates"]},{"type":"sources","id":"sources","title":"Sources","items":["NIE Sri Lanka, G.C.E. (A/L) Combined Mathematics syllabus, Grade 12 and 13, 2017 (competency level II 4.5)."]}],"slug":"bayes-theorem"},"overlay":null}