Algebraic simplification of likelihood ratio Can someone help me understand how this:
$$\frac{f_1(x)}{f_0(x)}=\frac{\frac{1}{\sqrt{2\pi\sigma^2}}\exp\left(-\frac{1}{2}\sum_{i=1}^n(x_i-1)^2\right)}{\frac{1}{\sqrt{2\pi\sigma^2}}\exp\left(-\frac{1}{2}\sum_{i=1}^nx_i^2\right)}$$
simplifies to this?:
$$\exp\left[n\left(\overline{x}_n-\frac{1}{2}\right)\right]$$
Thanks!
 A: This is an annoying but routine algebra problem (as you probably have already guessed).  Let's call the right-hand side of your first equation $L(\vec{x})$.  Then we can cancel the factors of $1/\sqrt{2\pi\sigma^2}$ to get
$$L(\vec{x}) = {\exp \left( - {1 \over 2} \sum_{i=1}^n (x_i-1)^2 \right) \over \exp \left( - {1 \over 2} \sum_{i=1}^n x_i^2 \right)}$$
It is often a useful trick, in these likelihood-ratio problems, to rewrite a ratio of exponentials as an exponential of a difference; that gives
$$L(\vec{x}) = \exp \left( -{1 \over 2} \left[ \sum_{i=1}^n (x_i-1)^2 - \sum_{i=1}^n x_i^2 \right] \right)$$
and now you can combine the two sums into one to get
$$L(\vec{x}) = \exp \left( -{1 \over 2} \left[ \sum_{i=1}^n ((x_i-1)^2 - x_i^2) \right] \right)$$
The summand $(x_i-1)^2 - x_i^2$ is equal to $-2x_i + 1$ and so
$$L(\vec{x}) = \exp \left( -{1 \over 2} \left[ \sum_{i=1}^n (-2x_i + 1) \right] \right)$$
and you should be able to do it from here. 
A: You can cancel the square root terms, obviously. Then, using laws of indices, combine the exponents. If you expand the brackets within the summation and express the sum as separate sums, terms will cancel. You will need the formula for the mean.
A: Note that $$\begin{align*} \sum_{i=1}^n (x_i - 1)^2 &= \sum_{i=1}^n (x_i^2 - 2x_i + 1) \\ &= \left(\sum_{i=1}^n x_i^2\right) - \left(2\sum_{i=1}^n x_i \right) + n \\ &= \left( \sum_{i=1}^n x_i^2 \right) - 2n \bar x + n, \end{align*}$$ where $\bar x = \frac{1}{n} \sum_{i=1}^n x_i$ is the sample mean.  Now recalling that $$\frac{\exp(a)}{\exp(b)} = \exp(a-b),$$ we immediately and easily obtain $$\frac{f_1(\boldsymbol x)}{f_0(\boldsymbol x)} = \exp((-\tfrac{1}{2})(-2n \bar x + n)) = \exp\left( n (\bar x - \tfrac{1}{2}) \right).$$
