Integrate $\int_{-\infty}^\infty e^{ - \sum_{i=1}^n (x -\mu_i)^2} dx$ I am trying to simplify 
\begin{align}
\int_{-\infty}^\infty e^{ - \sum_{i=1}^n (x -\mu_i)^2} dx 
\end{align}
I know I have to complete the square but I having trouble with double sums. 
 A: Write
$$\sum(x-\mu_i)^2=nx^2-2\sum\mu_ix+\sum\mu_i^2=n\left(x^2-2\frac1n\sum\mu_ix+\left(\frac1n\sum\mu_i\right)^2\right)+\ldots$$
Figure out what's missing in my last line (where the $\ldots$ is) and you should be able to finish it off.
A: $$\sum_1^n (x-\mu_i)^2 = nx^2 -2x \sum_1^n \mu_i + \sum_1^n\mu_i^2
= n \left(x-\frac1n \sum_1^n \mu_i \right)^2 - \frac1n \left(\sum_1^n \mu_i\right)^2+\sum_1^n\mu_i^2\\
=n \left(x-\left<\mu\right> \right)^2 + n\left(\left<\mu^2\right> - \left<\mu\right>^2\right)
$$ where $\left<\mu^2\right>$ is the average value of $\mu_i^2$ and $\left<\mu\right>$ is the average value of $\mu_i$.
So after bringing the constant 
$$
e^{-n\left(\left<\mu_i^2\right> - (\left<\mu_i\right>)^2\right)}
$$
out of the integral, and making the substitution $x = y/\sqrt{n}$,
you are left with an integral of the form 
$$
\int_{-\infty}^\infty e^{-(y-\sqrt{n}\left<\mu\right>)^2}
$$
which is an integral you can do by the usual trick of going over to two dimensions and using polar coordinates.
