Exercises — Conditional probability
This is your practice ladder for conditional probability. Every rung is harder than the last:
- L1 Recognition — can you spot which formula applies?
- L2 Application — plug into one formula cleanly.
- L3 Analysis — combine several ideas, watch the base rate.
- L4 Synthesis — chain rules, multi-step reasoning, Bayes across many hypotheses.
- L5 Mastery — build something new (a mini classifier, a limiting case).
Every solution is hidden inside a collapsible callout so you can test yourself first. Try the problem, then reveal.
Before we start, one picture to keep in your head the whole way down: conditioning means shrinking the universe to a smaller box and re-measuring inside it.

L1 — Recognition
Exercise 1.1 (L1 Recognition)
A jar has 10 tickets numbered 1–10. You draw one. Let number is even and number . Someone tells you the number is greater than 5. What is ?
Recall Solution
What we know: , so the shrunken universe has outcomes. Inside it, the even ones are , so favourable. Why this is just counting: all tickets are equally likely, so probability = (favourable) / (size of universe). Conditioning on replaces the size-10 universe with a size-5 universe. Answer: .
Exercise 1.2 (L1 Recognition)
You are given and . Which single formula gives , and what is its value?
Recall Solution
The definition of conditional probability applies directly — no Bayes, no total probability needed. Answer: .
Exercise 1.3 (L1 Recognition)
True or false: "If , then and are independent." Justify in one line.
Recall Solution
True. means learning did not move the probability of — that is exactly the definition of independence. Equivalently .
L2 — Application
Exercise 2.1 (L2 Application)
A factory has two machines. Machine X makes of parts, Machine Y makes . X's defect rate is ; Y's is . Pick a random part — what is ?
Recall Solution
This is the law of total probability: a part is defective through one of two disjoint "pathways" (came from X, or came from Y). Answer: (i.e. ).
Exercise 2.2 (L2 Application)
Same factory. A part is found defective. What is the probability it came from Machine Y?
Recall Solution
Now we flip the conditioning with Bayes' theorem. We already computed the denominator in 2.1. Answer: (about ). Even though Y makes only of parts, it produces more than half the defectives because its defect rate is higher.
Exercise 2.3 (L2 Application)
Two cards are drawn without replacement from a standard 52-card deck. What is ?
Recall Solution
Use the multiplication (chain) rule because the draws are sequential and the second depends on the first. Answer: .
L3 — Analysis
Exercise 3.1 (L3 Analysis — base rate)
A rare disease affects in people. A test has sensitivity and specificity . You test positive. What is the probability you actually have the disease?
Recall Solution
Events: (disease), , . . Specificity false-positive rate . Step 1 — total probability of a positive test: Step 2 — Bayes: Answer: (about ). The disease is so rare that most positives come from the huge healthy majority.

Exercise 3.2 (L3 Analysis)
In the setup of 3.1, how many people out of tested would you expect to be true positives vs false positives? Confirm the posterior from these counts.
Recall Solution
Out of : diseased ; healthy .
- True positives: .
- False positives: .
- Total positives: . Matches 3.1. Why counting works: frequencies are the probabilities scaled by ; the cancels in the ratio.
Exercise 3.3 (L3 Analysis)
Show that if and are independent, then and (not-) are also independent.
Recall Solution
Independence gives . Split over and : That last equality is exactly the independence condition for and .
L4 — Synthesis
Exercise 4.1 (L4 Synthesis — chain rule)
An urn has red and green balls. Draw without replacement. What is in that order?
Recall Solution
Apply the chain rule step by step, updating the urn each time. Answer: .
Exercise 4.2 (L4 Synthesis — three hypotheses)
Three biased coins: A (heads ), B (heads ), C (heads ). You pick one at random (equal chance) and flip it — it lands heads. What is the probability it was coin A?
Recall Solution
Priors . Total probability of heads: Bayes for coin A: Answer: .
Exercise 4.3 (L4 Synthesis — sequential Bayes)
Same three coins. You flip the chosen coin twice and get heads then heads. Now what is ? (Assume flips of a fixed coin are independent.)
Recall Solution
Likelihood of for each coin is (heads prob): A , B , C . Answer: . Two heads is stronger evidence for the heads-heavy coin than one — the posterior climbed from to . This is Bayesian updating in action.
L5 — Mastery
Exercise 5.1 (L5 Mastery — mini Naive Bayes)
A spam filter treats words as conditionally independent given the class (the naive Bayes assumption). Data: , . For spam: , . For ham: , . An email contains both "free" and "win". Compute .
Recall Solution
Naive assumption: (words independent given class). Numerator (spam pathway): . Ham pathway: . Evidence: . Answer: (about ). Two spam-indicative words push the posterior even higher than either alone.
Exercise 5.2 (L5 Mastery — degenerate / limiting case)
In Exercise 5.1, suppose the word "win" never appears in ham, i.e. . Recompute and explain why this is dangerous in a real classifier.
Recall Solution
Ham pathway becomes . So evidence and The model is now 100% certain it's spam — a single zero probability vetoes the entire ham hypothesis, no matter what other evidence says. In practice one unseen word could wrongly zero out a class. Fix in real systems: Laplace smoothing adds a small count so no likelihood is exactly . Certainty should never come from a single missing observation.
Exercise 5.3 (L5 Mastery — build the boundary)
Using 5.1's spam model but ignoring "win", find the prior at which seeing only "free" makes spam and ham equally likely, i.e. .
Recall Solution
Equal posteriors equal weighted likelihoods: Answer: . Below this prior, "free" alone is not enough to call an email spam — the decision boundary depends on the base rate, exactly the L3 lesson resurfacing.
Recall One-line self-check
Every problem here reduced to one of three moves — which three? ::: (1) definition , (2) law of total probability to build the denominator, (3) Bayes to flip the conditioning.
Where this leads
These same moves power Naive Bayes, Hidden Markov Models, Bayesian inference, and show up in mutual information. Master the ladder and every one of those becomes "just conditioning, repeated".