Worked examples — Conditional probability
This page is a complete case sweep. The parent note gave you the definition and three examples. Here we build a matrix of every situation conditional probability can throw at you — every extreme value, every degenerate input, every real-world twist — and then work one example per cell so you never meet a case you haven't already seen.
Before we start, one reminder in plain words. The symbol is read "probability of given ". It means: stand inside the world where has already happened, and ask what fraction of that world also has in it. The bar means "given" — it does not mean division. The one formula everything below rests on is
where is the chance both happen (the overlap), and dividing by renormalises so that the world of counts as the new "total".
The scenario matrix
Every conditional-probability problem you will ever see lands in one of these cells. The worked examples below are each tagged with the cell they cover.
| Cell | What makes it special | Example |
|---|---|---|
| C1 — Plain overlap | Both and given directly | Ex. 1 |
| C2 — Flip the bar (Bayes) | You know , want | Ex. 2 |
| C3 — Rare-prior twist | Small prior makes the answer counterintuitive | Ex. 3 |
| C4 — Independence (degenerate) | Learning changes nothing | Ex. 4 |
| C5 — Certainty limits | or (mutually exclusive / subset) | Ex. 5 |
| C6 — Undefined input | : the formula breaks | Ex. 6 |
| C7 — Many pathways | Partition with branches (total probability) | Ex. 7 |
| C8 — Chain of events | Sequential conditioning, chain rule | Ex. 8 |
| C9 — Exam twist | "At least one" / complement trick | Ex. 9 |
| C10 — Certain condition | : conditioning changes nothing | Ex. 10 |
The three "extreme value" ideas — an answer of exactly 0, exactly 1, an undefined input (), or a certain condition () — are the ones people skip. We hit the whole spectrum head-on in C5, C6 and C10.
Look at the map below before reading on: it shows the whole universe as a rectangle, event as a shaded region, and as the darker overlap. Conditioning on = zooming into the region and treating it as the whole picture.

