I'm doing a likelihood ratio test for a random variable $X_i$ for $i = 1, ... 25$. The null hypothesis is $H_0: \mu = 0$ vs $H_a: \mu = 1.5$
While calculating the likelihood ratio, I got stumped with how my book arrived with this. It's really an algebraic simplification that I can't seem to figure out.
Initially I simplified the expression in a different manner where the $\bar X$ term was cancelled out, but for my particular problem, I need to have the $\bar X$ term to calculate the rejection region for $H_0$.

Note that $$\sum^n(x_i - a)^2 = \sum^n(x_i^2 -2ax_i + a^2) =\sum^n x_i^2 -2a\sum^n x_i + \sum^n a^2$$ $$=\sum^n x_i^2 - 2a\cdot n\overline{X} + na^2$$ Subtracting two such sums (taking $a$ to be $\mu_A$ and $\mu_0$ in them) gives $$\sum^n(x_i - \mu_A)^2 -\sum^n(x_i - \mu_0)^2$$ $$=\left(\sum^n x_i^2 - 2\mu_A\cdot n\overline{X} + n\mu_A^2\right)- \left(\sum^n x_i^2 - 2\mu_0\cdot n\overline{X} + n\mu_0^2\right)$$ $$=2n\overline{X}(\mu_0-\mu_A) + n\mu_A^2 - n\mu_0^2 $$
You should be able to see the rest from this.
COMMENT: I think there may be a missing set of parentheses in the last line of the book's answer. It looks like $\frac{1}{2\sigma^2}$ should be applied to everything, not just the first part. Or possibly the parentheses are wrong in the first line--but something is amiss in either case. Along the same lines, I see they goofed the italicising of "$\exp$" as well since that doesn't match either.