Find $\int_{\mathbb{R}^n}e^{-\frac{\| x- a\|^2+\| x- b\|^2}{2}} dx$ How to integrate
\begin{align}
\int_{\mathbb{R}^n}e^{-\frac{\| x- a\|^2+\| x- b\|^2}{2}} dx
\end{align}
where $\| \cdot \|$ is the euclidean distance. 
I did this for the case of $n=1$ (scalar} and got 
\begin{align}
\int_{\mathbb{R}}e^{-\frac{ ( x- a)^2+ ( x- b)^2}{2}} dx=\sqrt{\pi} e^{-\frac{(a-b)^2}{4}}
\end{align}
However, I am having trouble doing this for any $n$. 
 A: HINT:
Note the kernel is separable with
$$\begin{align}
e^{\frac12\left(\|x-a\|^2+\|x-b\|^2\right)}&=\prod_{i=1}^ne^{\frac12\left((x_i-a_i)^2+(x_i-b_i)^2\right)}\\\\
&=\prod_{i=1}^ne^{x_i^2-(a_i+b_i)x_i+\frac12\left(a_i^2+b_i^2\right)}\\\\
&=\prod_{i=1}^ne^{\left(x_i-\frac12\left(a_i+b_i\right)\right)^2+\frac14(a_i-b_i)^2}\\\\
\end{align}$$
A: The problem seems to be completing the square. In $n$ dimensions it works pretty much the same. Here we go (tell me if there is anything that is unclear):
$$
\begin{aligned}
\frac{\|x-a\|^2+\|x-b\|^2}{2}&=\|x\|^2- a\cdot x-b\cdot x+\frac{\|a\|^2+\|b\|^2}{2}\\
&=\Bigl\|x-\frac{a+b}{2}\Bigr\|^2-\Bigl\|\frac{a+b}{2}\Bigr\|^2+\frac{\|a\|^2+\|b\|^2}{2}\\
&=\Bigl\|x-\frac{a+b}{2}\Bigr\|^2+\Bigl\|\frac{a-b}{2}\Bigr\|^2
\end{aligned}
$$
Next, use the fact that the integral is translation invariant, so you get
$$
\begin{aligned}
\int_{\mathbb R^n}\exp\Bigl(-\frac{\|x-a\|^2+\|x-b\|^2}{2}\Bigr)\,dx
&=
\exp\Bigl(-\Bigl\|\frac{a-b}{2}\Bigr\|^2\Bigr)
\int_{\mathbb R^n}\exp\Bigl(-\Bigl\|x-\frac{a+b}{2}\Bigr\|^2\Bigr)\,dx\\
&=
\exp\Bigl(-\Bigl\|\frac{a-b}{2}\Bigr\|^2\Bigr)
\int_{\mathbb R^n}\exp(-\|y\|^2)\,dy.
\end{aligned}
$$
I assume you can take it from here.
A: We can translate the entire space, moving $a$ to $0$ and $b$ to $b-a$.  We can then rotate the space such that the second locus is on the $x$ axis.
If we let r = $\|a-b\|$, and decompose the now-independent integrals, we get:
$$
\begin{align}
\int_{\mathbb{R}^n}e^{-\frac{\| x- a\|^2+\| x- b\|^2}{2}} dx &=
\int_{\mathbb{R}^{n-1}}e ^ {-x^2}dx \int_{\mathbb{R}}e^{-\frac{x^2+(x- r)^2}{2}} dx
\end{align}$$
Which yields:
$$
\sqrt{\pi}^n e^{- \frac{r^2}\4}
$$
