Solution (source code)

= Solution
{c}

Put $A=\sum_iX_i$, $B=\sum_jY_j$ and $N=n+m$. Independence gives the <likelihood function>
$$
L(\theta,\mu)=\theta^{-n}\mu^{-m}\exp(-A/\theta-B/\mu).
$$
The unrestricted <maximum-likelihood estimators> are $\widehat\theta=A/n$ and $\widehat\mu=B/m$. Under the <null hypothesis>, the common <mean> $\eta=\theta=\mu$ maximizes $\eta^{-N}e^{-(A+B)/\eta}$ at $\widehat\eta=(A+B)/N$. These are maxima because each one-parameter <score function> has the sign of its observed sum minus its sample size times its proposed <mean>.

Define the generalized <likelihood ratio> to be the constrained maximum divided by the unrestricted maximum. The exponential factors cancel, giving
$$
\Lambda=\frac{[N/(A+B)]^Ne^{-N}}{(n/A)^n(m/B)^me^{-N}}
=\frac{N^N}{n^nm^m}\frac{A^nB^m}{(A+B)^N}.
$$
Since $T=A/(A+B)$ and $1-T=B/(A+B)$,
$$
\boxed{\Lambda=\frac{(n+m)^{n+m}}{n^nm^m}T^n(1-T)^m.}
$$
It has maximum one at $T=n/N$, when the two fitted <means> agree, and is small toward either endpoint. A <likelihood-ratio test> rejects for small $\Lambda$, or equivalently large $W=-2\log\Lambda$. This is the <likelihood-ratio test for equality of exponential means>.