← Microsoft Interview Insights
I knew the formula but froze a little setting up the denominator.
First, clarify the problem by defining the prior probabilities and conditional probabilities for each bag. Then apply Bayes' theorem to compute the posterior probability that the red ball came from Bag B, showing all intermediate calculations.
Pro tip: State your assumptions explicitly (e.g., equal priors, known proportions) and mention that in real-world scenarios, these might be estimated from data, demonstrating awareness of practical constraints.
Let B1, B2, B3 be the events of picking each bag, and R be the event of drawing a red ball. Since bags are chosen uniformly, P(B1)=P(B2)=P(B3)=1/3.
Given the proportions of red balls in each bag, denote P(R|B1)=p1, P(R|B2)=p2, P(R|B3)=p3. These are the likelihoods.
Use the law of total probability: P(R) = P(R|B1)P(B1) + P(R|B2)P(B2) + P(R|B3)P(B3) = (p1 + p2 + p3)/3.
Compute P(B2|R) = P(R|B2)P(B2) / P(R) = (p2/3) / ((p1+p2+p3)/3) = p2 / (p1+p2+p3).
The result is the relative likelihood of Bag B among the bags. Verify that probabilities sum to 1 across bags and that the answer makes intuitive sense.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.
This part I actually liked more than the first.
First, state Bayes' theorem and identify the given priors and likelihoods. Then compute the marginal probability of red using the law of total probability with the new priors, and finally apply Bayes' theorem to find P(B | red). Compare the result to the equal-prior case to explain how the increased prior for Bag B shifts the posterior.
Pro tip: Always sanity-check that the posterior probabilities sum to 1 and that the posterior for the bag with the highest prior increases relative to the equal-prior scenario. This demonstrates a deep understanding of Bayesian updating.
List the prior probabilities: P(A)=0.2, P(B)=0.5, P(C)=0.3. Also note the likelihoods of drawing a red ball from each bag: P(red|A), P(red|B), P(red|C) (assumed known from context).
Use the law of total probability: P(red) = P(red|A)P(A) + P(red|B)P(B) + P(red|C)P(C). Plug in the numbers and calculate.
Compute P(B|red) = (P(red|B) * P(B)) / P(red). Show the calculation clearly.
Explain that because Bag B now has a higher prior (0.5 vs 1/3), its posterior probability increases compared to the equal-prior case, assuming the likelihoods are unchanged. Discuss how the prior influences the posterior.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.