Take the following problem:
You have 100 balls (50 black balls and 50 white balls) and 2 buckets. How do you divide the balls into the two buckets so as to maximize the probability of selecting a black ball if 1 ball is chosen from 1 of the buckets at random?
If you put 1 black ball in one bucket and all the other balls in the other bucket then you will maximise the probability of picking a black ball, since there is a 50% chance of picking either bucket, so the probability becomes $$P(B)=(0.5\times1)+\Big(0.5\times \frac{49}{99}\Big)=0.75=75\%.$$ How can this be expressed mathematically? I.e. how does one maximise $$P(B)=\frac{0.5N_{B1}}{N_{B1}+N_{W1}}+\frac{0.5N_{B2}}{N_{B2}+N_{W2}},$$ where $N_{B1}$ is the number of black balls in the 1st bucket, $N_{W1}$ is the number of white balls in the 2nd bucket and so on.
Is there a general method for maximising probabilities? Do we have to somehow differentiate?
$\endgroup$ 12 Answers
$\begingroup$Here is a clever answer without doing math(or differentiation).
The idea is simple and clever. If black equals white in both bucket, it's obvious 1/2. If not, then one bucket must have more white and another must have more black. Observing this, it's obvious how to get the maximum. Black>white, maximum is 1, black less than white, maximum is 49/99. And this is feasible. Thus solution!
$\endgroup$ $\begingroup$To simplify notation, let $x=N_{B_1}$ and $y=N_{W_1}$. Then $N_{B_2}=50-x$ and $N_{W_2}=50-y$, and your second line becomes \begin{align}p(x,y)&=\frac12\cdot\frac{x}{x+y}+\frac12\cdot\frac{50-x}{50-x+50-y}=\frac12\cdot\frac{x(100-x-y)+(50-x)(x+y)}{(x+y)(100-x-y)}\\[0.3cm]&=\frac{-x^2+75x-xy+25y}{(x+y)(100-x-y)}\end{align} Now, this is a function of two variables, which you want to maximize and this can be done by differentiation. However, recall that $x,y$ take only discrete values, $x,y=0,1,2,\dots 50$.
$\endgroup$ 4