Z is actually a probability function. I am finding where the probability is maximized. But I could find no way how to maximize this function.
Original question is as follows:
Mr A wants to join a Gamer's club. There are two identical boxes filled with Red and Green balls, and he has to pick up a green ball in order to join the club. You are required to allocate balls in such a way that the probability of A joining The Gamer's club is maximized and boxes should be non-empty. There are 50 red and 50 green balls in total. What is the maximum probability?
** I have taken the number of Green balls in Box 1 as x and red balls in Box 1 as y. And hence I have created the probability function given in the question title.**
The maximum probability occurs where there is only 1 green ball and 0 red ball in Box 1 and the value of probability is 0.747. I cannot figure a way out of how to reach this number.
All I want is a rule book method in how to proceed in such type of questions.
Introducing new variable $p=2(x+y)$ leads to:
$$f(y,p)=\frac{y}{p}+\frac{50-y}{200-p}$$
New variables for convenience:
$$y=50r \\ p=50 s$$
$$g(r,s)=\frac{r}{s}+\frac{1-r}{4-s}$$
$$0 \leq r \leq 1, \qquad 0 < s < 4$$
Now we use the usual derivative method:
$$g_r=\frac{1}{s}-\frac{1}{4-s}=0$$
$$g_s=-\frac{r}{s^2}+\frac{1-r}{(4-s)^2}=0$$
From these equations we have:
$$s_0=2 \\ r_0 = \frac{1}{2}$$
However, the tests show this is not a maximum. Neither it's a minimum, more likely a saddle point, though I haven't checked properly.
Since we haven't been able to find a maximum point in this region, that means that the maximum is achieved somewhere on the boundary.
And unfortunately, this simply means that we have $s \to 0$ or $s \to 4$ where the function becomes unbounded.