Solution (source code)

= Solution

Take $\sigma,\tau>0$ to be the positive standard deviations. Multiply the normal <likelihood function> by the normal <prior density>. Terms independent of $\theta$ can be absorbed into the normalizing constant:
$$
\pi(\theta\mid x)\propto
\exp\!\left[-\frac1{2\sigma^2}\sum_i(x_i-\theta)^2
-\frac{\theta^2}{2\tau^2}\right].
$$
The identity $\sum_i(x_i-\theta)^2=\sum_i(x_i-\overline x)^2+n(\theta-\overline x)^2$ makes the quadratic term explicit. Completing the square gives
$$
\pi(\theta\mid x)\propto\exp\!\left[-\frac{(\theta-\mu_n)^2}{2v_n}\right],
$$
where
$$
\boxed{v_n=\left(\frac n{\sigma^2}+\frac1{\tau^2}\right)^{-1}
=\frac{\sigma^2\tau^2}{\sigma^2+n\tau^2},\qquad
\mu_n=\frac{n\tau^2}{\sigma^2+n\tau^2}\overline x.}
$$
Thus $\theta\mid x\sim N(\mu_n,v_n)$. This is <normal-normal conjugacy>: prior and data precisions add, and the <posterior mean> shrinks the <sample mean> towards the prior mean zero.