[!example] Example 1 — Cell C1: plain overlap
Statement. A deck-of-cards style setup: in a class of students, play chess (), and of those , exactly also play piano (). A student is picked at random and turns out to be a chess player. What is the probability they play piano?
Forecast: guess a number before reading. (Is it or ?)
- Identify the events. plays piano, plays chess. We are told the outcome is a chess player, so we condition on . Why this step? Naming events stops us mixing up which is "given".
- Read off the pieces. and (3 of the 30 do both). Why this step? The formula needs the overlap and the condition as fractions of the same original universe of 30.
- Apply the formula. Why this step? The s cancel — we have zoomed into the chess players (the blue box of Figure 1).
Verify: Directly, "3 of the 12 chess players play piano" . Matches. The answer is a fraction of the shrunk universe (12), not the original (30) — that is the whole point.
[!example] Example 2 — Cell C2: flip the bar with Bayes
Statement. A factory: of bolts come from machine , from . produces defective, produces defective. A bolt is defective. What is the probability it came from ?
Forecast: more bolts come from , but is defect-prone. Which wins?
- Name events. from , defective. Given: , , . (Recall = "not from " = "from ".) Why this step? We know but want — the bar is pointing the wrong way, so we need Bayes.
- Total probability of a defect (the denominator): Why this step? A bolt can be defective via two pathways; we sum them.
- Bayes: Why this step? We already have the overlap and the new total universe ; dividing gives the fraction of defective bolts that came from — exactly the master move of Figure 1.
Verify: The complement should be , and . ✓ Even though makes most bolts, the defective one is slightly more likely from .
[!example] Example 3 — Cell C3: rare-prior twist
Statement. (Same shape as the parent's medical example, new numbers so you re-derive.) A security scanner flags of real threats () and falsely flags of safe bags (). Only in bags is a real threat. A bag is flagged. Probability it is a real threat?
Forecast: the scanner is accurate — so surely a flag means near-certain threat? Guess.
- Events. threat, , . ( = "safe bag".) Why this step? We must pin the tiny prior down explicitly, because this is the number our intuition tends to forget and it will dominate the answer.
- Denominator (total probability of a flag): Why this step? The false-positive rate acts on the huge safe majority.
- Bayes: Why this step? The numerator is the overlap "flagged and truly a threat"; the denominator is the whole flagged universe. Dividing zooms into the flagged bags and asks what fraction are real threats — the Figure 1 move again.
Verify: Under ! Sanity: expected in bags → threats (99 flagged) and safe ( falsely flagged). Flagged threats all flagged . ✓ This is the base-rate neglect from the parent's Mistake 2 — the rare prior dominates.
[!example] Example 4 — Cell C4: independence (degenerate case)
Statement. Roll a fair six-sided die. result is even , result is . Does knowing change ?
Forecast: guess whether these are independent.
- Unconditional. . Why this step? We need the before-conditioning value as a baseline to compare against, since independence is defined by "conditioning changes nothing".
- Overlap. (the outcomes in both sets), so ; and . Why this step? The formula needs the intersection and the condition; listing the outcomes explicitly avoids miscounting.
- Conditional: Why this step? We compare it to : they are equal, so learning told us nothing — in Figure 1 the green overlap fills the same fraction of the blue box as fills of the whole rectangle.
Verify (product test): Independent iff . Check: and . ✓ This is the degenerate conditioning: the world shrinks but the fraction of stays put.
[!example] Example 5 — Cell C5: the certainty limits (0 and 1)
Statement. One card drawn from a standard -card deck. Let "the card is a heart". Find (a) and (b) .
Forecast: one answer will be exactly , the other exactly . Predict which.
- Compute the condition . A standard deck has hearts out of cards, so . Why this step? The formula divides by , so we must pin it down explicitly before using it — never leave it implicit.
- Mutually exclusive case (answer ). A heart is red, so "black" and "heart" cannot both happen: their intersection is empty, giving . Why this step? If the overlap is empty, conditioning cannot resurrect it — is a legitimate answer, not an error.
- Subset case (answer ). Every heart is red, so (the heart-event sits entirely inside the red-event), meaning . Why this step? When lives entirely inside (that is what means), being in guarantees .
Verify: These are the two extreme values of any probability: . We hit both boundaries exactly, and both used . ✓
[!example] Example 6 — Cell C6: undefined input ()
Statement. A spinner points to a real number uniformly in . Let "the pointer lands exactly on ". What is for "the number is "?
Forecast: it feels like the answer should be . But watch the denominator.
- Probability of the condition. For a continuous uniform pick, probability = length of the target interval. A single exact point like is an interval of length , so . Why this step? The formula demands ; here it fails, and we must see why it fails before we can talk about the fix.
- Probability of the overlap. Since , the single point lies inside , so and . But itself has length , so as well. Why this step? Students often expect to be positive here; spelling out that the overlap is also a single zero-length point shows both numerator and denominator vanish.
- Try the formula: Why this step? Dividing is meaningless: there is no -world to shrink into (Figure 1's blue box has zero area), so "the fraction of it that is " has no answer.
Verify: This is a genuine gap in the elementary definition. The professional fix is conditioning on densities / limits (measure-theoretic conditioning) used in Bayesian inference over continuous parameters — but the elementary rule correctly refuses to answer. Always check first. ✓
[!example] Example 7 — Cell C7: three pathways (total probability)
Statement. Emails come from three sources: newsletters (), personal (), promotions (). The word "sale" appears with probability , , respectively. An email contains "sale". Probability it is a promotion?
Forecast: promotions are only of mail but love the word "sale". Guess the posterior.
- Events. newsletter, personal, promotion; contains "sale". Why this step? Total probability needs a partition — three mutually exclusive, exhaustive sources — so we name all three before summing.
- Total probability (three-branch): Why this step? Every source is a pathway to seeing "sale"; sum all three.
- Bayes for the promotion branch: Why this step? The numerator is the overlap "promotion and contains sale"; the denominator is the whole 'sale' universe from all three sources. Dividing zooms into the emails containing "sale" and asks what fraction are promotions — the Figure 1 move with three input branches.
Verify: The three posteriors must sum to : . ✓ This 3-branch structure generalises directly to the naive Bayes classifier.
[!example] Example 8 — Cell C8: chain of events
Statement. A box has red and green balls. Draw two without replacement. What is the probability both are red?
Forecast: it is not — why not?
- First draw. . Why this step? We anchor the first factor of the chain rule; at this moment the universe is the full box of balls (Figure 1's whole rectangle).
- Second draw given the first. After removing one red, red remain out of : . Why this step? The first draw changes the universe for the second — we zoom into the world where a red is already gone, exactly the shrink-into- move of Figure 1.
- Chain rule (multiplication rule from the parent): Why this step? To get both, we multiply "reach the shrunk world" () by " happens inside it" ().
Verify: Count directly with the " choose " notation from the top of this page: number of ways to pick 2 reds ; total ways to pick any 2 of 5 ; so . ✓ The chain rule is what makes Hidden Markov Models tractable.
[!example] Example 9 — Cell C9: exam twist ("at least one" + complement)
Statement. A student attempts independent problems, each solved with probability . Given that they solved at least one, what is the probability they solved all three?
Forecast: conditioning removes the "solved none" world — does that push the answer up or down?
- Event "at least one solved". Easier via complement: , so . Why this step? "At least one" is painful directly; its complement "none" (the of "at least one") is one clean product (independence lets us multiply the three s).
- Event "all three". . Since "all three" "at least one" (solving all three certainly means solving at least one), . Why this step? Recognising the subset relation collapses the overlap to just , so we do not need a separate calculation for the numerator.
- Condition: Why this step? We shrink out only the "solved none" outcome, so the surviving world is slightly smaller and 's share rises from to .
Verify: Conditioning should increase the value () because we deleted a region that could never contain . ✓ And , a valid probability.
[!example] Example 10 — Cell C10: the certain condition ()
Statement. Roll a fair die. "result is a ", and "result is between and " (i.e. the die shows some face — a certainty). Find .
Forecast: conditioning on something guaranteed — does it change at all?
- Probability of the condition. is the whole sample space, so . Why this step? We must check before dividing; here it sits at the upper end of the spectrum , the mirror image of C6.
- Overlap. Since (every is a valid face, so the six-event sits entirely inside the certain-event), , so . Why this step? The subset relation collapses the intersection to , so the numerator is just .
- Condition: Why this step? Dividing by changes nothing — a certain condition shrinks the universe to... the same universe. In Figure 1 the blue box would fill the entire white rectangle.
Verify: , and any event is independent of a certain event. ✓ This closes the spectrum: (undefined, C6) → (no effect, C10).
[!recall]- Self-test
Which cell is undefined, and why?
Which cell leaves completely unchanged because the condition is certain?
In Example 1, why is the answer and not ?
In Example 5, when does exactly?
Why in Example 9 does conditioning raise the probability?
See also: Bayes-Theorem · Law-of-Total-Probability · Independence · Chain-Rule-of-Probability · Naive-Bayes-Classifier · Mutual-Information · Bayesian-Inference · Hidden-Markov-Models