My course notes have a problem,
Assume $\{x_1,\dots,x_n\}$ is a random sample from a Gaussian distribution with unknown mean $\mu$ and precision $\lambda$. Define the statistics $\bar{x}=\sum_{i=1}^nx_i/n$ and $s^2=n^{-1}\sum_{i=1}^n(x_i-\bar{x})^2$. Let the prior be define as $$\pi(\mu,\lambda)=\pi(\mu,\lambda)\pi(\lambda)$$ where $$\pi(\mu|\lambda)=\text{N}\left(\mu\left|m,\frac{1}{p\lambda}\right.\right) \text{ and } \pi(\lambda)=\text{Ga}(\lambda|a,b).$$ Show that the joint posterior distribution of $\mu,\lambda$ is $$\pi(\mu,\lambda|\textbf{x})=\pi_1(\mu|\lambda,\textbf{x})\pi_2(\lambda|\textbf{x}),$$ with $$\pi_1(\mu,\lambda|\textbf{x})=\text{N}\left(\mu\left|m^\ast,\frac{1}{p^\ast\lambda}\right.\right) \text{ and } \pi_2(\lambda|\textbf{x})=\text{Ga}(\lambda|a^\ast,b^\ast),$$ where \begin{align}& p^\ast=n+p,&&m^\ast=\frac{n\bar{x}+mp}{p^\ast},\\&a^\ast=a+\frac{n}{2}\text{ and }&&b^\ast=b+\frac{n}{2}\left(s^2+\frac{p}{n+p}(\bar{x}-m)^2\right).\end{align}
The course notes give a derivation using completing the square. What I can't figure out is why the $\frac{p}{n+p}(\bar{x}-m)^2$ in the $b^\ast$ isn't arbitrary. I think the completing the square involves using proportionality to discard expressions involving $n,m,\bar{x}$, so why should this particular $b^\ast$ be one that can be 'shown' to be correct?