Search

Search papers and lessons

Conditional Probability

Level 1 · 9 min read

Conditional probability is the chance of an event once you know another event happened: it restricts attention to that case and renormalises.

On this page

  • Colour = topic mix
  • Probability
  • Sign in to see your progress

TL;DR

The probability of an event AA changes once you learn that another event BB happened. The conditional probability P(A∣B)P(A \mid B) is the chance of AA in the world where BB is already true. You compute it by throwing away every outcome outside BB and asking what fraction of the remaining outcomes also have AA.

Conditioning is how evidence enters probability. Every update, from a weather forecast to a medical test result, is a conditional probability.

Where you'll see it: in a spam filter asking how likely a message is to be spam given the words it contains, and in a Markov chain asking where the system goes next given where it is now.

Intuition

Narrowing the world

Suppose you draw one card from a standard deck and ask (this builds on Probability): is it a king? The answer is 4 in 52. Now someone tells you the card is a face card (a jack, queen or king). The question has changed. The other 40 cards are gone from consideration, and of the 12 face cards, 4 are kings. The answer is now 4 in 12.

Nothing about the card changed. The information shrank the set of possibilities you still consider, and the probability is the share of the surviving possibilities that match what you care about. That is the whole idea. The rest is notation and arithmetic.

flowchart LR
  S[All outcomes] --> B[Outcomes where B happened]
  B --> AB[Outcomes where A and B both happened]
  AB --> R[P of A given B: the share of B that is also A]

Why the notation matters

The bar in P(A∣B)P(A \mid B) means "given". It separates what you are asking about from what you know. Writing P(A)P(A) and P(A∣B)P(A \mid B) as different quantities keeps you honest: they are different questions, and they often have different answers. Confusing them is one of the most common mistakes in probability, and the tradeoffs section comes back to it.

The math

Definition

Definition: Conditional probability

For events AA and BB with P(B)>0P(B) \gt 0, the conditional probability of AA given BB is

P(A∣B)=P(A∩B)P(B).P(A \mid B) = \frac{P(A \cap B)}{P(B)}.

Here P(A∩B)P(A \cap B) is the probability that both AA and BB happen, and P(B)P(B) is the probability of the event you are conditioning on. Dividing by P(B)P(B) rescales so that the conditioned world has total probability 1. Without that division, P(A∩B)P(A \cap B) would be too small, because it is measured against the whole space rather than against BB.

The requirement P(B)>0P(B) \gt 0 is real. If BB can never happen, the ratio has a zero denominator and there is nothing to condition on.

Multiplication rule

Rearranging the definition gives

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

This is often the more useful form. To find the chance of two things happening in sequence, multiply the first chance by the chance of the second, given the first. Extending it to three events:

P(A∩B∩C)=P(A∣B∩C) P(B∣C) P(C).P(A \cap B \cap C) = P(A \mid B \cap C)\, P(B \mid C)\, P(C).

Conditioning is a probability

For a fixed BB with P(B)>0P(B) \gt 0, the function A↦P(A∣B)A \mapsto P(A \mid B) satisfies the same rules as any probability. It is between 0 and 1, the whole sample space has conditional probability 1, and for disjoint events A1A_1 and A2A_2 the probabilities add. So everything you know about probabilities applies once you condition. You are simply working in a smaller universe.

Independence in one line

Two events are independent when learning one tells you nothing about the other:

P(A∣B)=P(A)⟺P(A∩B)=P(A) P(B).P(A \mid B) = P(A) \quad \Longleftrightarrow \quad P(A \cap B) = P(A)\,P(B).

Independence is therefore the special case where conditioning changes nothing. See statistical independence for the full treatment.

Worked examples

Example
Two dice, a restricted view

Roll two fair dice. Let AA be "the sum is 8" and BB be "the first die shows 3".

  1. Outcomes with a first die of 3 are (3,1),(3,2),…,(3,6)(3,1), (3,2), \dots, (3,6), so P(B)=6/36=1/6P(B) = 6/36 = 1/6.
  2. Among those six outcomes, only (3,5)(3,5) sums to 8. So P(A∩B)=1/36P(A \cap B) = 1/36.
  3. Apply the definition: P(A∣B)=(1/36)/(1/6)=1/6P(A \mid B) = (1/36) / (1/6) = 1/6.
  4. Check by the simple view: once the first die is 3, the second must be 5, and that happens with chance 1/61/6.

Interpretation: knowing the first die is 3 leaves the sum equally likely to be any value from 4 to 9, so the chance of 8 is one in six. Compare this with P(A)=5/36≈0.139P(A) = 5/36 \approx 0.139 for an unconditioned sum of 8. The information raised the chance.

Example
A medical test

A disease affects 1% of a population. A test catches 90% of sick people (true positive rate). It wrongly flags 5% of healthy people (false positive rate). A person tests positive. What is the chance they are sick?

Let DD be "sick" and TT be "tests positive". We want P(D∣T)P(D \mid T).

  1. Joint chances: P(D∩T)=P(T∣D) P(D)=0.90×0.01=0.009P(D \cap T) = P(T \mid D)\,P(D) = 0.90 \times 0.01 = 0.009.
  2. Healthy and positive: P(Dc∩T)=0.05×0.99=0.0495P(D^c \cap T) = 0.05 \times 0.99 = 0.0495.
  3. Total chance of a positive result: P(T)=0.009+0.0495=0.0585P(T) = 0.009 + 0.0495 = 0.0585.
  4. Divide: P(D∣T)=0.009/0.0585≈0.154P(D \mid T) = 0.009 / 0.0585 \approx 0.154.
  5. About 15%.

