Articles
Conditional Probability Interview Questions: How the Observation Was Selected
Practice conditional probability by defining the observation process, denominator, and sample space before applying Bayes rule in a two-box example.
“Given that the observed token is blue, which box did it come from?” has no unique answer until the interviewer says how the token was selected. Choosing a box uniformly and then drawing within it weights boxes equally. Choosing a token uniformly from all tokens weights boxes by their sizes. Both can truthfully produce a blue observation, yet they give different posterior probabilities. Write the random experiment before writing Bayes’ formula.
The boxes and numbers below are an original interview exercise. Official academic facts about conditioning and Bayes’ rule are supported by the linked MIT and Berkeley teaching material. Editorial inference supplies the selection protocols and diagnostic checklist. These are not candidate-reported questions from a named employer.
One pair of boxes, two legitimate answers
Box A contains one blue and one red token. Box B contains three blue and one red token. First ask the interviewer which object is sampled uniformly. Under Protocol 1, a box is chosen with probability 1/2 each, then one token is drawn uniformly from that box. You are told the token is blue. The relevant branches are:
| Branch in Protocol 1 | Probability |
|---|---|
| Choose A and see blue | (1/2)(1/2)=1/4 |
| Choose B and see blue | (1/2)(3/4)=3/8 |
| See blue, from either box | 1/4+3/8=5/8 |
The target is P(B | blue) = P(B and blue)/P(blue) = (3/8)/(5/8) = 3/5. The answer is not 3/4, even though 75% of Box B’s tokens are blue. 3/4 is the likelihood of blue given B, not the posterior chance of B given blue. Bayes’ rule reweights both candidate boxes by how frequently each would generate the observed color. MIT’s conditioning lecture emphasizes that conditioning restricts and renormalizes the probability mass of the specified experiment.
Under Protocol 2, put all six physical tokens in one collection and choose a token uniformly. Four are blue; three of those four came from B. After learning that the selected token is blue, P(B | blue)=3/4. The condition is linguistically identical, but the sampling process changed. Before observing color, Protocol 2 selects B with probability 4/6, not 1/2, because B contributes four of the six tokens. The posterior calculation can also use Bayes: P(B and blue)=3/6=1/2, P(blue)=4/6=2/3, so (1/2)/(2/3)=3/4.
Neither protocol is “more correct.” The prompt is incomplete without the protocol. The interviewer may be checking whether you notice that ambiguity, not whether you can remember a standard puzzle answer.
Show the sample space, not just the fraction
For Protocol 1, one convenient outcome description is an ordered pair (box, token within box). The six physical-token outcomes are not equally likely: each token in A has probability (1/2)(1/2)=1/4, while each token in B has probability (1/2)(1/4)=1/8. You can still list all six; you must keep their weights. In Protocol 2, those six physical-token outcomes each have probability 1/6.
This is why counting “three blue tokens from B divided by four blue tokens total” silently assumes Protocol 2. It is not a universal consequence of observing blue. Conversely, starting with P(B)=1/2 silently assumes a box-first design. Write what is sampled at each stage and which outcomes carry equal weights. Then the denominator P(blue) is a sum of the valid blue branches, not a count copied from a different experiment.
A compact interview drawing is a two-level tree. For Protocol 1 the first split is A/B, each 1/2; the second split is blue/red with probabilities 1/2,1/2 for A and 3/4,1/4 for B. Multiply along branches, add blue branches, divide the B-blue branch by their sum. For Protocol 2 start with six equal token leaves; conditioning on blue retains four equal leaves. The two drawings reveal exactly where the answers diverge.
Berkeley’s probability notes and MIT’s probability materials formalize P(H|E)=P(H∩E)/P(E) for P(E)>0. The formula does not select the experiment for you. Assigning the wrong prior or likelihood produces a perfectly tidy calculation for the wrong question.
A third phrasing: “at least one blue” is not “the token was blue”
Return to box-first sampling: choose A or B with probability 1/2. Now draw two tokens with replacement from the selected box, and report only whether at least one draw was blue. In A, the probability of at least one blue is 1-(1/2)^2=3/4. In B it is 1-(1/4)^2=15/16. If the report is positive, Bayes gives
P(B | at least one blue) = [(1/2)(15/16)] / [(1/2)(3/4)+(1/2)(15/16)] = 15/27 = 5/9.
That is a third defensible answer to a third observation rule. The observer did not show you a randomly chosen blue draw; they reported a binary summary of two draws. If the draws were without replacement, the likelihoods would need recomputation. For A, drawing both tokens guarantees at least one blue. For B, two draws from a box with only one red also guarantee at least one blue. The report would then carry no information about which box was chosen, so the posterior would remain 1/2. The sampling rule and reporting rule both matter.
| Observation procedure | Prior chance of B | Evidence likelihood under A | Evidence likelihood under B | Posterior chance of B |
|---|---|---|---|---|
| Box first; one blue draw | 1/2 | 1/2 | 3/4 | 3/5 |
| One token from pooled collection; blue | 2/3 | 1/2 | 3/4 | 3/4 |
| Box first; two replacement draws; at least one blue | 1/2 | 3/4 | 15/16 | 5/9 |
| Box first; two draws without replacement; at least one blue | 1/2 | 1 | 1 | 1/2 |
The table is an original model comparison, not observed interview data. Its point is to make the likelihood of the report explicit. If an interviewer instead says “I picked one of the two draws at random and it was blue,” that is yet another observation procedure; do not quietly equate it with “at least one was blue.”
A reusable formula with a changing prior
Let q=P(B) before the color is seen in a box-first design. Keep the same single-draw likelihoods: P(blue|A)=1/2, P(blue|B)=3/4. Then
P(B|blue) = [q(3/4)] / [(1-q)(1/2)+q(3/4)] = 3q/(2+q).
For q=1/2, this is 3/5. If a box-first selection mechanism instead gives B prior 2/3, it becomes 3/4. That numerical match with pooled-token Protocol 2 is instructive: in this particular fixture, the pooled design induces the same B prior and within-box color likelihood as a box-first design with q=2/3. The equality of posteriors does not imply the protocols were identical descriptions; it says they induce the same relevant probabilities for this question.
The prior q is not a disposable decoration. A real data-collection system might choose certain boxes more often, discard observations under some conditions, or oversample one class. If the question specifies a selection filter, include its probability in the generative model. If it does not, say what assumption you need and, if useful, show how the answer depends on q. This is more informative than inventing “equal chance” and presenting a single number with false certainty.
How to handle an incomplete interview prompt
Ask one short clarification: “Are we choosing a box first, or a token from the pooled collection?” If the interviewer cannot or does not choose, solve both with named assumptions. A strong answer might say: “Under equal box selection, the posterior is 3/5; under uniform selection from all six tokens, it is 3/4. The difference comes from the prior probability of selecting B.” That answer is both mathematically correct and responsive to the ambiguity.
Next clarify what was observed. Was blue drawn and shown? Was the box inspected and reported as containing blue? Were two draws made, with only a positive/negative message sent? Did an observer select which fact to tell you after seeing the outcome? A reporting policy that prefers surprising observations can change the likelihood of the message. Treat the observer as part of the experiment when their selection is outcome-dependent. Do not reduce every wording to “given blue.”
Then name the denominator. For any hypothesis H and evidence E, it is P(E) under the specified protocol. If P(E)=0, the elementary conditional probability P(H|E) is undefined under that model. If the evidence is rare but possible, check that your final posterior remains between zero and one and that alternative hypothesis posteriors add to one. Here under Protocol 1, after seeing blue, P(A|blue)=2/5; 2/5+3/5=1.
A frequency interpretation can make the algebra easier to explain. Imagine many repetitions of Protocol 1. Of every 8 equally weighted probability units, 2 correspond to A-blue and 3 to B-blue; among the 5 blue units, 3 came from B. The “units” encode branch weights, not literal five physical blue tokens. For Protocol 2, four actual equally weighted blue tokens remain, three from B. Keep those two explanations separate.
Fast answers to likely follow-ups
What does conditioning do? It restricts probability to outcomes consistent with the observed event and renormalizes by that event’s probability, provided the denominator is positive.
Why is P(blue|B) not P(B|blue)? The numerator and denominator change when the direction reverses. The posterior also uses the prior frequency of B and evidence generated by A.
When can I count outcomes? When the outcomes you count are equally likely under the stated experiment. Box-first sampling makes individual physical tokens unequal here.
Is “at least one blue” equivalent to a random blue draw? No. One is a report about a set of draws; the other is a selected draw. Their likelihoods differ.
What if the interviewer leaves the selection rule out? State the ambiguity, ask one clarification, then solve the meaningful alternatives with assumptions printed next to the answers.