Conditional Probability
View .md

Total Probability Theorem

Suppose you want the probability that a widget is defective. You could try to count defective widgets directly — but what if the factory has multiple machines, each with a different defect rate, and you don’t know which machine made a given widget? You can’t just use one defect rate; you need to account for all of them.

Let’s label things: call the event we care about “BB” (the widget is defective), and call the possible scenarios “A1,A2,…,AnA_1, A_2, \ldots, A_n” (machine 1, machine 2, …). We use different letters because BB and the AiA_i’s play different roles — BB is the event whose probability we want, and the AiA_i’s are the mutually exclusive cases that cover all possibilities. The total probability theorem says you can compute P(B)P(B) by adding up each scenario’s contribution: the probability of that scenario times the probability of BB given that scenario. The result is a weighted average — scenarios that are more likely get more weight.

Partition

The theorem requires that the scenarios A1,A2,…,AnA_1, A_2, \ldots, A_n form a partition of the sample space — mutually exclusive, collectively exhaustive events where every outcome belongs to exactly one AiA_i.

The Theorem

If A1,A2,…,AnA_1, A_2, \ldots, A_n form a partition, then for any event BB:

P(B)=∑i=1nP(Ai)⋅P(B∣Ai)P(B) = \sum_{i=1}^{n} P(A_i) \cdot P(B | A_i)

Reading the formula: P(Ai)P(A_i) is how likely scenario ii is. P(B∣Ai)P(B | A_i) is the probability of BB if scenario ii occurred. Their product P(Ai)⋅P(B∣Ai)P(A_i) \cdot P(B | A_i) is the probability that scenario ii occurs and BB also occurs. Summing over all scenarios gives the total probability of BB.

Derivation & Interpretation

Step 1: Break BB into pieces using the partition

Every outcome in BB must belong to at least one AiA_i (the partition covers all of Ω\Omega). And no outcome can belong to two different AiA_i’s (they’re mutually exclusive). So BB splits cleanly into non-overlapping pieces:

B=(A1∩B)  ∪  (A2∩B)  ∪  ⋯∪  (An∩B)B = (A_1 \cap B) \;\cup\; (A_2 \cap B) \;\cup\; \cdots \cup\; (A_n \cap B)

The big union notation ⋃i=1n\bigcup_{i=1}^n is just shorthand for this chain of “OR” — it means “the union of all these sets, from i=1i=1 to i=ni=n.”

B=⋃i=1n(Ai∩B)B = \bigcup_{i=1}^n (A_i \cap B)

Think of it like slicing a pie: BB is the whole pie, and each Ai∩BA_i \cap B is one slice. The slices don’t overlap and together make up the whole.

Step 2: From OR to ADD — why the union becomes a sum

Step 1 is a set equation — sets combine with union (OR). You can’t add sets. But once we take the probability of both sides, we’re dealing with numbers, and numbers add:

P(B)=P ⁣(⋃i=1n(Ai∩B))=∑i=1nP(Ai∩B)P(B) = P\!\left(\bigcup_{i=1}^n (A_i \cap B)\right) = \sum_{i=1}^n P(A_i \cap B)

Why can we turn OR into ADD? Because the pieces are disjoint — an outcome can’t be in both A1∩BA_1 \cap B and A2∩BA_2 \cap B, since it can’t be in both A1A_1 and A2A_2. For disjoint events, the probability of their union equals the sum of their probabilities (axiom 3). Without disjointness, this step fails — you’d double-count outcomes that appear in multiple pieces.

This OR → ADD step is the whole reason the theorem works. The partition guarantees no overlap, so no double-counting.

Step 3: Apply the multiplication rule to each piece

By the multiplication rule, each piece P(Ai∩B)=P(Ai)⋅P(B∣Ai)P(A_i \cap B) = P(A_i) \cdot P(B \mid A_i). Substituting:

P(B)=∑i=1nP(Ai)⋅P(B∣Ai)P(B) = \sum_{i=1}^n P(A_i) \cdot P(B \mid A_i)

That’s the theorem. Three steps: slice → add → expand.

What the formula means

Each term P(Ai)⋅P(B∣Ai)P(A_i) \cdot P(B \mid A_i) is one scenario’s contribution:

Piece Scenario weight P(Ai)P(A_i) Conditional prob P(B∣Ai)P(B \mid A_i) Contribution P(Ai)⋅P(B∣Ai)P(A_i) \cdot P(B \mid A_i)
A1∩BA_1 \cap B How likely scenario 1 is Prob of BB if scenario 1 occurred Scenario 1’s share of P(B)P(B)
A2∩BA_2 \cap B How likely scenario 2 is Prob of BB if scenario 2 occurred Scenario 2’s share of P(B)P(B)
⋮\vdots ⋮\vdots ⋮\vdots ⋮\vdots
An∩BA_n \cap B How likely scenario nn is Prob of BB if scenario nn occurred Scenario nn’s share of P(B)P(B)
Total P(B)P(B)

The total probability P(B)P(B) is a weighted average — each scenario contributes proportionally to how often it occurs. A scenario that happens 60% of the time carries 60% of the weight, regardless of its conditional probability P(B∣Ai)P(B \mid A_i).

Example: Manufacturing

A factory has 3 machines producing widgets:

  • Machine A: 50% of widgets, 2% defective
  • Machine B: 30% of widgets, 4% defective
  • Machine C: 20% of widgets, 5% defective

What’s the probability a widget is defective?

P(D)=0.5×0.02+0.3×0.04+0.2×0.05=0.033P(D) = 0.5 \times 0.02 + 0.3 \times 0.04 + 0.2 \times 0.05 = 0.033

The partition is {A,B,C}\{A, B, C\} — every widget comes from exactly one machine. Machine A contributes the most weight (0.5) because it produces the most widgets, even though its defect rate is the lowest.

Visual: Probability Tree

Sum defective paths: 0.01+0.012+0.01=0.0330.01 + 0.012 + 0.01 = 0.033

Special Case: Equally Likely Partition

When all P(Ai)=1nP(A_i) = \frac{1}{n}, the formula simplifies to an average:

P(B)=1n∑i=1nP(B∣Ai)P(B) = \frac{1}{n} \sum_{i=1}^n P(B | A_i)


Key Terms

Total Probability TheoremP(B)=∑iP(B∣Ai)⋅P(Ai)P(B) = \sum_i P(B|A_i) \cdot P(A_i) — the total probability of B, partitioned into mutually exclusive cases A_i.
Weighted AverageAn average where each value is multiplied by its weight (probability) before summing — the Total Probability Theorem computes a weighted average of conditional probabilities