Law of Total Probability and Bayes' Theorem on Paper
In standard probability problems, we reason forward from causes to effects: given that an item was made by Machine A, what is the probability that it is defective?
In real-world science, medicine, and engineering, we must frequently reason backward from observed effects to underlying causes: given that an item is defective, what is the probability that Machine A produced it?
The Law of Total Probability and Bayes' Theorem are the twin mathematical cornerstones that make this inverse reasoning precise.
Partitions of a Sample Space
A collection of events forms a partition of the sample space if:
- They are pairwise mutually exclusive:
- Their union encompasses the entire sample space:
- Each event has a positive prior probability: .
Every possible outcome in belongs to one and only one partition slice .
The Law of Total Probability
Let be a partition of . Any arbitrary event can be sliced into disjoint sub-events by intersecting it with each partition block:
Because these pieces are mutually exclusive, the Law of Total Probability states:
The Two-Hypothesis Case ( and )
When an event and its complement partition :
Bayes' Theorem (Bayes' Rule)
Using the conditional probability definition, the posterior probability of hypothesis given that evidence has occurred is:
Substituting the Law of Total Probability into the denominator yields Bayes' Theorem:
Vocabulary of Bayesian Inference
- Prior Probability : The baseline probability of hypothesis before observing the evidence.
- Likelihood : The probability of observing evidence if hypothesis were true.
- Total (Marginal) Probability : The overall probability of evidence occurring across all possible causes.
- Posterior Probability : The updated probability of hypothesis after evidence has been observed.
The Paper Tabular Layout Method
To avoid confusing formulas on paper, arrange your calculations in a Bayesian Calculation Table:
| Hypothesis () | Prior | Likelihood | Joint Product | Posterior |
|---|---|---|---|---|
| Sum | — |
Worked Examples on Paper
Example 1: Three Factory Machines
Problem Statement: An electronics factory produces microchips using three machines: and .
- produces of the factory's output with a defective rate.
- produces of the output with a defective rate.
- produces of the output with a defective rate.
A chip is selected at random from the warehouse and found to be defective ().
- What is the total probability that any randomly selected chip is defective: ?
- What is the probability that the defective chip was produced by Machine : ?
Step-by-Step Paper Solution
Step 1: Set up the paper table Identify the partition and write their priors:
Check: .
Write the likelihoods of defect ():
Step 2: Multiply priors by likelihoods to find joint probabilities
Step 3: Calculate the total probability (Part 1) Add the joint products using the Law of Total Probability:
Step 4: Compute the posterior probability (Part 2) By Bayes' Theorem:
Example 2: The Base Rate Fallacy in Medical Testing
Problem Statement: A rare virus infects in every individuals in a city (). A blood test for the virus has:
- True Positive Rate (Sensitivity): .
- False Positive Rate: .
A resident takes the test and receives a positive result (). What is the probability that this resident actually carries the virus?
Step-by-Step Paper Solution
Step 1: Write down all components
- Prior probabilities:
- Conditional likelihoods:
Step 2: Calculate the two joint paths
- True infected and tests positive:
- Uninfected healthy person and tests positive (false positive):
Step 3: Total probability of testing positive
Step 4: Apply Bayes' Theorem
Interpretation on Paper: Despite a test accuracy, the probability of being infected after a positive test is only . This occurs because the baseline disease rate is so tiny () that false positives from the large healthy population ( per ) dwarf the true positives ( per ).
Example 3: The Two-Urn Selection Game
Problem Statement: You have two urns:
- Urn 1 (): Contains white balls and black balls (total ).
- Urn 2 (): Contains white balls and black balls (total ).
A fair six-sided die is rolled. If a or appears, Urn 1 is chosen. If a or appears, Urn 2 is chosen. A single ball is drawn from the selected urn and is observed to be White (). What is the probability that the ball was drawn from Urn 1?
Step-by-Step Paper Solution
Step 1: Determine the prior probabilities of choosing each urn
- Urn 1 is selected if the die shows :
- Urn 2 is selected if the die shows :
Check: .
Step 2: Determine the likelihood of drawing a white ball from each urn
- From Urn 1:
- From Urn 2:
Step 3: Calculate the joint probabilities
Step 4: Compute the total probability Find a common denominator for and ():
Step 5: Apply Bayes' Theorem
The probability that the white ball originated from Urn 1 is .
Common Mistakes & Paper Traps
The Base Rate Fallacy: Assuming . Neglecting the prior probability is the single most common statistical error in medicine and law.
Incomplete Partition in the Denominator: Forgetting one of the branches when calculating . Ensure your hypotheses cover all possibilities ().
Inverting the Conditional Notation: Writing in the denominator instead of as the goal. Always write: $$
Pencil & Paper Practice
Solve these problems in your notebook before reviewing the solutions.
Practice 1
A taxi company operates green cabs and blue cabs. An eyewitness to a hit-and-run accident reports that the cab was blue. Under test conditions simulating the accident, the witness correctly identifies cab color of the time (and misidentifies it of the time). What is the probability that the cab involved in the accident was actually blue?
Practice 2
Three identical boxes each contain two coins:
- Box A contains gold coins.
- Box B contains silver coins.
- Box C contains gold coin and silver coin.
A box is chosen at random and one coin is drawn. It is a gold coin. What is the probability that the other coin in that box is also gold?
Solutions to Practice Problems
Solution 1
- Hypotheses: Cab is Blue () or Green (): $$
- Witness reports Blue (): $$
- Joint probabilities:
- Total probability that witness reports Blue:
- Posterior probability:
Solution 2
- Hypotheses: Box or selected with equal probability: $$
- Event : The first drawn coin is Gold.
- Box A ( gold): .
- Box B ( gold): .
- Box C ( gold, silver): .
- Total probability of drawing a gold coin:
- The "other coin is also gold" occurs if and only if Box A was chosen:
The probability that the remaining coin is gold is (Bertrand's Box Paradox).
Test yourself
Let and partition with and . If and , what is the total probability ?
Using the values from the previous question (, , , with ), what is the posterior probability ?
What is the primary reason why a positive medical test result may still indicate a low probability of actually having a rare condition?
- The low prior base rate of the disease means healthy false positives vastly outnumber true positives.
- The test sensitivity is mathematically equal to the false positive rate.
- The Law of Total Probability does not apply to clinical medicine.
- Conditional probability cannot be inverted.