Total probability and Bayes' theorem
A factory floor with three machines, or an urn room with several bags, poses the same question in disguise: an event you actually observe — a defective item, a red ball — could have arisen through more than one "route." The Theorem of Total Probability answers the forward question, how likely is the event overall, once you know how likely each route is and how likely the event is along each route. Bayes' Theorem answers the reverse question that examiners love: given that the event did happen, how likely is it that a particular route was responsible? This is the same conditional-probability and multiplication-theorem machinery you already know, applied systematically to a sample space that has been split into non-overlapping pieces. Get the partition right and both formulas become almost mechanical.
When a sample space splits into a partition , the overall probability of an event is , and Bayes' Theorem inverts this sum to give the revised, "after-the-fact" probability of each cause.
The core idea
A partition splits the sample space cleanly. Events form a partition of the sample space if they are mutually exclusive ( for ) and exhaustive () — every outcome belongs to exactly one . Think of as "which machine produced the item" or "which bag was picked," and let be an event whose chance depends on which occurred, such as "the item is defective."
Total probability weights each route by how likely it is. Since can be written as the disjoint union , the probabilities add, and each piece expands by the multiplication theorem:
where: is the prior probability of route (known before is observed), and is the conditional probability that occurs given route .
Bayes' Theorem reverses the question. Once is known to have happened, the revised probability that it came from route is
where: the numerator is the single term for route , and the denominator is exactly from the total-probability sum — so Bayes' Theorem is just with expanded over the partition. The output is called the posterior probability.
The goal is to show, starting from nothing but the definition of conditional probability and the fact that a partition splits an event into disjoint pieces, exactly why holds and why Bayes' Theorem then follows immediately as a ratio using that same sum, so that no separate proof is ever needed for the denominator.
Step 1. Split using the partition. Since cover with no overlap, intersecting each with slices itself into disjoint pieces: . No outcome of is double-counted or missed, because every outcome lies in exactly one .
Step 2. Add the disjoint pieces. Disjoint events have additive probability, so .
Step 3. Expand each piece with the multiplication theorem. Since , substituting gives — the Theorem of Total Probability.
Step 4. Reverse it for Bayes' Theorem. By definition, . Replacing the denominator with the Step 3 sum gives , so the same total-probability calculation supplies both the answer to "how likely is overall" and the denominator needed to reverse the question for any one route.
Worked example
A factory has three machines, I, II, and III, producing 25%, 35%, and 40% of the day's output, with defective rates 5%, 4%, and 2% respectively. An item is picked at random and found to be defective; find (a) the overall probability an item is defective, and (b) the probability it came from machine II.
Step 1. Set up the partition. Let be "item is from machine I, II, III," with , , — mutually exclusive and exhaustive, so this is a valid partition. Let = "item is defective," with , , .
Step 2. Apply the Theorem of Total Probability for part (a).
So of the day's output is defective overall.
Step 3. Apply Bayes' Theorem for part (b). The numerator is the machine-II term already computed, , and the denominator is from Step 2 — no fresh calculation needed.
Answer: , and , so about of defective items came from machine II — higher than machine II's raw output share, because its defect rate sits above the blended average, while machine III (biggest output, lowest defect rate) contributes proportionally less to the defective pool.
Competitive stretch
Using the same data, find and , and check they add up correctly with .
Step 1. Reuse the weighted terms and the denominator from the main example: , , , with .
Step 2. Divide each weighted term by : , and .
Step 3. Check the sum: . This must always hold — the posteriors over a full partition add to exactly , since a defective item must have come from some machine; it is a fast way to catch an arithmetic slip in a Bayes' Theorem question with several routes.
Common traps
- Applying either theorem without first checking is a genuine partition (mutually exclusive and exhaustive) — the formulas simply do not hold otherwise.
- Quoting the prior as if it were the final Bayes' answer, instead of computing the ratio .
- Recomputing the Bayes' denominator from scratch rather than reusing the total-probability sum already found — wastes time and invites arithmetic slips.
- Adding the conditional probabilities directly instead of weighting each by its prior first; every term in the sum must be a product, not alone.
Ask the tutor: if you would like help identifying the partition in a trickier word problem, or want a second Bayes'-Theorem example worked through with fresh numbers, ask the AI tutor for a guided walkthrough.
Why is P(A) in the Bayes denominator not just P(A) computed some other way?
It is the same you would get by any correct method, but the fastest route is to reuse the Theorem of Total Probability sum, since has already been split over the partition for the numerator. Recomputing it independently is extra work and a common source of arithmetic mismatches between numerator and denominator.
What is the real difference between a prior and a posterior probability here?
The prior is your belief about which route occurred before you know whether happened — for example, machine II's 35% output share. The posterior is the revised belief after learning occurred, such as the item being defective. Bayes' Theorem is precisely the rule for updating the prior into the posterior using the evidence.
Do I always need three or more events in the partition, or can Bayes theorem work with just two?
Two events work fine as long as they are mutually exclusive and exhaustive, such as = "coin is fair" and = "coin is biased." Exam problems favour three or more routes (three machines, three bags) because it exercises the summation more thoroughly, but the algebra of both theorems is identical for any .