Bayes Theorem


Bayes Theorem

Corey
Hey Maria, have you ever heard of Bayes' theorem? I was watching this video about it and it seems super useful for probability.

Maria
Yeah, I've come across it! It's all about reversing conditional probabilities, right? Like finding the probability of a cause given an effect?

Corey
Exactly! The video started with a simple idea: if you have an event A that depends on several mutually exclusive events B1, B2, ..., Bn, you can find P(A) by summing P(Bi)*P(A|Bi). That's the law of total probability.

Maria
Right, and then Bayes' theorem lets you flip it: given that A happened, what's the probability it was caused by a specific Bi? So P(Bi|A) = P(Bi)*P(A|Bi) / P(A).

Corey
The video used a great example: a company gets bolts from three vendors. Vendor A supplies 30%, B supplies 40%, and C supplies 30%. Their defect rates are 2%, 3%, and 5% respectively.

Maria
So if you pick a random bolt and it's defective, you can find the probability it came from each vendor using Bayes. First, you need the total probability of a defective bolt, which is 0.3*0.02 + 0.4*0.03 + 0.3*0.05 = 0.033.

Corey
Then for vendor A, P(A|defective) = (0.3*0.02)/0.033 = 0.006/0.033 = 6/33. Similarly for B: 0.012/0.033 = 12/33, and for C: 0.015/0.033 = 15/33. They all add up to 1.

Maria
That makes sense. The video also had a neat example about professors. Three candidates X, Y, Z have promotion chances in ratio 4:2:3, so P(X)=4/9, P(Y)=2/9, P(Z)=3/9.

Corey
And if selected, they'd introduce a new subject with probabilities 0.35, 0.52, and 0.80 respectively. So the overall probability of a new subject is (4/9)*0.35 + (2/9)*0.52 + (3/9)*0.80 = 4.84/9 ≈ 0.5378.

Maria
That's total probability again. But then they asked: given a new subject was introduced, what's the probability it was introduced by X? That's a Bayes problem.

Corey
Yeah, you'd do P(X|new) = (4/9 * 0.35) / (4.84/9) = 1.4/4.84 ≈ 0.289. But the video didn't go into that—they just computed the total probability.

Maria
Another fun one was about three boxes. Box 1: 1 white, 2 red, 3 black. Box 2: 2 white, 3 red, 1 black. Box 3: 3 white, 1 red, 2 black. A box is chosen randomly, then two balls are drawn and they are one red and one white.

Corey
So you want the probability that the balls came from Box 1. First, the probability of drawing one red and one white from each box: For Box 1, it's (2C1 * 1C1)/6C2 = 2/15. Box 2: (3C1 * 2C1)/15 = 6/15. Box 3: (1C1 * 3C1)/15 = 3/15.

Maria
Then by Bayes, P(Box1|red&white) = (1/3 * 2/15) / [ (1/3)*(2/15 + 6/15 + 3/15) ] = (2/45) / (11/45) = 2/11.

Corey
Nice. Then there was a bridge collapse example. The chance of faulty design is 10%, and if design is faulty, collapse probability is 95%. If material is inferior (90% chance), collapse probability is 45%. Given the bridge collapsed, find chance it was due to faulty design.

Maria
So P(faulty design) = 0.1, P(inferior material) = 0.9. P(collapse|faulty) = 0.95, P(collapse|inferior) = 0.45. Then P(collapse) = 0.1*0.95 + 0.9*0.45 = 0.095 + 0.405 = 0.5. Then P(faulty design|collapse) = (0.1*0.95)/0.5 = 0.095/0.5 = 0.19.

Corey
And the last example: three true coins and one false coin (heads on both sides). A coin is chosen randomly and tossed four times, all heads. What's the probability it was the false coin?

Maria
P(true) = 3/4, P(false) = 1/4. For a true coin, P(4 heads) = 1/16. For the false coin, it's 1 (always heads). So P(4 heads) = (3/4)*(1/16) + (1/4)*1 = 3/64 + 16/64 = 19/64. Then P(false|4 heads) = (1/4 * 1) / (19/64) = (1/4)*(64/19) = 16/19.

Corey
That's a pretty high probability—almost 84%—even though there's only one false coin among four. That's because getting four heads is much more likely with the false coin.

Maria
Exactly! Bayes' theorem helps update our beliefs based on evidence. The video covered all these examples really well. It's clear that understanding total probability and Bayes is crucial for many real-world problems.

Corey
Totally. Whether it's quality control, medical tests, or even court cases, Bayes' theorem gives a systematic way to handle conditional probabilities.

Maria
I'm glad the video also offered resources for further study, like their MathScare app and Telegram group. It seems like a great way to practice more problems.

Corey
Yeah, definitely. We should check out some more practice questions to really solidify the concept. But for now, I think we've got a solid grasp of Bayes' theorem.

Ask anything
We've read this whole study set, so questions about it get the best answers.