Solution (source code)

= Solution

For the independent <normal distribution> observations, the log <likelihood> is
$$
\ell(\theta)=-\frac n2\log(2\pi)-\frac12\sum_{i=1}^n(X_i-\theta)^2.
$$
Its <derivative> is $\sum_i(X_i-\theta)$ and its second <derivative> is $-n<0$, so the unique <maximum-likelihood estimate> is
$$
\boxed{\widehat\theta_M=\overline X=\frac1n\sum_iX_i.}
$$
For the prior $\theta\sim N(\mu,\tau^{-1})$ with $\tau>0$, multiplying prior <density> by <likelihood> and completing the square gives
$$
\sum_i(X_i-\theta)^2+\tau(\theta-\mu)^2
=(n+\tau)\left(\theta-\frac{n\overline X+\tau\mu}{n+\tau}\right)^2+\text{a term independent of }\theta.
$$
Thus <normal-normal conjugacy> gives the <posterior distribution>
$$
\theta\mid X\sim N\!\left(\frac{n\overline X+\tau\mu}{n+\tau},\frac1{n+\tau}\right).
$$
For <quadratic loss>, the conditional expected loss of action $a$ is the <posterior variance> plus $(a-\mathbb E[\theta\mid X])^2$. Its unique minimizer is the <posterior mean>, so the <Bayes estimator> is
$$
\boxed{\widehat\theta_B=\frac{n\overline X+\tau\mu}{n+\tau}.}
$$
This weights the sample and prior <means> by their respective precisions.