What is conditional probability, and how does it differ from joint probability?
Conditional probability P(A|B) is the probability of A after learning that B occurred, computed as P(A and B) divided by P(B). Joint probability P(A and B) is the probability that both events occur in the full sample space, so conditional probability changes the denominator while joint probability does not.
How to think about it
Conditional probability P(A | B) is the probability of event A after we know that event B has occurred. Joint probability P(A ∩ B) is the probability that A and B occur together, measured against the full set of possible outcomes.
The formula for conditional probability is:
P(A | B) = P(A ∩ B) / P(B), provided P(B) > 0.
The important difference is the denominator. Joint probability asks, “How often do both events happen?” Conditional probability asks, “Among the cases where B happened, how often did A happen?”
Why the denominator changes
An event is a set of outcomes that satisfies some condition. In a card draw, “the card is a King” is one event. The sample space is the full set of possible outcomes: all 52 cards.
Suppose:
- A means “the card is a King”
- B means “the card is a face card”
There are four Kings and twelve face cards. The face cards are the four Jacks, four Queens, and four Kings.
The joint event A and B means the card is both a King and a face card. There are four such cards, so:
P(A ∩ B) = 4 / 52 = 1 / 13
That is a probability in the original sample space of 52 cards.
Now suppose someone tells us, truthfully, that the card is a face card. The possible outcomes have been narrowed from 52 cards to 12. The 40 non-face cards are no longer relevant; they cannot be the card we are holding.
Among those 12 remaining cards, four are Kings. Therefore:
P(A | B) = 4 / 12 = 1 / 3
The ratio formula reaches the same result:
P(A | B) = (4 / 52) / (12 / 52) = 4 / 12 = 1 / 3
Dividing by P(B) rescales the joint event so that the reduced world, the world where B is true, has total probability one.
That rescaling is the mechanism. It is not a decorative fraction attached to the notation.
The card example answers three different questions
The same deck can produce three different probabilities:
| Question | Calculation | Result |
|---|---|---|
| What is the chance of a King? | 4 / 52 | 1 / 13, about 7.7% |
| What is the chance of a King and a face card? | 4 / 52 | 1 / 13, about 7.7% |
| Given a face card, what is the chance of a King? | 4 / 12 | 1 / 3, about 33.3% |
The first is a marginal probability, meaning the probability of one event without conditioning on another. The second is a joint probability. In this particular example, they happen to be equal because every King is a face card. The third is conditional.
The direction matters even more if we reverse the condition:
P(B | A) = P(face card | King) = 4 / 4 = 1
Every King is a face card, so this conditional probability is 100 percent.
But:
P(A | B) = P(King | face card) = 4 / 12 = 1 / 3
“Every King is a face card” does not mean “every face card is a King.” That reversal is one of the most common mistakes in probability interviews and in production dashboards.
Common trap — the two conditionals are not interchangeable.
P(A | B)asks about A inside the group B.P(B | A)asks about B inside the group A. They usually have different denominators and different answers.
The multiplication rule connects them
Rearranging the conditional-probability formula gives the multiplication rule:
P(A ∩ B) = P(A | B) × P(B)
For the card example:
P(A ∩ B) = (4 / 12) × (12 / 52) = 4 / 52
Read that as a two-stage process:
- The chance of getting a face card is
12 / 52. - Once inside the face-card group, the chance of getting a King is
4 / 12. - The chance of both steps happening is their product,
4 / 52.
You can also reverse the order:
P(A ∩ B) = P(B | A) × P(A)
That gives:
1 × (4 / 52) = 4 / 52
This is why conditional probabilities are central to Bayesian reasoning, classifiers, and probabilistic graphical models. They let us factor a joint event into a sequence of smaller questions.
A data example, and the denominator bug
Imagine a product team measures purchases over 1,000 sessions:
- 600 sessions were on mobile.
- 120 mobile sessions ended in a purchase.
- 30 desktop sessions ended in a purchase.
- There were 150 purchases overall.
Let A mean “the session ended in a purchase.” Let B mean “the session was on mobile.”
The conditional mobile conversion rate is:
P(A | B) = 120 / 600 = 0.20
So mobile conversion was 20 percent.
The joint probability of a session being both mobile and a purchase is:
P(A ∩ B) = 120 / 1,000 = 0.12
So 12 percent of all sessions were mobile purchases.
Those are both valid numbers, but they answer different questions. A dashboard that labels 12 percent as “mobile conversion” has used the full-session denominator where it needed the mobile-session denominator. The symptom is easy to spot: the reported mobile rate is really a share of all traffic, not a rate within mobile traffic.
This is the same mistake as answering the face-card question with 4 / 52 instead of 4 / 12.
The senior-level nuances
Conditional probability is not causation
If P(King | face card) is higher than P(King), the information that the card is a face card is useful evidence about whether it is a King. It does not mean being a face card causes a card to become a King.
The same distinction matters in analytics. If customers who receive a discount purchase more often, P(purchase | discount) may be high. That does not by itself prove the discount caused the purchases. Perhaps the company sends discounts to customers who were already likely to buy. Conditional probability describes an association after conditioning; causal inference requires a stronger design, such as randomization or a defensible causal model.
Independence is a special case
Two events are independent when knowing that one occurred does not change the probability of the other. Mathematically:
P(A | B) = P(A)
For independent events, the joint probability becomes:
P(A ∩ B) = P(A) × P(B)
The King and face-card events are not independent. Before receiving information, P(King) is 1 / 13. After learning that the card is a face card, P(King | face card) rises to 1 / 3.
A useful contrast is two fair coin tosses. Let A be “the first toss is heads” and B be “the second toss is heads.” The first result does not affect the second:
P(A) = 1 / 2
P(B | A) = 1 / 2
P(A ∩ B) = 1 / 2 × 1 / 2 = 1 / 4
Do not confuse independence with mutually exclusive events. Mutually exclusive events cannot happen together. If two events have positive probability and are mutually exclusive, learning that one occurred makes the other probability zero, so they are not independent.
Rare conditions make estimates noisy
The definition of conditional probability is still correct when B is rare, but an estimate from data may be unstable. If only six customers were exposed to a feature and one purchased, the observed conditional rate is 1 in 6, or about 16.7 percent. One additional purchase would move it to 33.3 percent. A production decision based on that number should show uncertainty, sample size, and preferably a confidence interval.
Conditional probability tells you what to calculate. It does not promise that a small subgroup gives a reliable estimate.
The ratio requires a positive denominator
The elementary formula requires P(B) > 0. If B has probability zero, dividing by P(B) is undefined.
For a discrete event such as “the card is a face card,” this is straightforward. In continuous probability, an exact value such as “a person’s height is exactly 180.000… centimetres” can have probability zero even though conditioning around that value can still make sense. Those cases use conditional distributions or regular conditional probabilities rather than blindly applying the ratio.
What they’ll ask next
“What is the difference between P(A | B) and P(B | A)?”
They reverse the condition and usually have different denominators. In the card example, P(King | face card) is 4 / 12, while P(face card | King) is 4 / 4. The first is one-third; the second is one.
“How does this relate to Bayes’ theorem?”
Bayes’ theorem reverses a conditional probability using the joint relationship:
P(A | B) = P(B | A) × P(A) / P(B)
For a medical test, suppose disease prevalence is 1 percent, sensitivity is 99 percent, and the false-positive rate is 5 percent. Then:
P(disease | positive) = (0.99 × 0.01) / ((0.99 × 0.01) + (0.05 × 0.99))
That equals about 16.7 percent, not 99 percent. The test can be highly sensitive while many positive results still come from the much larger healthy population. That is the base-rate effect.
“When are A and B independent?”
When learning B leaves the probability of A unchanged: P(A | B) = P(A). Equivalently, P(A ∩ B) = P(A) × P(B). Independence is an assumption to check or justify, not a synonym for “the events seem unrelated.”
Say this in the interview
“Joint probability measures how often A and B happen together in the full sample space, while conditional probability measures how often A happens within the reduced group where B is already known to be true, so P(A | B) = P(A ∩ B) / P(B).”