The Law of Total Probability

Suppose a factory receives components from three suppliers, each with a different defect rate. The components are mixed together on the same shelf. A quality engineer picks one component at random. A natural question follows: what is the overall probability it is defective? No single supplier's defect rate answers this. The answer depends on how the suppliers' contributions blend together. The Law of Total Probability is the precise tool for this kind of blending. It computes an unconditional ("marginal") probability by weighting conditional probabilities. This weighting happens across all the distinct scenarios that could have occurred. This idea matters because most real probabilities are not handed to us directly. They are hidden behind a mixture of causes, sources, or conditions. Medical tests are read differently depending on whether a patient truly has a disease. Insurance claims behave differently depending on the policyholder's risk class. A signal received over a noisy channel depends on which symbol was actually sent. In every case, the sample space naturally splits into disjoint pieces. The law tells us how to reassemble the whole picture from the conditional pieces using the Multiplication Rule. The big picture is one of divide, weight, and sum. Partition the sample space into mutually exclusive and exhaustive events. Compute the probability of the event of interest within each piece. Weight each conditional probability by the chance of being in that piece, and add. This is the probabilistic analogue of computing a weighted average. It is the single most-used identity for turning conditional information into unconditional answers. This article gives the formal definition of a partition. It states and rigorously proves the Law of Total Probability. This includes the case of a countably infinite partition. It works through two asymmetric numerical examples. It shows exactly what fails without the exhaustiveness and disjointness hypotheses. It previews how this very identity becomes the denominator engine driving Bayes' Theorem.

Key takeaways
  • A partition of the sample space is a collection of pairwise disjoint events whose union is the whole space.
  • The Law of Total Probability computes P(B)P(B) by summing P(B∣Ai)P(Ai)P(B\mid A_i)P(A_i) over the partition.
  • It generalizes "weighted average": each conditional probability is weighted by how likely its scenario is.
  • It relies on the Multiplication Rule applied piece-by-piece, then finite (or countable) additivity.
  • It works for finite or countably infinite partitions, but requires every AiA_i to have P(Ai)>0P(A_i) > 0 where it's used.
  • Key idea: split the sample space into disjoint, exhaustive scenarios and reassemble the total probability as a probability-weighted average of conditional probabilities.

Where this lives today

In statistics, the Law of Total Probability underlies computing marginal distributions from joint or conditional models, such as mixture models where a population is partitioned into latent subgroups (clusters, risk classes) with different conditional behavior. In medical diagnostics and epidemiology, it computes the overall prevalence of a condition or the overall sensitivity of a screening protocol across demographic strata, and is the direct setup for the denominator in Bayes' Theorem when inverting test results into diagnoses. In computer science and information theory, it underlies channel capacity computations, where the average error probability over transmitted symbols is a partition-weighted sum of per-symbol error probabilities. In actuarial science and insurance, total claim probabilities are computed by partitioning policyholders into risk classes, weighting each class's claim probability by its share of the portfolio. In cryptography and randomized algorithms, total probability arguments bound the overall success or failure probability of an algorithm by conditioning on which random branch or key was used. In physics and engineering reliability, it computes overall failure probabilities of systems partitioned by which component or failure mode is triggered, feeding directly into fault-tree analysis.

Ask the tutor: How does the Law of Total Probability turn into the denominator of Bayes' Theorem when we want to invert conditional probabilities?

DefinitionPartition and the Law of Total Probability

Let (Ω,F,P)(\Omega, \mathcal{F}, P) be a probability space. A collection of events A1,A2,…A_1, A_2, \ldots (finite or countably infinite) is a partition of Ω\Omega if: 1. Pairwise disjoint: Ai∩Aj=∅A_i \cap A_j = \varnothing for all i≠ji \neq j; 2. Exhaustive: ⋃iAi=Ω\bigcup_i A_i = \Omega; 3. Each Ai∈FA_i \in \mathcal{F} (measurable), and (for the conditioning statement below) P(Ai)>0P(A_i) > 0. For any event B∈FB \in \mathcal{F}, the Law of Total Probability states

