Tutorials › Introduction to Statistics › The Law of Total Probability

Conditional Probability and Bayes’ Rule · Tutorial 335 of 996

The Law of Total Probability

Learn to calculate an event’s overall probability by weighting its probability within each case by the chance of that case.

Beginner 10 min read

What You'll Learn

  • Define a partition of the possible outcomes and identify its cases.
  • State the law of total probability and the conditions needed to use it.
  • Derive the formula by breaking an event into disjoint pieces.
  • Calculate an overall probability from case-specific probabilities and case weights.
  • Distinguish conditional probabilities from their weighted contributions to the total.
  • Recognize common errors, including using unweighted averages or incomplete cases.

Why Combine Probabilities Across Cases?

An event may occur in several different ways, and its probability may not be the same in each way. For example, the chance that a randomly selected product is defective may depend on which production line made it. To find the defect probability for a product chosen from the entire output, we need to account for both the defect rate on each line and the share of products made there.

The law of total probability gives a systematic way to do this. It applies whenever the possible outcomes can be split into a complete set of nonoverlapping cases. The overall probability is a weighted sum: each case-specific probability is multiplied by the probability of being in that case.

Partitions and the Law

Definition: A collection of events \(B_1,B_2,\ldots,B_k\) is a partition of the sample space if the events are mutually exclusive and collectively exhaustive. Mutually exclusive means \(B_i\cap B_j=\varnothing\) whenever \(i\ne j\); collectively exhaustive means \(B_1\cup B_2\cup\cdots\cup B_k=\Omega\), where \(\Omega\) is the sample space. Each possible outcome therefore belongs to exactly one case.

For example, if every product in a shipment comes from exactly one of three production lines, the events “product came from Line 1,” “product came from Line 2,” and “product came from Line 3” form a partition. The cases must cover all possibilities, and they must not overlap.

Theorem: Law of Total Probability. If \(B_1,\ldots,B_k\) form a partition and \(P(B_i)>0\) for every \(i\), then for any event \(A\), $$ P(A)=\sum_{i=1}^{k}P(A\mid B_i)P(B_i). $$ Here \(P(A\mid B_i)\) is the probability of \(A\) within case \(B_i\), and \(P(B_i)\) is the probability of that case. If a case has probability zero, its contribution is zero and its conditional probability need not be defined; omit that case from the sum.

The factors have distinct roles. \(P(A\mid B_i)\) describes the event rate within case \(i\). The factor \(P(B_i)\) weights that rate according to how often the case occurs. Their product, \(P(A\mid B_i)P(B_i)\), is that case’s contribution to the overall probability.

Why the Formula Works

Because the cases partition the sample space, event \(A\) can be divided into the disjoint pieces \(A\cap B_1,\ldots,A\cap B_k\). These pieces do not overlap, and together they contain every outcome in \(A\). The addition rule for disjoint events therefore gives \(P(A)=\sum_i P(A\cap B_i)\). By the definition of conditional probability, \(P(A\cap B_i)=P(A\mid B_i)P(B_i)\) whenever \(P(B_i)>0\). Substituting each intersection probability yields the law:

$$ \begin{aligned} A &= (A\cap B_1)\cup(A\cap B_2)\cup\cdots\cup(A\cap B_k),\\ P(A) &= \sum_{i=1}^{k}P(A\cap B_i)\\ &= \sum_{i=1}^{k}P(A\mid B_i)P(B_i). \end{aligned} $$

This justification also explains why the cases must be both exhaustive and mutually exclusive. If some outcomes are left out, part of \(A\) could be missed. If cases overlap, some outcomes could be counted more than once.

Worked Example: Defects From Two Production Lines

Suppose a hypothetical factory’s daily output consists of 70% of products from Line 1 and 30% from Line 2. A product is selected at random from the combined output. The defect probability is 0.020 for a Line 1 product and 0.050 for a Line 2 product. Find the probability that the selected product is defective.

Let \(A\) be the event that the selected product is defective. Let \(B_1\) and \(B_2\) be the events that it came from Line 1 and Line 2, respectively. Every product comes from exactly one of these two lines, so the cases form a partition. The stated line shares are the probabilities for a random product from the combined output, and both are positive, so the conditional defect probabilities are defined.

The case-specific contributions are

$$ P(A\mid B_1)P(B_1)=0.020(0.70)=0.014 $$

for Line 1, and

$$ P(A\mid B_2)P(B_2)=0.050(0.30)=0.015 $$

for Line 2. Thus,

$$ P(A)=0.014+0.015=0.029. $$

The overall defect probability is 0.029, or 2.90%. Although Line 2 has the larger conditional defect probability, its weighted contribution is 0.015, slightly more than Line 1’s contribution of 0.014. The case with the higher defect rate need not have the larger contribution in every setting; both its rate and its share of output matter.

Reading the Weighted Sum

The law is a weighted average of the conditional probabilities. The weights \(P(B_i)\) are nonnegative and sum to 1 because the cases partition the sample space. A case with a large share has more influence on the overall probability than a case with a small share, all else being equal.

