I want to solve the following problem:
There are two lotteries. Each lottery consists of $N$ coin tosses, where $N$ is odd. To win a lottery, at least half of the $N$ coin tosses need to show black.
Three types of coins exist: $Z$ coins are black on both sides. $Y$ coins are white on both sides. The remaining $2N-Z-Y$ coins have each one white and one black side. $Z,Y\in \mathbb{N}, Z+Y <2N.$
Before the lotteries are played, the coins need to be distributed to both lotteries.
What is the optimal allocation of the coins to the lotteries to maximize the probability of winning both lotteries jointly?
I formulated the problem in the following way:
Let there be two independent, random variables $X_1$ and $X_2$, each following a Binomial Distribution: \begin{align} X_1 \sim B(n_1,1/2) \\ X_2 \sim B(n_2,1/2) \end{align} where \begin{align} n_1 = N-z_1-y_1 \\ n_2 = N-z_2-y_2. \end{align} Further, let there be two functions defined as \begin{equation} \pi_1(z_1,y_1) = \begin{cases} 1 & if \; z_1 \geq \lceil N/2 \rceil \\ 0 & if \; y_1 \geq \lceil N/2 \rceil \\ F_{X_1} (\lfloor N/2 \rfloor - y_1; n_1,1/2) & otherwise \end{cases} \end{equation} and \begin{equation} \pi_2(z_2,y_2) = \begin{cases} 1 & if \; z_2 \geq \lceil N/2 \rceil \\ 0 & if \; y_2 \geq \lceil N/2 \rceil \\ F_{X_2} (\lfloor N/2 \rfloor - y_2; n_2,1/2) & otherwise. \end{cases} \end{equation}
Here, \begin{equation} F_{X_i} (\lfloor N/2 \rfloor - y_i; n_i,1/2) = \sum_{k=0}^{\lfloor N/2 \rfloor - y_i} \binom{n_i}{k} (1/2)^{n_i}, \,\,for \,\,i=1,2. \end{equation} Maximize $\pi_1(z_1,y_1) \pi_2(z_2,y_2)$ over $\{z_1,y_1\}$ subject to the constraints
\begin{align} z_1+z_2 = Z \\ y_1+y_2 = Y \end{align}
for given $N,Z,Y$ with \begin{align} N \in \{2 k +1 \mid k \in \mathbb{N}\}\\ Z,Y \in \mathbb{N} \\ Z+Y <2N. \end{align}
For the case $Z,Y \geq \lceil N/2 \rceil$, I have shown numerically that it is optimal to choose $z_1 = \lceil N/2 \rceil, y_1 = \lceil N/2 \rceil-1$. This result is also intuitive to me. Is it possible to prove this result analytically?
Is it possible to obtain an analytical solution also for the general case, with $Z,Y \in \mathbb{N}$ and $Z+Y <2N$?