P(B)=∑iP(B∣Ai) P(Ai).P(B) = \sum_i P(B \mid A_i)\, P(A_i).

Intuition

Picture the sample space Ω\Omega as a rectangular region cut into disjoint vertical strips A1,A2,A3A_1, A_2, A_3, each strip representing one "scenario" — say, which of three machines produced a randomly chosen item. The event BB (say, "the item is defective") is some blob overlapping several strips. Within each strip, the fraction of that strip covered by BB is the conditional probability P(B∣Ai)P(B\mid A_i). The width of the strip is P(Ai)P(A_i). The total area covered by BB — which is P(B)P(B) — is obtained by adding up, strip by strip, the area of BB within that strip, and area within a strip is exactly (fraction covered) ×\times (strip width). That is precisely ∑iP(B∣Ai)P(Ai)\sum_i P(B\mid A_i)P(A_i). This is why the law can be read as a weighted average: P(B)P(B) is a convex combination of the conditional probabilities P(B∣Ai)P(B\mid A_i), with weights P(Ai)P(A_i) that sum to 1. If one supplier dominates production, its defect rate dominates the overall rate; if all suppliers contribute equally, the overall rate is a simple average of the three defect rates.

Figure
Partitioning Ω\Omega into three scenarios A1,A2,A3A_1,A_2,A_3, with event BB shaded across all three
A₁ (P=0.5) A₂ (P=0.3) A₃ (P=0.2) Shaded region = event B, spread over all three strips P(B|A₁)=0.10 P(B|A₂)=0.20 P(B|A₃)=0.05
TheoremLaw of Total Probability

Let (Ω,F,P)(\Omega, \mathcal{F}, P) be a probability space and let {Ai}i∈I\{A_i\}_{i \in I}, with II finite or countably infinite, be a partition of Ω\Omega such that P(Ai)>0P(A_i) > 0 for every i∈Ii \in I. Then for any event B∈FB \in \mathcal{F},

P(B)=∑i∈IP(B∣Ai) P(Ai).P(B) = \sum_{i \in I} P(B \mid A_i)\, P(A_i).
Proof

We use countable additivity of PP (an axiom of a probability measure) together with the Multiplication Rule, P(B∩Ai)=P(B∣Ai)P(Ai)P(B \cap A_i) = P(B\mid A_i)P(A_i) whenever P(Ai)>0P(A_i) > 0.

Step 1 — Decompose BB into disjoint pieces. Since {Ai}i∈I\{A_i\}_{i \in I} is exhaustive, ⋃i∈IAi=Ω\bigcup_{i \in I} A_i = \Omega, and therefore

B=B∩Ω=B∩(⋃i∈IAi)=⋃i∈I(B∩Ai),B = B \cap \Omega = B \cap \left(\bigcup_{i \in I} A_i\right) = \bigcup_{i \in I} (B \cap A_i),

using distributivity of intersection over union, which holds for arbitrary (finite or countable) unions.

Step 2 — The pieces B∩AiB \cap A_i are pairwise disjoint. For i≠ji \neq j, since Ai∩Aj=∅A_i \cap A_j = \varnothing (the AiA_i are pairwise disjoint by hypothesis),

(B∩Ai)∩(B∩Aj)=B∩(Ai∩Aj)=B∩∅=∅.(B \cap A_i) \cap (B \cap A_j) = B \cap (A_i \cap A_j) = B \cap \varnothing = \varnothing.

So {B∩Ai}i∈I\{B \cap A_i\}_{i \in I} is a countable (or finite) collection of pairwise disjoint events.

Step 3 — Apply countable additivity. Each B∩Ai∈FB \cap A_i \in \mathcal{F} because F\mathcal{F} is a σ\sigma-algebra closed under finite intersections, and B,Ai∈FB, A_i \in \mathcal{F}. By countable additivity of the probability measure PP (which subsumes finite additivity when II is finite, by appending empty sets),

P(B)=P(⋃i∈I(B∩Ai))=∑i∈IP(B∩Ai).P(B) = P\left(\bigcup_{i \in I} (B \cap A_i)\right) = \sum_{i \in I} P(B \cap A_i).