The weighted contributions \(P(A\mid B_i)P(B_i)\) are not the same quantities as the conditional probabilities themselves. A conditional probability is a rate within one case; a contribution is the portion of the total event probability supplied by that case. The distinction is useful when describing which cases account for more of the overall event.

Worked Example: Overall Pass Probability Across Class Levels

In a hypothetical college, 40% of enrolled students are first-year students and 60% are upper-year students. A student is selected at random from the college. The probability of passing a particular course is 0.65 for a first-year student and 0.85 for an upper-year student. Calculate the probability that the selected student passes.

Let \(A\) be the event that the student passes. Let \(B_1\) mean the student is first-year and \(B_2\) mean the student is upper-year. These categories are mutually exclusive and include every student in this hypothetical population, so they partition the sample space. The proportions describe the chance of each category for a random student, and each case has positive probability.

The first-year contribution is \(0.65(0.40)=0.260\). The upper-year contribution is \(0.85(0.60)=0.510\). Therefore,

$$ P(A)=P(A\mid B_1)P(B_1)+P(A\mid B_2)P(B_2) =0.65(0.40)+0.85(0.60)=0.260+0.510=0.770. $$

The pass probability for a randomly selected student is 0.770, or 77.0%. It is not the simple average \((0.65+0.85)/2=0.75\), because the two class levels are not equally common. The upper-year rate receives more weight because upper-year students make up a larger share of the college.

Worked Example: Probability of Rain Across Seasons

Suppose a hypothetical weather record assigns 25% of days to spring, 35% to summer, and 40% to fall and winter combined. The conditional probabilities of rain on a randomly selected day in these periods are 0.10, 0.30, and 0.50, respectively. Find the probability of rain on a day selected at random from the full record.

Let \(A\) be the event that it rains on the selected day. Let \(B_1,B_2,B_3\) denote spring, summer, and the combined fall-and-winter period. A day belongs to exactly one of these periods, and their stated probabilities sum to \(0.25+0.35+0.40=1\); therefore, they form a partition. The conditional rain probabilities refer to days within their named periods.

The contributions are \(0.10(0.25)=0.025\) for spring, \(0.30(0.35)=0.105\) for summer, and \(0.50(0.40)=0.200\) for fall and winter combined. Adding them gives

$$ P(A)=0.025+0.105+0.200=0.330. $$

The probability of rain for a randomly selected day in the full record is 0.330, or 33.0%. The formula combines the different seasonal rates while respecting how frequently each period occurs.

A Reliable Calculation Process

Before substituting numbers, check that the cases really partition the possible outcomes. Then label the event of interest and the cases, and match each conditional probability with the probability of its case. This prevents a correct number from being attached to the wrong case.

1
Define the event and cases.
State the event \(A\) whose overall probability is wanted, and list the case events \(B_1,\ldots,B_k\).
2
Check the partition.
Confirm that every outcome belongs to one case and only one case. The case probabilities should sum to 1.
3
Pair each rate with its weight.
For every case \(B_i\), identify both \(P(A\mid B_i)\) and \(P(B_i)\).
4
Multiply and add.
Calculate \(P(A\mid B_i)P(B_i)\) for each case, then sum the contributions and interpret the result in context.

Common Mistakes and Why the Law Matters

  • Taking an unweighted average. Averaging the conditional probabilities equally is correct only when the case probabilities are all equal. In general, use the case probabilities as weights.
  • Using the conditional rate as the overall probability. A value such as \(P(A\mid B_1)\) describes event \(A\) within one case, not across the entire population. Include the other cases and their weights.
  • Adding conditional probabilities directly. Conditional probabilities for different cases are rates within different groups. Their sum is generally not the overall probability; multiply each by its case probability first.
  • Leaving out a case or using overlapping cases. Missing cases omit outcomes, while overlapping cases can count outcomes more than once. Verify that the cases are exhaustive and mutually exclusive.

The law matters whenever an overall rate combines groups with different probabilities of an event. It provides a transparent way to account for differences among cases without treating every case as equally common. A calculation is only as meaningful as its partition: the case probabilities must describe the population or selection process relevant to the question.

Key takeaway: To find an event’s overall probability, split the sample space into a partition, multiply each case-specific probability by the probability of that case, and add the contributions: \(P(A)=\sum_iP(A\mid B_i)P(B_i)\).

Check Your Understanding

Use the definitions and calculation process above to answer these questions.

  1. A population is divided into two mutually exclusive groups that together include everyone. What additional probabilities are needed to calculate an event’s overall probability using the law of total probability?
  2. Two cases have event probabilities 0.20 and 0.60, and case probabilities 0.75 and 0.25. Write the weighted-sum calculation for the overall event probability.
  3. Why is an unweighted average of case-specific probabilities generally not the law of total probability?
  4. What could go wrong if the proposed cases overlap?
  5. A three-case partition has probabilities 0.20, 0.30, and 0.50. Within the cases, event \(A\) has probabilities 0.10, 0.40, and 0.70. Calculate \(P(A)\) and identify each case’s contribution.