I'm working through problem 9.86 in Wackerly's "Mathematical Statistics with applications, 7th ed." The essence of the problem is:
Given two samples: $X_1,X_2,\ldots,X_m$ from a normal population with mean $\mu_1$ and variance $\sigma^2$ and $Y_1,Y_2,\ldots,Y_n$ from a different normal population with mean $\mu_2$ but the same variance $\sigma^2$, find the maximum likelihood estimator for the common variance $\sigma^2$. Assume that $\mu_1$ and $\mu_2$ are unknown.
The solution to this problem gives the likelihood function as $$L(\sigma^2)=(2\pi\sigma^2)^{\frac{-(m+n)}{2}}\exp\left(-\frac{1}{2\sigma^2}\left [\sum_{i=1}^m (x_i-\mu_1)^2-\sum_{i=1}^n (y_i-\mu_2)^2\right]\right)$$
However, I don't understand why there is a difference of sums in the exponential function. If I understand correctly, the likelihood function is obtained by taking the product of each sample density since they're independent, so $$L(\sigma^2)=\prod_{i=1}^m \frac{1}{\sqrt{2\pi\sigma^2}} \exp\left(\frac{-(x_i-\mu_1)^2}{2\sigma^2}\right) \prod_{i=1}^n \frac{1}{\sqrt{2\pi\sigma^2}} \exp\left( \frac{-(y_i-\mu_2)^2}{2\sigma^2}\right)$$ which would simplify to $$L(\sigma^2) = (2\pi\sigma^2)^{\frac{-(m+n)}{2}} \exp\left(-\frac{1}{2\sigma^2}\left[\sum_{i=1}^m (x_i-\mu_1)^2+\sum_{i=1}^n (y_i-\mu_2)^2\right]\right)$$ where the two sums are added in the exponent.
Did I go wrong somewhere or is it an error in the textbook?
Your answer is correct, looking at just the product of exponential functions: $$\prod_{i=1}^{m}\exp(\frac{-(x_i-\mu_1)^2}{2\sigma^2})\prod_{i=1}^{n}\exp(\frac{-(y_i-\mu_2)^2}{2\sigma^2})$$ $$=\exp(\frac{-\sum_{i=1}^{m}(x_i-\mu_1)^2}{2\sigma^2})\exp(\frac{-\sum_{i=1}^{n}(y_i-\mu_2)^2}{2\sigma^2})$$ $$=\exp(-\frac{1}{2\sigma^2}[\sum_{i=1}^{m}(x_i-\mu_1)^2+\sum_{i=1}^{n}(y_i-\mu_2)^2])$$
When I took mathematical statistics this book was used, it is notoriously full of errors in the problem solutions.