Step 4 — Apply the Multiplication Rule to each term. Since P(Ai)>0P(A_i) > 0 for every ii, the conditional probability P(B∣Ai)=P(B∩Ai)P(Ai)P(B \mid A_i) = \dfrac{P(B \cap A_i)}{P(A_i)} is well-defined, and rearranging gives

P(B∩Ai)=P(B∣Ai) P(Ai).P(B \cap A_i) = P(B \mid A_i)\, P(A_i).

This is exactly the Multiplication Rule applied to the pair of events BB and AiA_i.

Step 5 — Combine. Substituting the result of Step 4 into the sum from Step 3,

P(B)=∑i∈IP(B∩Ai)=∑i∈IP(B∣Ai) P(Ai).P(B) = \sum_{i \in I} P(B \cap A_i) = \sum_{i \in I} P(B \mid A_i)\, P(A_i).

This is precisely the claimed identity. When II is countably infinite, the series on the right converges (absolutely, since all terms are nonnegative and the partial sums are bounded above by P(B)≤1P(B) \le 1), so the equality is between a well-defined convergent series and P(B)P(B); no additional convergence hypothesis is needed. ■\blacksquare

∎
CorollaryTotal probability with a two-set partition

For any event AA with 0<P(A)<10 < P(A) < 1, and any event BB,

P(B)=P(B∣A)P(A)+P(B∣Ac)P(Ac).P(B) = P(B\mid A)P(A) + P(B \mid A^c)P(A^c).

This is the special case I={1,2}I = \{1,2\}, A1=AA_1 = A, A2=AcA_2 = A^c, since {A,Ac}\{A, A^c\} is always a partition of Ω\Omega.

Worked examples

Example 1 — Mixed supplier shipment (finite partition, asymmetric weights). A warehouse stocks resistors from three suppliers. Supplier A1A_1 provides 50% of stock with a 4% defect rate; supplier A2A_2 provides 30% of stock with a 7% defect rate; supplier A3A_3 provides the remaining 20% with a 1% defect rate. A resistor is chosen uniformly at random from the warehouse. Let DD be the event it is defective. The events A1,A2,A3A_1, A_2, A_3 (which supplier the resistor came from) form a partition: they are mutually exclusive (a resistor has exactly one supplier) and exhaustive (P(A1)+P(A2)+P(A3)=0.5+0.3+0.2=1P(A_1) + P(A_2) + P(A_3) = 0.5 + 0.3 + 0.2 = 1). We are given

P(A1)=0.50,P(A2)=0.30,P(A3)=0.20,P(A_1) = 0.50,\quad P(A_2) = 0.30,\quad P(A_3) = 0.20,
P(D∣A1)=0.04,P(D∣A2)=0.07,P(D∣A3)=0.01.P(D\mid A_1) = 0.04,\quad P(D\mid A_2) = 0.07,\quad P(D\mid A_3) = 0.01.

By the Law of Total Probability,

P(D)=(0.04)(0.5)+(0.07)(0.3)+(0.01)(0.2).P(D) = (0.04)(0.5) + (0.07)(0.3) + (0.01)(0.2).

Compute each term: 0.04×0.5=0.0200.04 \times 0.5 = 0.020; 0.07×0.3=0.0210.07 \times 0.3 = 0.021; 0.01×0.2=0.0020.01 \times 0.2 = 0.002. Summing,

P(D)=0.020+0.021+0.002=0.043.P(D) = 0.020 + 0.021 + 0.002 = 0.043.

So 4.3% of the warehouse's resistors are defective overall — a figure strictly between the extremes (1% and 7%) as it must be, since it is a weighted average, but skewed toward Supplier A1A_1's 4% because that supplier contributes the largest share.

Example 2 — A countably infinite partition (geometric number of trials). A machine attempts to complete a task repeatedly; on each attempt it succeeds independently with probability p=0.3p = 0.3. Let NN be the attempt number on which the first success occurs, so NN is geometric on {1,2,3,…}\{1, 2, 3, \ldots\} with

