Let $(X_1, \cdots, X_n)$ be random samples of a normal r.v. X with unknown mean $\mu$ and variance 1. Assume that $\mu$ is itself to be a normal rv with mean 0 and variance 1. Find the Bayes estimator of $\mu$ (no problem here)
I'm given the prior distribution:
$$f(\mu) =\frac{1}{\sqrt{2\pi}} e^{-\mu^2/2}\tag{1}$$
And I'm given the apriori distribution:
$$f(x_1,\cdots, x_n~ \mid~ \mu) = \Big(\frac{1}{2\pi}\Big)^{n/2} \exp\Big[-\frac{1}{2}\sum \limits_{i=1}^{n}(x_i - \mu)^2\Big]\tag{2}$$
They tell me to find the joint between the data $x_i$ and the parameter $\mu$, that is:
$$f(x_1, \cdots, x_n, \mu) = f(x_1, \cdots, f_n ~\mid~ \mu)~f(\mu)\tag{3}$$
I substitute (1) and (2) into (3) and I get:
$$f(x_1, \cdots, x_n , \mu) = \Big(\frac{1}{2\pi}\Big)^{n/2} \exp\Big[-\frac{1}{2}\sum \limits_{i=1}^{n}(x_i - \mu)^2\Big]\Big[\frac{1}{\sqrt{2\pi}} e^{-\mu^2/2}\Big]$$
After some algebra I get:
$$f(x_1, \cdots, x_n , \mu) = \frac{\exp\Big[-\sum \limits_{i=1}^{n} \frac{x_i^2}{2} \Big]}{(2\pi)^{(n+1)/2}} \exp\Big[-\frac{(n+1)}{2}\Big(\mu^2 - \frac{2\mu}{n+1}\sum \limits_{i=1}^{n} x_i \Big) \Big]\tag{4}$$
Then I let:
$$C = \frac{\exp\Big[-\sum \limits_{i=1}^{n} \frac{x_i^2}{2} \Big]}{(2\pi)^{(n+1)/2}}$$
$$f(x_1, \cdots, x_n , \mu) = C \exp\Big[-\frac{(n+1)}{2}\Big(\mu^2 - \frac{2\mu}{n+1}\sum \limits_{i=1}^{n} x_i \Big) \Big]\tag{5}$$
And indeed (5) matches what the workbook says that I should get at this step in the problem. Now, for the step I get stuck on. The workbook further manipulates (4) to get (5):
$$f(x_1, \cdots, x_n , \mu) \\~~= C \cdot \exp\Bigg[ \frac{1}{2(n+1)}\Big(\sum \limits_{i=1}^{n} x_i\Big)^2\Bigg] \cdot\exp\Bigg[-\frac{(n+1)}{2}\Big(\mu-\frac{1}{n+1}\sum \limits_{i=1}^{n} x_i\Big)^2\Bigg]\tag{6}$$
My question is, how did they get from (5) to (6)?