TITLE: Picking balls from urns.
QUESTION [11 upvotes]: We have 2 urns, 5 red balls and 5 green balls. We will split the 10 balls in the 2 urns in any way we like (provided that each urn has exactly 5 balls) and then will choose one urn at random, of which we will pick one ball.
  If the ball is red, we will be asked to draw a second one from the other urn. If the first ball is green, we will keep it out of the urn and draw a second one from the same urn. We will win 100,000 rupees if we pick 2 balls of the same color. What is the optimum way to split the balls in the urns? (obviously the urns are identical, they are not transparent and we can’t cheat! Also, once we split the balls, the urns are taken away and brought back to us, so that we don't know which is which.)

Obviously we can't put 5 red in one urn and 5 green in the other, because if we pick the urn with the red balls, we will never pick 2 of the same color. So both jars must contain both colors but I can't figure out the optimum combination. I was told it is something about a Bayes theorem, but I am not familiar with this (although I looked it up in wiki). 
Any help? Many thanks!

REPLY [2 votes]: Let $a$ be the number of red balls in the first urn. Then we have $5-a$ green balls in the first urn and $a$ green balls in the second urn (means that $5-a$ red balls in the second urn). Then, we are trying to maximize the probability of getting $2$ balls with the same color. Here, let $R$ be the event that we pick $2$ red balls and $G$ be the event that we pick $2$ green balls. Then,
$$P(R) = \underbrace{\frac{1}{2}\cdot \frac{a}{5}\cdot \frac{5-a}{5}}_{\text{if we pick first urn first}}+\underbrace{\frac{1}{2}\cdot \frac{5-a}{5}\cdot \frac{a}{5}}_{\text{if we pick second urn first}} = \frac{(5-a)a}{25}$$
and
$$P(G) = \underbrace{\frac{1}{2}\cdot\frac{5-a}{5}\cdot \frac{4-a}{4}}_{\text{if we pick first urn first}}+\underbrace{\frac{1}{2}\cdot \frac{a}{5}\cdot \frac{a-1}{4}}_{\text{if we pick second urn first}} = \frac{a^2-5a+10}{20}$$
Then, $P(R \cup G) = P(R)+P(G)$ is the probability we are trying to maximize.
$$P(R)+P(G) = \frac{5a-a^2}{25}+\frac{a^2-5a+10}{20} = \frac{a^2-5a+50}{100}$$
Here, we need to find maximum value of the function $f(a) = a^2-5a+50$ in the interval $a \in [0,5]$ and $a \in \mathbb{N}$. Here, you can either try it for $a = 0,1,2$ or you can sketch the graph of this parabola on $[0,5]$ and see that it gets its maximum value at $a = 0$ and $a = 5$ with $50\%$.