# Basic probability question but struggling (brain teaser with friend)

You are presented with a bag of 4 orbs. You know that 2 are blue and 2 are red. You start drawing them without replacement from the bag one-by-one. Before each draw, you are given the opportunity to guess the color of the orb that is about to be drawn. If you get it correct, you earn $1. Under an optimal strategy, what is your expected profit of this game? I ended up getting$3.83, by eventually taking in different case scenarios and their probabilities depending on which orb is selected (optimal strategy: choosing the majority numbered orb) - but seems like it's wrong. What is your approach?

• As far as I can see, there is no strategy to be concerned about, because there is no cost to place a bet. Thus (obviously) the best strategy is always to guess and (almost as obviously) you want to guess among the likeliest possibilities. But since that reduces this question to a simple computation of an expectation, I wonder whether you might have omitted a crucial aspect of the setting: namely, is there a cost to place a bet and how much is it?
– whuber
Commented Jun 7, 2023 at 13:41
• If you start with $n$ of one colour and $m$ of another, and select the more common colour remaining each time then the expected gain for the whole game is $$g(n,m)=\frac{\max(n,m)}{n+m} + \frac{n}{n+m}g(n-1,m)+ \frac{m}{n+m}g(n,m-1)$$ starting at $g(0,0)=0$. So in this case of $n=m=2$ you get $g(2,2)=\frac{17}{6}$ as others have found but $1$ less than your attempt. Commented Jun 8, 2023 at 10:47
• Now I am curious. What if we have no info on red / blue repartition ? wouldn't this be purely random ? or could we beat randomness by guessing the majority that was already drawn ? Commented Jun 8, 2023 at 11:56
• @lcrmorin that would be an interesting exercise that depends heavily on the prior. For the parts of the prior in the range of equal fifty-fifty, one should choose the colour opposite from the colours that have been already drawn. For the parts of the prior in the bias far away from a fifty-fifty distribution, one should choose the colour equal to the colours that have been already drawn. Commented Jun 8, 2023 at 12:45
• @Whuber Perhaps in the original puzzle, you're allowed to bet only once. Commented Jun 8, 2023 at 23:34

I agree with @Dikran's analysis for the first, second, and final draws. However for the third draw, the expected winnings are $$(\1 + \1 + 4 \times \0.5) / 6 = 2/3$$.

If you draw a blue orb on the first draw, then on the second draw you have one blue and two red orbs left. So you have a 1/3 chance of drawing the second blue orb and a 2/3 chance of drawing a red orb. Therefore, you have a 1/3 chance of having two reds orbs left for the third draw, and a 2/3 chance of having a blue and a red orb.

Similarly, if you draw a red orb first, you have a 1/3 chance of having two blue orbs left for the third draw and a 2/3 chance of having one orb of each colour.

So combining the two means there is a 1/6 chance of having two reds orbs left for the third draw, a 1/6 chance of having two blue orbs left and a 2/3 chance of having one of each colour left. Therefore, 1/3 of the time your expected winnings for this draw are \$1 and 2/3 of the time \$0.50, or $0.6667 overall. Edited to add details for the other draws, as @Dikran has deleted their answer: First draw: Whichever colour you select, you have a probability of 1/2 of selecting the correct colour. Thus your expected winnings for this draw are$0.50.

Second draw: As there are two orbs of one colour and one of the other, select the colour with two orbs. The selected orb will be this colour 2/3 of the time, so your expected winnings are $0.6667. Final draw: As there is only one orb left and you know its colour, you can always win this draw and your expected winnings are$1.

(End of edit)

This means the expected winnings after the 4 draws is $$(1/2 + 2/3 + 2/3 + 1) = \2.833$$

This code is a simulation showing the colours of the remaining orbs after two draws:

import random

all_blue = 0
all_red = 0
mixed = 0
blue_orbs = ['Blue', 'Blue']
red_orbs = ['Red', 'Red']
num_runs = 12000000

for _ in range(num_runs):
orbs = blue_orbs + red_orbs
orbs.pop(random.randint(0, 3))
orbs.pop(random.randint(0, 2))
if orbs == blue_orbs:
all_blue += 1
elif orbs == red_orbs:
all_red += 1
else:
mixed += 1

print(f'All blue: {all_blue/num_runs:0.4f}; All red: {all_red/num_runs:0.4f}; Mixed: {mixed/num_runs:0.4f}')


And the results:

All blue: 0.1667; All red: 0.1666; Mixed: 0.6667


Which align well with the expected results.

• +1 I did say the third draw was the tricky one ;o) Simulation is always a good way to check! Commented Jun 7, 2023 at 11:04
• I left my answer up to provide context for yours, but since that has been downvoted (never a good turn goes unpunished) I've deleted it, so you might want to add more to your answer to cover the bits where we were both rright ;o) Commented Jun 7, 2023 at 14:23