Interpretation: a positive result is strong evidence, since the chance rose from 1% to about 15%, but most positives are still false alarms. Here the answer comes straight from the definition. The Bayes' rule lesson shows how to get the same number when the inputs are given in the reverse direction.

Example
Drawing without replacement

A bag holds 3 red and 2 blue balls. You draw two balls without replacement. What is the chance both are red?

  1. Let R1R_1 be "first ball red" and R2R_2 be "second ball red".
  2. P(R1)=3/5P(R_1) = 3/5.
  3. After one red is removed, the bag holds 2 red and 2 blue, so P(R2∣R1)=2/4=1/2P(R_2 \mid R_1) = 2/4 = 1/2.
  4. Multiply: P(R1∩R2)=(3/5)(1/2)=3/10=0.3P(R_1 \cap R_2) = (3/5)(1/2) = 3/10 = 0.3.

Interpretation: the second draw depends on the first. Ignoring that and multiplying 3/53/5 by 3/53/5 would give 0.360.36, which is wrong.

Tradeoffs and failure modes

Conditional probability is easy to define and easy to misuse. The table lists common situations.

SituationWhat goes wrongBetter choice
Swapping the two sides, P(A∣B)P(A \mid B) for P(B∣A)P(B \mid A)The prosecutor's fallacy: a rare match given innocence is read as a low chance of innocenceWrite both directions and apply [[bayes-rule
Ignoring the base rateThe 15% result in the medical example looks like 90%Always multiply by the prior before reading a test
Conditioning on a zero-probability eventThe ratio is undefinedUse a limit or a density, or condition on a coarser event
Conditioning on a result of your own choosingSelecting data after seeing it inflates apparent effectsFix the condition before collecting data
Assuming independence without checkingMultiplying chances that are linked gives the wrong answerCompute P(A∣B)P(A \mid B) directly, or justify independence

Some practical warnings:

  • P(A∣B)P(A \mid B) is not P(B∣A)P(B \mid A) in general. The probability that a person is a pilot given they wear a uniform is not the probability they wear a uniform given they are a pilot.
  • Conditioning on something caused by both variables creates a fake link. If you only look at admitted students, a hard-working and a well-connected applicant can look negatively related, even if they are independent in the whole pool. This is called collider bias or selection bias.
  • The definition needs a consistent model. Conditional probabilities are only as good as the joint probabilities behind them. If the model of P(A∩B)P(A \cap B) is wrong, every conditional value inherits the error.

History

Conditional reasoning is much older than the formula. In 1654 Blaise Pascal and Pierre de Fermat exchanged letters about the problem of points: how to split the stake of an unfinished game fairly. Their answers depended on what had already happened in the game, which is conditioning in practice, though neither wrote the general definition.

The idea of revising a probability with new evidence came with Thomas Bayes, whose essay on the topic appeared in 1763 after his death, and Pierre-Simon Laplace, who used the inverse form widely in the 1770s and 1780s. Both worked with what would later be called Bayes' rule, which is built on conditional probabilities.

The modern definition, P(A∩B)/P(B)P(A \cap B) / P(B), was made formal by Andrey Kolmogorov in his 1933 book Foundations of the Theory of Probability. Kolmogorov built probability on measure theory and defined conditional probability as a ratio of measures. That made it a precise object that could be used in stochastic processes, statistics and later machine learning. It caught on because it is short, intuitive (restrict and renormalise) and works everywhere the other axioms do.

Check yourself

QuestionA jar has 4 green and 6 yellow marbles. You pick one at random and it is yellow. What is the chance the next pick, without replacement, is also yellow?Show answer

After one yellow is removed, 5 yellow and 4 green remain, so P=5/9≈0.556P = 5/9 \approx 0.556. The second draw depends on the first because the composition of the jar changed.

QuestionCompute P(A∣B)P(A \mid B) for a fair die, where AA is the event that the roll is even and BB is the event that the roll is at least 3. Show the counts.Show answer

The outcomes in BB are {3,4,5,6}\{3, 4, 5, 6\}, so P(B)=4/6P(B) = 4/6. The outcomes in A∩BA \cap B are {4,6}\{4, 6\}, so P(A∩B)=2/6P(A \cap B) = 2/6. Then P(A∣B)=(2/6)/(4/6)=1/2P(A \mid B) = (2/6)/(4/6) = 1/2. Restricting to BB leaves two even and two odd outcomes, which is why the answer is one half.

QuestionWhy is P(A∣B)=P(A)P(A \mid B) = P(A) the same thing as saying AA and BB are independent, and why does this matter for multiplying probabilities?Show answer

Substituting P(A∣B)=P(A)P(A \mid B) = P(A) into the multiplication rule gives P(A∩B)=P(A) P(B)P(A \cap B) = P(A)\,P(B), which is the definition of independence. Only then can you multiply the two individual probabilities to get the probability of both. If the events are linked, the product is wrong, as the drawing-without-replacement example shows.

QuestionA test is 99% accurate in both directions and the disease has a 0.1% base rate. Someone tests positive. Without computing, is the chance they are sick closer to 99% or to 10%? Explain briefly.Show answer

Closer to 10%, roughly. Among 100,000 people, about 100 are sick and 99 of those test positive, while about 1 in 100 of the 99,900 healthy people, roughly 999, also test positive. So about 1,100 test positives, of which 99 are sick, which is near 9%. The base rate dominates because healthy people are so numerous, so most positives are false.

Sources