On this page
When you face a probability question involving multiple steps—like choosing a bag and then drawing a ball—finding the overall chance of an outcome can feel confusing. The law of total probability gives you a systematic way to solve it by looking at every possible path.
What is the theorem of total probability?
According to the law of total probability, you calculate the overall probability of an event by breaking it down into distinct, mutually exclusive cases. The theorem states that if an event can occur through several non-overlapping paths, its total probability is the sum of the probabilities of each path.
Instead of trying to find the chance of drawing a red ball in one leap, you split the problem into the different ways a red ball could end up in your hand.
A worked example with two bags of balls
School and competitive exams frequently test this concept using bags of coloured balls. Consider this standard setup:
Bag I contains 3 red balls and 4 black balls (7 balls total).
Bag II contains 5 red balls and 6 black balls (11 balls total).
If you choose one bag at random and then draw a single ball, what is the probability that the ball drawn is red?
Find the probability of each path. Since there are two bags and you choose at random, the chance of picking Bag I is 1/2, and the chance of picking Bag II is 1/2.
Find the conditional probabilities. If you pick Bag I, the chance of drawing a red ball is 3/7. If you pick Bag II, the chance of drawing a red ball is 5/11.
Multiply and add. The theorem tells us to weight the chance of a red ball from each bag by the chance of picking that bag in the first place.
P(Red) = P(Bag I) × P(Red|Bag I) + P(Bag II) × P(Red|Bag II)
P(Red) = (1/2 × 3/7) + (1/2 × 5/11)
P(Red) = 3/14 + 5/22
To add these fractions, we find a common denominator (154):
P(Red) = 33/154 + 35/154 = 68/154 = 34/77.
When probability problems get complex, it is easy to lose track of the branches. The Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer. If you get stuck setting up the cases, Fermi's AI tutor holds a line of reasoning across a whole session, notices where a student is stuck, and decides whether to explain, ask, or show.
The probability tree framework
To avoid memorising formulas, draw a probability tree diagram.
The first split is your choice of bag. Draw two branches from the start, each labelled 1/2.
The second split is the colour of the ball. From the end of the Bag I branch, draw a branch for Red (3/7) and one for Black (4/7). Do the same for Bag II.
Multiply along the branches to find the chance of each specific outcome (such as choosing Bag I and getting a red ball).
Add the ends that match your target event.
Much like deciding between drawing with and without replacement, the key is knowing whether your branches are independent or conditional.
How does this connect to Bayes' theorem?
The theorem of total probability gives you the forward chance: "What is the overall chance of drawing a red ball?"
Bayes' theorem asks the reverse question: "Given that you just drew a red ball, what is the probability it came from Bag I?"
The answer from the theorem of total probability forms the denominator of Bayes' theorem, representing the total probability of the evidence. If you need to calculate the odds in favour and against a particular bag being the source, knowing the total probability of the outcome is the required first step.
Real-world applications beyond bags
While bags of balls make the maths clear, the theorem of total probability applies to real-world scenarios in science and engineering.
For instance, in medical testing, a doctor uses this theorem to find the overall chance that a patient tests positive for a disease. The two "bags" become the two states of the patient: one branch for patients who actually have the disease (and the conditional probability of a true positive test), and another branch for patients who do not have the disease (and the conditional probability of a false positive). By summing these two paths, the doctor calculates the total probability of a positive test result across the entire clinic.
Similarly, in weather forecasting, meteorologists use total probability to predict rain by splitting the forecast into branches based on whether a specific pressure system arrives. This fundamental idea—calculating a marginal probability by adding up the weighted conditional probabilities—powers everything from machine learning algorithms to risk management in finance. Understanding the humble bags of balls gives you the foundation to build these much larger probabilistic models.



