I have two urns, urn $1$ contains $k$ white balls and $l$ red balls, urn $2$ contains $n - k$ white balls and $n -l$ red balls. I have the total probability
$ P($ "white ball is drawn" ) = \frac{k}{k + l} \frac{1}{2} + \frac{n - k}{2n - (k + l)} \frac{1}{2}
and I would like to find $k$ and $l$ such that this probability is maximal. How can I do that? I tried to set the derivative of $P$ with respect to $k$ zero but this gets awfully complicated. Is there a better way to do this? Many thanks for your help!