# Maximizing the probability of a urn problem

How can 20 balls, 10 white and 10 black, be put into two urns so as to maximize the probability of drawing a white ball if an urn is selected at random and a ball is drawn at random from it?

Intuitively i know the right answer: put 1 white, 0 blacks in one urn and 9 white and 10 blacks in the other, but i just want to arrive at it with more mathematical arguments.

Here's my attempt:

Define the events:

W:= the ball taken is white

B:=the ball taken is black

$U_1$:=the ball taken is from urn 1

$U_2$:= the ball taken is from urn 2.

We are interested in W event, which can be written as the following disjoint union:

$W= WU_1\cup WU_2$.

Hence, $P(W)=P(W|U_1)P(U_1)+P(W|U_2)P(U_2)$.

Supposing that we put $u$ balls in the first urn, and that from these $w$ are white, we have the following distribuition:

$U_1:$ $u$ balls, $w$ white and $u-w$ black.

$U_2:$ $20-u$ balls, $10-w$ white and $20-10+w$ black.

Therefore, $P(W)=\frac{w}{2u}+\frac{10-w}{2(20-u)}$

I'm actually having trouble in order to maximize it. Can someone help?

• You could hold $u$ constant and find optimal $m$. Then find optimal $u$ – Henry Apr 9 '17 at 12:42

## 1 Answer

We have for $1 \leq u \leq 19$ and $\max\{0, u - 10\} \leq w \leq \min\{u, 10\}$, $$P(W) = \frac{w}{2u} + \frac{10 - w}{2(20 - u)} = \frac{10}{2(20 - u)} + w\left(\frac{1}{2u} - \frac{1}{2(20-u)}\right)$$ If $u \geq 10$, then $\frac{1}{2u} \leq \frac{1}{2(20 - u)}$, thus $w$ should be equal to $u - 10$ to maximize $P(W)$. In this case, $$P(W) = \frac{u - 10}{2u} + \frac{1}{2}$$ and it is maxmized when $u = 19$. The corresponding $P(W)$ is $\frac{14}{19}$.

If $u < 10$, then $\frac{1}{2u} > \frac{1}{2(20 - u)}$, thus $w$ should set as $u$ to maximize $P(W)$. When $w = u$, we have $$P(W) = \frac{10 - u}{2(20 - u)} + \frac{1}{2}$$ It is maximized when $u = 1$. The corresponding $P(W) = \frac{14}{19}$.

Now consider the special case when one urn contains all ball, which is not captured by the formula of $P(W)$. $P(W)$ in this case is $\frac{1}{4} < \frac{14}{19}$.

By above, we conclude that the optimal strategy is to put $10$ black balls and $9$ white balls in the first urn and $1$ white ball in the second urn.