P(N=n)=(1−p)n−1p=(0.7)n−1(0.3),n=1,2,3,….P(N = n) = (1-p)^{n-1} p = (0.7)^{n-1}(0.3), \qquad n = 1, 2, 3, \ldots.

This gives a countably infinite partition {An}n=1∞\{A_n\}_{n=1}^\infty of the sample space, An={N=n}A_n = \{N = n\}: exactly one value of NN occurs, so the AnA_n are disjoint, and ∑n=1∞P(N=n)=1\sum_{n=1}^{\infty} P(N=n) = 1 (a standard geometric series check: ∑n=1∞(0.7)n−1(0.3)=0.3⋅11−0.7=0.3⋅10.3=1\sum_{n=1}^\infty (0.7)^{n-1}(0.3) = 0.3 \cdot \frac{1}{1-0.7} = 0.3 \cdot \frac{1}{0.3} = 1), so they are exhaustive. Suppose that once the machine finally succeeds on attempt N=nN=n, it then produces a usable output with probability rn=1n+1r_n = \frac{1}{n+1} (later successes are "rustier," modeling wear), i.e. P(U∣An)=1n+1P(U \mid A_n) = \frac{1}{n+1}, where UU is the event of a usable output. We want P(U)P(U), the overall (marginal) probability the eventual output is usable. By the Law of Total Probability (countable partition case),

P(U)=∑n=1∞P(U∣An)P(An)=∑n=1∞1n+1⋅(0.7)n−1(0.3).P(U) = \sum_{n=1}^{\infty} P(U \mid A_n) P(A_n) = \sum_{n=1}^{\infty} \frac{1}{n+1} \cdot (0.7)^{n-1}(0.3).

Write q=0.7q = 0.7. Then

P(U)=0.3∑n=1∞qn−1n+1.P(U) = 0.3 \sum_{n=1}^{\infty} \frac{q^{n-1}}{n+1}.

Reindex with k=n+1k = n+1 (so n=k−1n = k-1, kk runs from 22 to ∞\infty):

∑n=1∞qn−1n+1=∑k=2∞qk−2k=1q2∑k=2∞qkk.\sum_{n=1}^{\infty} \frac{q^{n-1}}{n+1} = \sum_{k=2}^{\infty} \frac{q^{k-2}}{k} = \frac{1}{q^2}\sum_{k=2}^{\infty} \frac{q^k}{k}.

Recall the Taylor series −ln⁡(1−q)=∑k=1∞qkk-\ln(1-q) = \sum_{k=1}^{\infty} \frac{q^k}{k} for ∣q∣<1|q| < 1, so ∑k=2∞qkk=−ln⁡(1−q)−q\sum_{k=2}^\infty \frac{q^k}{k} = -\ln(1-q) - q. With q=0.7q = 0.7:

−ln⁡(0.3)−0.7≈1.20397−0.7=0.50397.-\ln(0.3) - 0.7 \approx 1.20397 - 0.7 = 0.50397.

Then

∑n=1∞qn−1n+1=0.50397q2=0.503970.49≈1.02851.\sum_{n=1}^{\infty} \frac{q^{n-1}}{n+1} = \frac{0.50397}{q^2} = \frac{0.50397}{0.49} \approx 1.02851.

Finally,

P(U)=0.3×1.02851≈0.30855.P(U) = 0.3 \times 1.02851 \approx 0.30855.

So despite each individual conditional probability P(U∣An)=1n+1P(U\mid A_n) = \frac{1}{n+1} shrinking toward 0, the overall probability of a usable output is about 30.9%, dominated by the early terms (n=1n=1 contributes P(U∣A1)P(A1)=12⋅0.3=0.15P(U\mid A_1)P(A_1) = \frac12 \cdot 0.3 = 0.15, already about half the total) because early successes are by far the most likely outcomes under the geometric distribution.

CounterexampleDropping exhaustiveness breaks the identity

