Partition of a Sample Space and Total Probability
The reverse-probability problem
Suppose Bag I contains 2 white and 3 red balls, Bag II contains 4 white and 5 red balls, and one ball is drawn from a randomly chosen bag. Questions in the forward direction are easy: given the bag, what is the chance of white? But exams love the reverse question: given that the ball turned out white, what is the chance it came from Bag II? Here the evidence comes after the cause, and we must reason backwards from effect to cause. The tool for this is Bayes' theorem — and it is built on two simpler ideas: partitions and total probability.
Partition of a sample space
A set of events is a partition of the sample space if
(a) they are pairwise disjoint: for ,
(b) together they cover everything: , and
(c) each has nonzero probability: for all .
In words: exactly one of the must occur, and each is genuinely possible. The simplest partition is for any event with — either happens or it doesn't. Another useful one: for any two events and , the four pieces partition . A sample space has many different partitions — you choose the one that matches the "causes" in your problem (which bag, which machine, which route).
Theorem of total probability

Theorem. If is a partition of with each , then for any event ,
Why it works (the 3-line proof):
Step 1 — slice along the partition: since the cover ,
Step 2 — the slices are disjoint (they sit inside the disjoint ), so probabilities add:
Step 3 — apply the multiplication rule to each slice: .
The intuition: is a weighted average of the conditional probabilities , weighted by how likely each cause is.
A worked total-probability computation
A person has undertaken a construction job. The probability of a strike is ; the job finishes on time with probability if there is no strike and if there is a strike. Find the probability that the job finishes on time.
Step 1 — choose the partition: let = "there is a strike", so partitions with , .
Step 2 — record the conditionals: with = "completed on time", and .
Step 3 — apply total probability:
Answer: — between the two conditional values and , and closer to because the strike is the likelier cause. A total-probability answer should always land between the smallest and largest ; use this as a sanity check.
Bayes' Theorem
The statement
Bayes' theorem. If are nonempty events forming a partition of , and is any event with , then for each ,
Proof (two lines, and worth 2 marks on its own):
Step 1 — definition of conditional probability, then the multiplication rule on the numerator:
Step 2 — expand by the theorem of total probability:
How to read the formula. The denominator is the total probability of the observed evidence , summed over every possible cause. The numerator is the share of that total contributed by the one cause you are asked about. So Bayes' theorem is simply
Once the numerator is written down, the denominator is the sum of all terms of the same shape — no new computation, just bookkeeping.
Terminology
When Bayes' theorem is applied, the events are called hypotheses, is the priori probability of the hypothesis, and is its posteriori probability — the updated probability after the evidence is seen. Bayes' theorem is also called the formula for the probability of causes: exactly one of the occurs, and the formula tells us which cause is how likely, given what we observed.
The board-exam template (follow it every time)
Step 1 — name the hypotheses: define (which bag / machine / route / speaker honesty) and check they form a partition.
Step 2 — write the priors: — these must add to 1.
Step 3 — define the evidence and write every conditional .
Step 4 — state Bayes' theorem, substitute, simplify. Keep every value as a fraction; decimals invite arithmetic slips.
Step 5 — answer in words ("the probability that the defective bolt came from machine B is ").
Board marking schemes award marks for each of these steps — writing the events and priors correctly earns credit even before the formula is touched.
Common mistakes to avoid
Mistake 1 — inverting the wrong way. and are different numbers. The question gives you (forward: cause to evidence) and asks for (backward: evidence to cause). If your "Bayes" fraction has no sum in the denominator, you have answered the forward question.
Mistake 2 — priors that don't add to 1. If the problem says machines produce 25%, 35%, 40% of output, the priors are . Forgetting a hypothesis (or double-counting one) shows up instantly as priors summing to something other than 1.
Mistake 3 — dropping a zero term too early. If some (the doctor is never late by the fourth mode of transport), the term contributes 0 to the denominator — but write it and then drop it, so the examiner sees the full partition.
Mistake 4 — ignoring base rates. In rare-disease problems the tiny prior () crushes even a -accurate test: the posterior comes out near , not . Trust the formula over intuition — this counterintuitive outcome is the point of the question.
Solved Examples
Example 1 — The two-bag classic
Bag I contains 3 red and 4 black balls; Bag II contains 5 red and 6 black balls. One ball is drawn at random from one of the bags and it is found to be red. Find the probability that it was drawn from Bag II.
Step 1 — hypotheses and priors: let = "Bag I chosen", = "Bag II chosen"; .
Step 2 — evidence conditionals: with = "red ball drawn", and .
Step 3 — Bayes' theorem:
Step 4 — simplify: the 's cancel; .
Answer: .
Example 2 — Three boxes of coins
Three identical boxes each hold two coins: box I two gold, box II two silver, box III one gold and one silver. A box is chosen at random and a coin drawn; it is gold. What is the probability that the other coin in that box is also gold?
Step 1 — translate the question: "the other coin is also gold" happens exactly when the chosen box is box I. So we need where = "box chosen" and = "gold coin drawn".
Step 2 — priors and conditionals: ; , , .
Step 3 — Bayes:
Answer: — not ! Seeing gold makes the all-gold box twice as likely as the mixed box, because it has twice as many gold coins to show you.
Example 3 — The rare-disease test
A test detects a certain infection of the time when it is present, but of uninfected people also test positive. Only of a large population is infected. A random person tests positive. What is the probability that the person is actually infected?
Step 1 — hypotheses: = "actually infected", = "not infected"; , .
Step 2 — conditionals: with = "tests positive", and .
Step 3 — Bayes:
Answer: only about . The false positives from the huge uninfected majority () swamp the true positives from the tiny infected minority (). This base-rate effect is the most famous application of Bayes' theorem.
Example 4 — Which machine made the defective bolt?
Machines A, B, C manufacture , and of a factory's bolts; , and of their outputs are defective. A random bolt is defective. Find the probability that it came from machine B.
Step 1 — priors: , , (they add to 1 ✓).
Step 2 — conditionals for = "defective": , , .
Step 3 — Bayes:
Answer: . Note how machine C, despite making the most bolts, contributes the least defect probability — the posterior weighs production share times defect rate.
Example 5 — The late doctor
A doctor visits a patient by train, bus, scooter or other transport with probabilities . The probabilities of being late are by train, bus and scooter, and by other transport. The doctor arrives late. Find the probability that the doctor came by train.
Step 1 — priors: , , , .
Step 2 — conditionals for = "late": , , , .
Step 3 — denominator (total probability of being late):
Step 4 — Bayes:
Answer: .
Example 6 — The truth-teller and the die
A man speaks the truth 3 out of 4 times. He throws a die and reports that it shows a six. Find the probability that it is actually a six.
Step 1 — hypotheses about the die: = "six occurred", = "six did not occur"; , .
Step 2 — conditionals for = "he reports a six": he reports six either by telling the truth when it is six, or by lying when it is not: , .
Step 3 — Bayes:
Answer: . Even a mostly-honest report of a rare event is more likely false than true — the same base-rate logic as the disease test.
Example 7 — Total probability with a changing urn
An urn contains 5 red and 5 black balls. A ball is drawn at random, its colour noted, and it is returned along with 2 more balls of the same colour; then a second ball is drawn. What is the probability that the second ball is red?
Step 1 — partition by the first draw: (first red) and (first black), each with probability .
Step 2 — conditionals for the second draw (urn now has 12 balls): after red, it holds 7 red and 5 black, so ; after black, 5 red and 7 black, so .
Step 3 — total probability:
Answer: — the same as the first draw. The two lopsided conditionals average out perfectly by symmetry.
Example 8 — Know or guess?
On a multiple-choice test, a student knows the answer with probability and guesses with probability . A guess is correct with probability ; knowing gives a correct answer for sure. Given that the student answered correctly, what is the probability that the student actually knew the answer?
Step 1 — hypotheses: = "knows" (), = "guesses" ().
Step 2 — conditionals for = "answers correctly": , .
Step 3 — Bayes:
Answer: . A correct answer is strong (but not conclusive) evidence of knowledge, because guessing rarely produces one.