Today (November 10, 2016), in an effort to distract from the U.S. election results, my coworker Aaron Stewart posed an interesting question that has a nice and (possibly) unexpected answer:

You are given an urn containing 3 blue marbles and an unknown number of red marbles. A friend adds one more marble at random (50% chance it's red or blue). If you reach into the urn and pull out a blue marble, what is the probability that your friend added a blue marble?

First, I recognized that Bayes' theorem applies nicely here. Still, I got hungup for several minutes sorting it out, solving, and then correcting my algebra mistakes. I'll now walk us through the solution I came up with, although no doubt there are other ways.

Recall that Bayes' theorem states: $$P(X | Y) = \frac{P(X) \cdot P(Y | X)}{P(Y)}$$ Let

$B$ = blue marbles, $R$ = red marbles,

$P(X_B)$ = prob. of adding a blue marble = $\frac{1}{2}$,

$P(X_R)$ = prob. of adding a red marble, = $\frac{1}{2}$,

$P(Y_B)$ = prob. drawing a blue marble,

$P(Y_R)$ = prob. drawing a red marble,

then

$P(Y_B | X_B) = $ prob. of drawing a blue marble, given a blue marble was added, and

$P(X_B | Y_B) = $ prob. a blue marble was added, given that we drew a blue marble (what we are interested in).

We should also note that the total number of marbles is simply the sum of all marbles, $R + 4$.

Finally, putting it all together so that we can solve for our variable of interest, we have

$$P(X_B | Y_B) = \frac{P(X_B) \cdot P(Y_B | X_B)}{P(Y_B)}.$$ Only a few unknowns remain to be filled in explicitly:

What value do we use for $P(Y_B | X_B)$?

This is actually trivial: Given a blue marble was added, it's simply $\frac{4}{R + 4}$.

What value do we use for $Y_B$?

We naturally don't know the exact numerical probability of drawing a blue marble since we are not given the number of red marbles. The real trick here is remembering that you must account for all possible worlds. Since your friend added a marble of either color with exactly 50% likelihood, we have to add together the probabilities of each world to get the true odds:

$$P(Y_B) = (P(X_R) \cdot \frac{R}{R + 4}) + (P(X_B) \cdot \frac{B}{R + 4})$$

$$ = (\frac{1}{2} \cdot \frac{3}{R + 4}) + (\frac{1}{2} \cdot \frac{4}{R + 4}).$$

Now, putting it all together and solving step by step: $$P(X_B | Y_B) = \frac{\frac{1}{2} \cdot \frac{4}{R + 4}}{(\frac{1}{2} \cdot \frac{3}{R + 4}) + (\frac{1}{2} \cdot \frac{4}{R + 4})}$$ $$ = \frac{\frac{1}{2} \cdot \frac{4}{R + 4}}{\frac{1}{2} \cdot (\frac{3}{R + 4} + \frac{4}{R + 4})}$$ $$ = \frac{\frac{4}{R + 4}}{\frac{3}{R + 4} + \frac{4}{R + 4}}$$ $$ = \frac{\frac{4}{R + 4}}{\frac{7}{R + 4}}$$ $$ = \frac{4}{7}.$$

I enjoyed that the outcome was a definite probability, which I found somewhat surprising until I remembered that I possess little intuition for outcomes in probability theory and that's partly why I enjoy it so much in the first place.