Let $X_1,...,X_n$ be random sample of $X$~$N(\mu,\sigma^2)$ with known $\sigma^2$. I am trying to derive test statistic for that distribution

I know that $\hat{\mu}=\overline{X}$

$$\lambda(x)=\frac{\sup_{\Theta_0}L(\theta|x)}{\sup_{\Theta}L(\theta|x)}=\frac{(2\pi)^\frac{-n}{2}(\sigma^2)^{\frac{-n}{2}}e^{-\frac{1}{2\sigma^2}\sum (x_i-\mu_0)^2}}{(2\pi)^\frac{-n}{2}(\sigma^2)^{\frac{-n}{2}}e^{-\frac{1}{2\sigma^2}\sum (x_i-\overline{x})^2}}$$

Which results in


So my question now is. How to transform numerators exponent from $$\sum(x_i-\mu_0)^2$$ to $$\sum(x_i-\overline{x})^2+n(\overline{x}-\mu_0)^2$$

Whith results in:

$$\sum(x_i-\mu_0)^2 = \sum(x_i-\overline{x})^2+n(\overline{x}-\mu_0)^2$$

It is clearly some product of two exponential functions, but I don't understand it.


1 Answer 1


It's surprisingly simple, and a good trick to remember as it comes in handy in different applications as well:

$$\begin{eqnarray} \sum(x_i-\mu)^2 &=& \sum(x_i-\bar{x}+\bar{x}-\mu)^2 \\ &=&\sum(x_i-\bar{x})^2 + \sum(\bar{x}-\mu)^2+2\sum(x_i-\bar{x})(\bar{x}-\mu) \\ &=& \sum(x_i-\bar{x})^2 + \sum(\bar{x}-\mu)^2 + 2(\bar{x}-\mu)\sum(x_i-\bar{x})\\ &=& \sum(x_i-\bar{x})^2 + \sum(\bar{x}-\mu)^2 \\ &=& \sum(x_i-\bar{x})^2 + n(\bar{x}-\mu)^2 \end{eqnarray}$$ as $\sum(x_i-\bar{x}) = \sum x_i - \sum\bar{x} = \sum x_i - n\bar{x} = \sum x_i - \sum x_i = 0$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.