# Maximizing discrete probability

I'm stuck with the following problem:

Let's assume we have two buckets: bucket one contains $k$ white spheres and $l$ red spheres. Bucket two contains $n-k$ white spheres and $n-l$ red spheres (n a fixed constant).

The probability to pick a white sphere from any of the two buckets (assuming uniform probability) is given by:

$$\mathbb{P}(\ White\ sphere)=\frac12\cdot\frac{k}{k+l}+\frac12\cdot\frac{n-k}{2n-(k+l)}$$

The question reads as follows: how to choose k and l such that the above proability is maximal?

The given hint is: "first consider $k+l=m$ fix"

The solution states: $k=1$ and $l=0$. I've tried applying Lagrange's multipliers without any apparent success... can someone help me out?

-
Please clarify. When you pick a sphere from one of buckets, you do it with equal 1/2 probability? Is this a prefixed strategy that cannot be changed? – Alexander Vigodner Jun 27 '14 at 18:10
exactly! The probability is the one given by the formula – b00n heT Jun 27 '14 at 18:11

We apply the hint: Fix $m=k+l$. Then the equation becomes

$$\frac{1}{2}\left(\frac{k}{m}+\frac{n-k}{2n-m}\right)=\frac{1}{2}\left(\frac{2nk-mk+nm-mk}{2nm-m^2}\right)=\frac{1}{2}\left(\frac{k(2n-2m)+nm}{2nm-m^2}\right)$$

This value increases as $k$ increases since all other values are fixed. Since $m=k+l$, for a given $m$, the maximum value of $k$ is $m$.

Letting $k=m$ in the above equation, we get $$\frac{1}{2}\left(\frac{m(2n-2m)+nm}{2nm-m^2}\right)=\frac{1}{2}\left(\frac{2n-2m+n}{2n-m}\right)=\frac{1}{2}\left(\frac{3n-2m}{2n-m}\right)$$ This value increases as $m$ decreases. Hence the maximum value occurs when $m$ is at a minimum, that is, at $m=1$. In conclusion this gives us that the maximum occurs when $k=m=1$ and $l=0$.

-
Nice. However, I think it would be necessary to consider the case $m=0$ first (in your answer you considered that $1$ is the minimum of $m$, why?). If $m=0$ then $k=l=0$ and the considered probability is $P=1/4$. Now consider $m\ge 1$, then proceed with your arguments we get another maximum value of $P$. Comparing with the case $m=0$ we see that this value is actually the maximum one. Conclusion... – Khue Jun 27 '14 at 19:03
@Khue Yeah, I didn't consider the case $m=0$ because I didn't think we had defined what to do when one bucket was completely empty (for example, the fraction $\frac{k}{k+l}$ doesn't make sense). However if we take the probability of getting white in the case $m=0$ as $1/4$ (as might reasonably be interpreted from the question statement), then we can do exactly as you suggest. – Peter Woolfitt Jun 27 '14 at 19:15

If $k+l<n$, then the second denominator is greater than the first. Any balls in the first bucket have a higher probability of being chosen than balls in the second bucket. So, subject to $k+l$ being constant, you want all of the $k+l$ balls to be white - that is, $l=0$.

Now that $l=0$, how do you maximize the probability?

There is another solution if $k+l>n$.

-