Consider a single fair die roll, Ω={1,2,3,4,5,6}\Omega = \{1,2,3,4,5,6\}, each outcome equally likely with probability 16\frac{1}{6}. Let BB be the event "the roll is even," so P(B)=36=12P(B) = \frac{3}{6} = \frac12. Now define A1={1,2}A_1 = \{1, 2\} and A2={3,4}A_2 = \{3, 4\}. These are pairwise disjoint, but they are not exhaustive: A1∪A2={1,2,3,4}≠ΩA_1 \cup A_2 = \{1,2,3,4\} \neq \Omega, since 55 and 66 are missing. Compute the (incorrect) sum anyway:

P(A1)=26=13,P(A2)=26=13,P(A_1) = \tfrac{2}{6}=\tfrac13,\quad P(A_2) = \tfrac{2}{6}=\tfrac13,
P(B∣A1)=P({2}∣{1,2})=12,P(B∣A2)=P({4}∣{3,4})=12.P(B\mid A_1) = P(\{2\}\mid\{1,2\}) = \tfrac12,\qquad P(B \mid A_2) = P(\{4\}\mid\{3,4\}) = \tfrac12.

So the naive sum gives

∑i=12P(B∣Ai)P(Ai)=12⋅13+12⋅13=13,\sum_{i=1}^{2} P(B\mid A_i)P(A_i) = \tfrac12 \cdot \tfrac13 + \tfrac12\cdot\tfrac13 = \tfrac13,

but the true value is P(B)=12≠13P(B) = \frac12 \neq \frac13. The discrepancy is exactly the missing mass: outcomes 55 and 66 (probability 26=13\frac26 = \frac13 combined) include the even outcome 66, which was never accounted for. Without exhaustiveness, the decomposition B=⋃i(B∩Ai)B = \bigcup_i (B \cap A_i) in Step 1 of the proof fails — B∩{5,6}={6}B \cap \{5,6\} = \{6\} is left out entirely — so the additivity argument no longer computes all of P(B)P(B). This shows the exhaustiveness hypothesis is not a technicality: remove it, and the formula silently undercounts.

Scope, edge cases & common traps

SituationWhat happensCorrect handling
Some P(Ai)=0P(A_i) = 0P(B∣Ai)P(B\mid A_i) undefinedDrop such AiA_i from the sum, or define P(B∣Ai)P(Ai):=0P(B\mid A_i)P(A_i) := 0 by convention (measure-theoretic extension)
Countably infinite partitionSeries may need careTerms are nonnegative, so the sum is well-defined (possibly as a convergent series); no rearrangement issues arise
Partition not exhaustiveFormula undercounts P(B)P(B)Verify ∑iP(Ai)=1\sum_i P(A_i) = 1 before applying the law
Partition not disjointDouble-counts overlapping probabilityVerify pairwise disjointness; refine the partition if events overlap
Conditioning event chosen after seeing BBReversed conditioning neededUse Bayes' Theorem to invert P(Ai∣B)P(A_i \mid B) from P(B∣Ai)P(B\mid A_i)

The mathematician behind it

Origins · 1 minAndrey Nikolaevich Kolmogorov and how this was discovered
AN
Andrey Nikolaevich Kolmogorov
1903–1987 · Soviet Union

Kolmogorov gave probability theory its modern axiomatic foundation in his 1933 monograph Grundbegriffe der Wahrscheinlichkeitsrechnung, grounding it in measure theory. The Law of Total Probability, as a direct consequence of countable additivity and conditional probability, is a natural corollary of his axioms rather than a separately postulated rule — it exists because probability is a measure, and measures add over disjoint pieces. Kolmogorov's framework unified decades of informal reasoning about partitions and cases (used implicitly by Bayes, Laplace, and others) into a single rigorous calculus.

History
- 1654 — Pascal and Fermat's correspondence on games of chance introduces case-based reasoning about disjoint outcomes.
- 1763 — Thomas Bayes's posthumously published essay uses partition-style reasoning to invert conditional probabilities.
- 1812 — Pierre-Simon Laplace's Théorie analytique des probabilités systematizes the "rule of total probability" in the language of causes and effects.
- 1933 — Kolmogorov's axiomatization derives the law rigorously from countable additivity of a probability measure.
- 1950s onward — the law becomes a standard tool in statistics, information theory, and decision theory, embedded in every textbook treatment of conditional probability.
Why do we need the events AiA_i to have P(Ai)>0P(A_i) > 0?

