Is there some relatively simple way to find the maximum of this function

$ f(x,y) = \frac{1}{2} \cdot (\frac{x}{x+y} + \frac{50-x}{100-x-y} ) $

under the following constraints:

$$ x\ and\ y\ are\ integers $$

$$ 0 \leq x \le 50 $$

$$ 0 \leq y \le 50 $$

$$ the\ two\ denominators\ are\ positive $$

This function represents a probability which I came across in a probability theory problem. The problem is supposed to be simple but I find no simple solution.

I sort of found the answer by intuition and by some general trial and error... The answer is that the maximum is at $x=1, y=0$. I was able to 3D plot this function in Wolfram Alpha and it sort of confirms my finding.

But somehow I am not satisfied with this, I am looking for something more rigorous. I tried derivatives (fixing $x$ and letting $y$ vary and then the reverse), but the expressions come out quite unpleasant.

Any alternatives ideas or suggestions would be quite helpful.

Original problem:
You have two piles of marbles:
1st pile: $x$ white, $y$ black marbles.
2nd pile: $50-x$ white, $50-y$ black marbles.
So... $50$ marbles of each color, $100$ marbles in total.
Both piles are not empty.
You pick a pile at random, and then from it, you pick a marble at random.
You want to maximize the probability of the event
A = {the marble selected is white}.
What should be $x$ and $y$ then (to maximize that probability)?

  • $\begingroup$ A rule of thumb: When the two fractions are equal, usually the function reaches either a minimum or maximum. I would set them equal to each other and solve. $\endgroup$ – Don Thousand Sep 26 '18 at 18:20
  • $\begingroup$ Shouldn't it not be $$0 \le y\le 50$$? $\endgroup$ – Dr. Sonnhard Graubner Sep 26 '18 at 18:25
  • $\begingroup$ Try $$x=49,y=50$$and the maximum is given by $$\frac{272}{99}$$ $\endgroup$ – Dr. Sonnhard Graubner Sep 26 '18 at 18:30
  • $\begingroup$ @Dr. Sonnhard Graubner Seems you have a typo. It cannot be 272/99. Also... what do you mean try? I know the answer, but I cannot quite put together a rigorous proof. $\endgroup$ – peter.petrov Sep 30 '18 at 8:20
  • $\begingroup$ Yes indeed, there is an error, it must be $$\frac{74}{99}$$ for $$x=1,y=0$$ $\endgroup$ – Dr. Sonnhard Graubner Sep 30 '18 at 8:46

Luckily, there is a way to make some intuition rigorous. In this problem, since we have an equal amount of marbles of each color, we can say that, if the number of marbles of each color in each pile is not equal (if they were equal we'd just have 1/2 either way), then in one bucket there are more black balls than white balls and in the other there are more white balls than black balls.

In terms of probability, this means that in one pile, we will have a probability greater than 1/2 of picking black, and in the other, we will have a probability less than 1/2. Luckily, we can maximize both of these at the same time, as $49/99$ is the closest we'll get to one half, and $1$ is the closest we'll get to $1$.

Note: The maximum of your function is a bit weird, as if we set $y=0$, then the function strictly increases as $x\to 0^+$, but it is discontinuous at $0$, so that's why I prefer a nice written explanation which sticks to the integers.

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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