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?

  • $\begingroup$ It should be $49/(50+49)=49/99$ in your first line of calculations. $\endgroup$ – Jimmy R. Oct 25 '16 at 9:48

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$.

  • $\begingroup$ Would you mind explaining this answer further? Are you saying that we should or shouldn't differentiate it? $\endgroup$ – user428487 Apr 24 '18 at 2:56
  • 1
    $\begingroup$ Yes, we should differentiate. This is not efficient though and aims only to answer the OP's question whether we can treat functions of probabilities as functions of usual variables and apply the standard maximizing methods. But then you have to be careful that you actually have discrete maximization here and therefore differentiation may not yield an acceptable (integer) result. $\endgroup$ – Jimmy R. Apr 24 '18 at 5:54
  • $\begingroup$ Is there a clever way of doing it without having to differentiate? $\endgroup$ – user428487 Apr 24 '18 at 7:18
  • 1
    $\begingroup$ @user428487 Not really clever here, so I can only see a "clever way" to differentiate: Assume that somehow, you have shown that $y=0$ in the optimal solution. Then, $x=0$ is excluded as an optimal solution and for $x\ge1$, $p(x,y)$ reduces to $$p(x,y)=\frac12\left(1+\frac{50-x}{100-x}\right)$$ which is easily shown to be decreasing in $x$. Hence, the optimal $x=1$. Thus, it remains to show that $y=0$ in the optimal solution. This points to differentiating first with respect to $y$ and showing that the first partial derivative (with respect to $y$) is decreasing in $y$. $\endgroup$ – Jimmy R. Apr 24 '18 at 7:55

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.