← Microsoft Interview Insights

Microsoft·Data Scientist·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

Microsoft data scientist interview with a probability question that sounds straightforward until you're actually doing it live and second-guessing every step of Bayes' rule.

Questions Asked (2)

Q1

Three bags each contain red and green balls in different proportions. You pick a bag uniformly at random and draw one ball. Given the ball is red, what is the probability it came from Bag B? Walk through all the steps using Bayes' rule.

Product Analytics & MetricsTechnical Trade-offs
Author's notes

I knew the formula but froze a little setting up the denominator.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

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.

1. Define Events and Priors

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.

2. Identify Conditional Probabilities

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.

3. Compute Total Probability of Red

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.

4. Apply Bayes' Rule for Bag B

Compute P(B2|R) = P(R|B2)P(B2) / P(R) = (p2/3) / ((p1+p2+p3)/3) = p2 / (p1+p2+p3).

5. Interpret and Sanity Check

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.

Key Points to Mention

  • Bayes' theorem formula: P(B|R) = P(R|B)P(B) / P(R)
  • Law of total probability for P(R)
  • Uniform prior assumption: P(B1)=P(B2)=P(B3)=1/3
  • Likelihoods from given proportions
  • Posterior probability calculation and simplification
  • Interpretation of the result in context

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

Now suppose the bags are not chosen with equal probability: Bag A at 20%, Bag B at 50%, Bag C at 30%. Recompute P(B | red) and explain how the unequal priors change the answer.

Product Analytics & MetricsTechnical Trade-offs
Author's notes

This part I actually liked more than the first.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

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.

1. Identify Given Probabilities

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).

2. Compute Marginal Probability of Red

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.

3. Apply Bayes' Theorem

Compute P(B|red) = (P(red|B) * P(B)) / P(red). Show the calculation clearly.

4. Interpret the Result

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.

Key Points to Mention

  • Bayes' theorem formula: P(B|red) = P(red|B)P(B) / P(red)
  • Law of total probability for P(red)
  • The effect of unequal priors: higher prior for B leads to higher posterior for B
  • Comparison with equal priors (e.g., if priors were 1/3 each)
  • Assumption that likelihoods P(red|A), P(red|B), P(red|C) are known and unchanged
  • Practical implication: prior knowledge can significantly shift posterior beliefs

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.