Maximizing the probability based on binomial distribution What values of $P_{Y}$ and $P_{X}$ maximizes $P(Z=1)$ where the random variable $Z$ is given by,
$$
Z=Y+X
$$
where $X \sim$ Binomial $\left(n_{1}, P_{X}\right)$ and $Y \sim$ Binomial $\left(n_{2}, P_{Y}\right)$ ?
My attempt:
I understand that the problem is same as

$\operatorname{argmax}_{P_{Y},P_{X}  }  n_{1}P_{X}(1-P_{X})^{n_{1}-1}(1-P_{Y})^{n_{2}}+ n_{2}P_{Y}(1-P_{Y})^{n_{2}-1}(1-P_{X})^{n_{1}}$

Now, I will take the derivative w.r.t $P_{X}$ $ \&$ $P_{Y}$ and equate to zero.
This simplifies to,

$ -n_{1}P_{X} -(n_{2}+1)P_{Y}+ (n_{1} +n_{2})P_{X}P_{Y}+1=0$ and
  $ -n_{2}P_{Y} -(n_{1}+1)P_{X}+ (n_{1} +n_{2})P_{X}P_{Y}+1=0$ 

which implies $P_{X}=P_{Y}$.
This seems wrong because intuitively $P_{X}$ $\&$ $P_{Y}$ should also depend on $n_{1}$ and $n_{2}$
.
Could someone help me solve this confusion?
 A: Some thoughts / not a full answer.
Perhaps the answer $P_X = P_Y = {1 \over n_1 + n_2}$ is not a maximum?  It can't be a minimum over all $(P_X, P_Y) \in [0,1]^2$, obviously, but it might be a saddle point.
That answer is basically saying we're best off if we treat both pools of $n_1$ and $n_2$ flips the same, and combine them into a single $Binomial(n_1 + n_2, {1 \over n_1 + n_2})$.  Well, whatever that value of $P(Z=1)$ turns out to be, I'm guessing the following proposed solution has higher $P(Z=1)$:


*

*Without loss of generality assume $1\le n_1 \le n_2$.  Then play $Bin(n_1, {1 \over n_1})$ and $Bin(n_2, 0)$.


I have not gone through the trouble of evaluating these, but it seems intuitively obvious my proposal would have a higher $P(Z=1)$, because it seems obvious that $f_k = P(Binomial(k, {1\over k}) = 1)$ is strictly decreasing in $k$.
In particular for the boundary case of $n_1 = 1$, my proposal would give $P(Z=1)=1$.
I am not sure whether my proposal is optimal.  Just saying I'm guessing it beats the other solution.
Also, if my proposal turns out to be optimal, then you cannot find it using derivatives alone because it happens at the boundary of $(P_X, P_Y) \in [0,1]^2$.  However, you have found the only solution in the interior which is a maximum / minimum / saddlepoint, so all you gotta do is compare it to all solutions at the boundaries (i.e. with at least one of $P_X$ or $P_Y$ being $0$ or $1$) and then you can find the global maximum within $[0,1]^2$.