Conditional probability P(B∣Ai)=P(B∩Ai)/P(Ai)P(B\mid A_i) = P(B\cap A_i)/P(A_i) is only defined when the denominator is nonzero; dividing by zero is meaningless. If some AiA_i has probability zero, it simply cannot contribute a well-defined conditional term, but this causes no real loss: the event AiA_i has zero chance of occurring, so P(Ai)=0P(A_i) = 0 means the term P(B∣Ai)P(Ai)P(B\mid A_i)P(A_i), if assigned the value 00 by convention, contributes nothing to the sum regardless of what P(B∣Ai)P(B\mid A_i) "would be." In practice, one simply restricts the sum to those AiA_i with strictly positive probability, and the identity remains exactly correct.

Is the Law of Total Probability the same as computing an expected value?

Yes, in a precise sense: if XX is the indicator random variable of BB (equal to 1 if BB occurs, 0 otherwise), then P(B)=E[X]P(B) = E[X], and the Law of Total Probability is exactly the statement that E[X]=∑iE[X∣Ai]P(Ai)E[X] = \sum_i E[X \mid A_i] P(A_i), which is itself a special case of the general Law of Total Expectation (also called the tower property). So total probability is the indicator-random-variable instance of a much more general averaging principle used throughout probability theory.

Does the law require the partition to be finite?

No. As proven above, the law holds equally for a countably infinite partition {Ai}i=1∞\{A_i\}_{i=1}^\infty, as long as countable additivity of the probability measure is invoked (which is one of Kolmogorov's axioms). The only subtlety is that the resulting sum is an infinite series rather than a finite sum, but since every term is nonnegative and the partial sums never exceed P(B)≤1P(B) \le 1, the series always converges — there is no risk of divergence or conditional-convergence subtleties.

How does this relate to Bayes' Theorem?

The Law of Total Probability typically supplies the denominator in Bayes' Theorem. Bayes' rule computes P(Ai∣B)=P(B∣Ai)P(Ai)P(B)P(A_i \mid B) = \dfrac{P(B\mid A_i)P(A_i)}{P(B)}, and since P(B)P(B) itself is rarely given directly, it is computed via the Law of Total Probability as ∑jP(B∣Aj)P(Aj)\sum_j P(B\mid A_j)P(A_j). In this sense, total probability is the essential preprocessing step that makes Bayesian inversion computable from conditional data alone, without needing to separately measure the marginal probability of the evidence.

Can I apply the law with overlapping (non-disjoint) events?

Not directly — the theorem as stated requires pairwise disjointness, because the proof relies on additivity over disjoint pieces. If your candidate events overlap, applying the sum formula will overcount the intersection's probability. The fix is to refine the collection into genuinely disjoint atoms (for instance, using inclusion–exclusion, or by intersecting overlapping events with their complements to build a proper partition) before applying the law.

What's a common real-world pitfall when setting up the partition?

The most frequent error is choosing "cases" that feel natural (e.g., age brackets, weather categories, machine types) without verifying that every possible outcome falls into exactly one category. Boundary outcomes are often missed (an age exactly at a cutoff, a "cloudy" day that is neither clearly "rain" nor "sun") or double-counted. Before summing, always check numerically that the chosen probabilities of the AiA_i actually add to 1, which catches most partition errors immediately.

Does the Law of Total Probability tell us anything about independence?

Not directly, but it interacts cleanly with independence: if BB is independent of the partition (i.e., P(B∣Ai)=P(B)P(B\mid A_i) = P(B) for every ii), the law reduces to the trivial identity P(B)=P(B)∑iP(Ai)=P(B)P(B) = P(B)\sum_i P(A_i) = P(B). The interesting, informative cases are precisely when P(B∣Ai)P(B\mid A_i) genuinely varies across ii, which is exactly the situation in the worked examples above — different suppliers or different attempt numbers give meaningfully different conditional probabilities.

Before this

Where this leads