Assuming there is no cost to guess and you always guess the most likely color, you can work through the expected value for each round with only one non-trivial branch point between outcomes, as follows.

The first guess has an expected value of \$0.50 no matter which color you pick. Since it’s symmetrical, we can simplify things by stipulating that your first draw is Red (since if you drew Blue, you can just flip the two names around without changing anything else in what follows). You now have \$0.50 in expectation, a bag with 2 blue and 1 red ball, and 3 draws left. Of course you’ll predict the next draw will be blue.

• 2/3 of the time, the next draw is blue, leaving you with \$1.50 in expectation and a bag with 1 blue and 1 red ball. No matter which color you pick for the third guess, you have a 1/2 chance of getting it right, giving you \$0.50 more in expectation, and you are certain to get \$1.00 for the last guess, giving you \$3.00 total in expectation at the end of this branch.

• 1/3 of the time, the next draw is red, leaving you with \$0.50 in expectation and a bag with 2 blue balls. You know the color of both of the final 2 balls, so you end up with$2.50 in expectation at the end of this branch.

After adding up the expected value for each group of outcomes, multiplied by their respective probabilities, you have (2/3) * \$3.00 + (1/3) * \$2.50 = $$\2.8\overline3$$ total in expectation for the whole game.

### Approach 1

In this case of a small number of marbles you can compute it by writing out all the possibilities that the marbles can be drawn. There are only $${4 \choose 2} = 6$$ situations

BBRR
BRBR
BRRB
RRBB
RBRB
RBBR


As strategy it is most efficient to choose the marble that is most abundant among the remaining marbles.

Let's assume that for equal cases, when the red and blue marbles are equal in number, we choose blue over red (which is without loss of generality, the case where you choose red over blue is just the mirror image and using a random choice blends the two).

The six situations occur with equal probability* and result in the following profits

BBRR
1011

BRBR
1111

BRRB
1101

RRBB
0011

RBRB
0101

RBBR
0111


And the expectation value of the wins is the average of these cases $$\frac{3+4+3+2+2+3}{6} = 2 \frac{5}{6} \approx 2.83$$

### Approach 2

A method that might be easier to generalize is to consider the distribution of the difference in the marbles each step (which follows approximately a half normal distribution).

The expectation value of the profit in a particular turn as function of the total number of balls $$n$$ left in the urn and the difference $$x$$ is

$$e(x,n) = 0.5 + x/n$$

Then we compute the mean by considering a half-normal distribution for $$x$$ with coefficient $$\sigma^2 = 0.25 \min(n,N-n)$$ (where $$N$$ is the number of balls from the start), which has as mean value $$E(x) = \sigma \sqrt{2/\pi}$$ and the expectation of all cases for the step when there are $$n$$ balls left is

$$e(n) \approx 0.5 + \frac{\sqrt{2}}{n\sqrt{\pi}} \sqrt{0.25 \min(n,N+1-n)}$$

And the total expectation will be

$$\begin{array}{RCL} e &\approx &\sum_{n=1}^N e(n)\\ &\approx&0.5N + \frac{1}{\sqrt{2\pi}} \left( \sum_{n=1}^{N/2} \frac{1}{\sqrt{n}} + \sum_{n=N/2+1}^{N} \frac{\sqrt{N+1-n}}{n} \right) \end{array}$$

In the case of $$N=4$$ this approximation is

$$2 + \frac{1}{\sqrt{2\pi}} \left( \frac{\sqrt{1}}{1} +\frac{\sqrt{2}}{2} + \frac{\sqrt{2}}{3} + \frac{\sqrt{1}}{4} \right) \approx 2.97$$

*The draws are similar to randomly shuffling the balls and creating a combination. The probability of any particular combination here is for all six cases $$\frac{2!2!}{4!}$$.

• "Given the opportunity" indicates one option is not to bet at any given turn -- but I don't see that incorporated in this answer.
– whuber
Commented Jun 7, 2023 at 13:40
• @whuber Isn't it obvious that it is most optimal to make a bet instead of no bet (and the bet should be for the most abundant colour of orbs remaining in the bag)? Commented Jun 7, 2023 at 13:58
• Please see my request for clarification above. The problem as currently stated does not qualify as any kind of "brain teaser" because it doesn't require developing any kind of strategy beyond the obvious one of betting on a most likely color at each stage. It becomes a little bit more interesting when one has to pay to place each bet.
– whuber
Commented Jun 7, 2023 at 14:46
• Then the six situations (which occur with equal probability) That parenthetical could potentially hide a bunch of sins. I'm not saying it isn't true in this particular case, but it's an important wrinkle which often trips up similar analyses, and deserves more clarification than an offhanded aside.
– R.M.
Commented Jun 8, 2023 at 15:25