Compute P(Bag B | red) via Bayes

Quick Overview

This question evaluates understanding of Bayes' rule and conditional probability by requiring computation of the posterior probability that a particular bag was chosen given a red draw.

Compute P(Bag B | red) via Bayes

Company: Microsoft

Role: Data Scientist

Category: Statistics & Math

Difficulty: easy

Interview Round: Technical Screen

Three bags contain red (r) and green (g) balls: - Bag A: 4 r, 6 g - Bag B: 6 r, 4 g - Bag C: 3 r, 7 g Process: pick a bag uniformly at random, then draw one ball from that bag. Given the drawn ball is red, compute the posterior probability that it came from Bag B, i.e., P(B | red). Show all steps using Bayes’ rule. Follow-up: if instead the bag is chosen with probabilities P(A)=0.2, P(B)=0.5, P(C)=0.3, recompute P(B | red) and explain the intuition for how the prior changes the result.

Quick Answer: This question evaluates understanding of Bayes' rule and conditional probability by requiring computation of the posterior probability that a particular bag was chosen given a red draw.

|Home/Statistics & Math/Microsoft
Microsoft logo
Microsoft
Oct 13, 2025, 9:49 PM
easyData ScientistTechnical ScreenStatistics & Math
8
0

Bayes' Rule: Posterior Probability of the Chosen Bag

Setup

  • There are three bags containing red (r) and green (g) balls:
    • Bag A: 4 r, 6 g (10 total)
    • Bag B: 6 r, 4 g (10 total)
    • Bag C: 3 r, 7 g (10 total)
  • Process: Pick a bag at random, then draw one ball from that bag.
  • Event R: the drawn ball is red.

Tasks

  1. With a uniform prior over bags (P(A)=P(B)=P(C)=1/3), compute P(B | R) using Bayes’ rule. Show all steps.
  2. Follow-up: If instead P(A)=0.2, P(B)=0.5, P(C)=0.3, recompute P(B | R). Explain the intuition for how changing the prior affects the result.

Assume a single draw from the selected bag (replacement does not matter when drawing only once).

Loading comments...