Exam PProbability foundationsFree to read

Bayes' theorem and the law of total probability

Reverse a conditional probability: weight each cause by its prior and its likelihood, then normalise. The denominator is always the law of total probability.

The formulas

Law of total probability
P(A)=∑kP(A∣Bk)P(Bk)P(A) = \sum_{k} P(A\mid B_k)P(B_k)
Bayes
P(Bj∣A)=P(A∣Bj)P(Bj)∑kP(A∣Bk)P(Bk)P(B_j\mid A) = \dfrac{P(A\mid B_j)P(B_j)}{\sum_k P(A\mid B_k)P(B_k)}
Two-event form
P(B∣A)=P(A∣B)P(B)P(A∣B)P(B)+P(A∣Bc)P(Bc)P(B\mid A) = \dfrac{P(A\mid B)P(B)}{P(A\mid B)P(B) + P(A\mid B^{c})P(B^{c})}
Odds form
P(B1∣A)P(B2∣A)=P(A∣B1)P(A∣B2)⋅P(B1)P(B2)\dfrac{P(B_1\mid A)}{P(B_2\mid A)} = \dfrac{P(A\mid B_1)}{P(A\mid B_2)}\cdot\dfrac{P(B_1)}{P(B_2)}

Where it comes from

  1. The partition {Bk}\{B_k\} cuts AA into disjoint pieces A∩BkA \cap B_k, so P(A)=∑kP(A∩Bk)=∑kP(A∣Bk)P(Bk)P(A) = \sum_k P(A\cap B_k) = \sum_k P(A\mid B_k)P(B_k).
  2. Bayes is then just P(Bj∣A)=P(A∩Bj)/P(A)P(B_j\mid A) = P(A\cap B_j)/P(A) with both parts rewritten using the multiplication rule.
  3. The odds form drops the shared denominator, which is why it is faster when only a ratio is asked for.

Worked example

A motor book is 50% low risk, 30% standard and 20% high risk, with annual claim probabilities of 2%, 5% and 11%. A policyholder claims this year. What is the probability they are high risk?

  1. Total probability of a claim: 0.5(0.02)+0.3(0.05)+0.2(0.11)=0.0470.5(0.02) + 0.3(0.05) + 0.2(0.11) = 0.047.
  2. Bayes numerator for high risk: 0.2×0.11=0.0220.2 \times 0.11 = 0.022.
  3. P(high∣claim)=0.0220.047=0.4681P(\text{high}\mid\text{claim}) = \dfrac{0.022}{0.047} = 0.4681.
  4. The high-risk group is 20% of the book but 46.8% of the claimants - the prior has been sharply updated.

Answer: 0.4681

This answer is recomputed from the site’s own interest-theory and probability functions every time the test suite runs, so the page and the mathematics cannot drift apart.

Memory hooks

  • Numerator is one prior times one likelihood; denominator is the sum of all of them. The posteriors must sum to 1 - check it.
  • The denominator IS the law of total probability. Compute it once and reuse it for every class.

Traps

  • Forgetting a class in the denominator, so the posteriors do not sum to 1.
  • Swapping prior and likelihood - the prior is the class probability, the likelihood is the event probability GIVEN the class.

1 solved sample question

From the free samples in the question bank, solved in full. They never rotate and they are never gated.

  1. Exam PBayes' theorem and the law of total probabilityCore
    Three suppliers provide 25%, 35% and 40% of parts, with failure rates 0.02, 0.04 and 0.05. What is the overall failure rate?
    1. A0.03000.0300
    2. B0.03670.0367
    3. C0.03900.0390
    4. D0.04100.0410
    5. E0.05000.0500

    Solution

    1. Weight each supplier's failure rate by its share of parts.
    2. 0.25(0.02)+0.35(0.04)+0.40(0.05)0.25(0.02) + 0.35(0.04) + 0.40(0.05).
    3. =0.005+0.014+0.020= 0.005 + 0.014 + 0.020.
    4. =0.039= 0.039, between the smallest and largest rates as any weighted average must be.

Drill this topic: Bayes' theorem and the law of total probability has 16 questions, 2 of them solved free on that page, and the full question bank has 400. The drills are part of Premium. Every free sample and today’s mixed round stay free.

Related