Skip to content
LoveToCalc

Theorem — what does that mean?

Law of total probability

The probability of A, worked out branch by branch: once for when B happens and once for when it does not.

In Swedish: Lagen om total sannolikhet

Law of total probability

The relation

P(A)=P(A|B)P(B)+P(A|B̄)(1−P(B))

The probability of A found by splitting on whether B happens: the probability of A given B times the probability of B, plus the probability of A given not-B times the probability of not-B.

A probability tree that first splits on B, with probability P(B), or not B, and then on A. The two paths that end in A, one through B with probability P(A|B) and one through not B with probability P(A|B̄), are bracketed together: their sum is P(A).
Solve for

P(A)=0.345

P(A) equals (0.8 times 0.3) plus (0.15 times (1 minus 0.3)), equals 0.24 plus (0.15 times 0.7), equals 0.24 plus 0.105, equals 0.345

Working4 steps

Practice questions

You are given

  • P(A|B)=0.9
  • P(B)=0.2
  • P(A|B̄)=0.05

The formula

P(A) = P(A|B) · P(B) + P(A|B̄) · P(B̄)

Holds when 0 < P(B) < 1, so that both conditional probabilities are defined.

B̄ (not-B, also written Bᶜ or B′) is the complement of B, and P(B̄) = 1 − P(B). The card writes it that way, because the two branches have to cover everything that can happen: B and B̄ cannot both occur, and one of them does.

Each term is one branch of a tree diagram: the probability of getting onto the branch times the probability of A along it.

It rains on three mornings in ten — P(rain) = 0.3. When it rains the bus is late with probability 0.8, otherwise with probability 0.15. What is the probability the bus is late?

P(late) = 0.8 · 0.3 + 0.15 · 0.7 = 0.24 + 0.105 = 0.345.

The same thing counted over 1,000 mornings: 300 rainy, 240 of them with a late bus; 700 dry, 105 of them with a late bus. 345 in 1,000.

Two usual slips

Working Answer
Wrong: the conditionals added 0.8 + 0.15 0.95
Wrong: second branch times P(B) 0.8 · 0.3 + 0.15 · 0.3 0.285
Right 0.8 · 0.3 + 0.15 · 0.7 0.345

The first ignores that the branches carry different weights; the second weights the dry branch by the probability of rain. The check is that P(A) lands between P(A|B) and P(A|B̄) — it is a weighted average of the two — and 0.345 lies between 0.15 and 0.8.

When the branches agree

If the bus is late with probability 0.2 whatever the weather, P(late) = 0.2 · 0.3 + 0.2 · 0.7 = 0.2. Then P(B) makes no difference, which is what it means for A and B to be independent. The card refuses to solve for P(B) when the two conditionals are equal: P(A) then says nothing about P(B).

More than two branches

The law holds for any split, as long as the branches exclude each other and together cover every outcome. Three machines make 50%, 30% and 20% of a product, with defect rates of 2%, 4% and 5%:

Machine Share Defect rate Product
1 0.5 0.02 0.010
2 0.3 0.04 0.012
3 0.2 0.05 0.010
Total 1 0.032

The next step is often to turn the question round: given that the bus was late, how likely is it that it rained? That is Bayes’ theorem, with 0.345 as the denominator: 0.24 / 0.345 ≈ 0.70.

Common mistakes

Questions people ask

Why is the formula true? A happens either together with B or together with B̄, never both. So P(A) = P(A∩B) + P(A∩B̄), and each of those is a conditional probability times its condition: P(A∩B) = P(A|B) · P(B).

Do I need the formula if I draw a tree diagram? No, it is the same calculation. Multiplying along the branches and adding the branches that end in A is exactly what the formula says.

Can I work backwards? Yes. Knowing P(A) and the two conditionals, the formula gives P(B) = (P(A) − P(A|B̄)) / (P(A|B) − P(A|B̄)). The card solves for any of the four.

Looking for another letter? The formula solved for each one
Solved for each letter
Solve forRearrangedWith the numbersComes to
P(A)P(A|B)P(B)+P(A|B̄)(1−P(B))0.8·0.3+0.15(1−0.3)0.345
P(A|B)P(A)−P(A|B̄)(1−P(B))P(B)0.345−0.15(1−0.3)0.30.8
P(B)P(A)−P(A|B̄)P(A|B)−P(A|B̄)0.345−0.150.8−0.150.3
P(A|B̄)P(A)−P(A|B)P(B)1−P(B)0.345−0.8·0.31−0.30.15

Last reviewed October 7, 2026 ·How pages are reviewed

Read more in articles

Statistics and probabilityAll formulas

Put this formula on your site

Copy the code into your page where the formula card should appear. It loads from lovetocalc.com, so it stays current on its own — all we ask is that the credit line comes with it.