# Find MLE by combining two different experiments

I am trying to solve the following problem on an assignment.

Anna has two dice. Die $F$ is fair: it rolls $1,2,3,4,5$ or $6$ with equal probability $\frac{1}{6}$. Die $D$ is dodgy: Anna suspects that it may be rolling even and odd numbers with unequal probabilities. To investigate, Anna rolls die $D$ 40 times; 32 of these rolls result in odd numbers.

Let $q$ be the probability of rolling an odd number on die $D$.

The next day, Anna's friend Bob borrows Anna's dice and tries a different experiment. He rolls dice $D$ and $F$ together, multiplies the two resulting numbers, and notes whether the product is even or odd. After repeating this procedure 50 times, he finds that the product was odd on 16 occasions.

Find the maximum likelihood estimate of $q$ based on the two experiments combined.

The number of odd numbers that Anna records $X_A$ is clearly distributed as

$X_A \sim Bin(40,q)$

For Bob, the probability of recording an odd result is

$\mathbb P(\textrm{product is odd}) = \mathbb P(D\textrm{ is odd}) \mathbb P(F\textrm{ is odd}) = 0.5q$

since we know that die $F$ is fair. Therefore the number of odd numbers he records $X_B$ should be distributed

$X_B \sim Bin(50,0.5q)$

Finally, I understand that the MLE $\hat{q}$ should satisfy

$\frac{\textrm{d}}{\textrm{d}q} \mathbb L(q; X_A = 32)\mathbb L(0.5q; X_B = 16) = 0$

Is this correct? Taking the derivative of the function above and solving for $\hat{q}$ seems to be much too complicated. Thank you in advance for your feedback.

The likelihood function is \begin{align*} \mathcal{L}(q) &= {40 \choose 32} q^{32}(1-q)^{40-32} {50 \choose 16} (0.5q)^{16}(1-0.5q)^{50-16} \\ &= {40 \choose 32} {50 \choose 16} 0.5^{16}q^{32+16}(1-q)^{40-32}(1-0.5q)^{50-16} . \end{align*}
Since the log function is a monotonic transformation, the maximizer of the log likelihood function will be the maximizer of the likelihood function. The log likelihood function is, \begin{align*} \log\mathcal{L}(q) = \log\left({40 \choose 32} {50 \choose 16} 0.5^{16}\right) + (32+16)\log(q) + (40-32)\log(1-q)+(50-16)\log(1-0.5q) \end{align*}.
The derivative with respect to $q$ is, \begin{align*} \frac{\partial}{\partial q}\log\mathcal{L}(q) = (32+16)\frac{1}{\log(q)} + (40-32)\frac{1}{(1-q)}(-1)+(50-16)\frac{1}{(1-0.5q)}(-0.5) \end{align*}.
Solve $\frac{\partial}{\partial q}\log\mathcal{L}(q)=0$ for $q$, and solutions for $q$ will be $q \in \left\{\frac{97-\sqrt{769}}{90}, \frac{97+\sqrt{769}}{90} \right\}$. Discard the solution that is not between 0 and 1, so $$\hat{q}_{MLE} = \frac{97-\sqrt{769}}{90} \approx 0.77.$$