# How to show mean and standard deviation of Normal distribution?

If a sample is normal with observations independent and identically distributed:

$\mu|\sigma^2 \propto N(\beta \,,\,\sigma^2/\, n_0)$

How can I show that $\mu\,|\,x_1,x_2,....x_n\,,\,\sigma^2 \sim N(\frac {n\bar{x} + n_o\beta}{ n + n_o} \, , \frac {\sigma^2}{n + n_o})$ ? I have been trying to figure this out for days. Originally I assumed both the mean and $x_1,....x_n$ were normally distributed and the the variance as chi squared distributed but I have don't know how to incorporate all three in a manner to get a normal distribution.

## 1 Answer

Since only the terms involving $\mu$ are relevant, I will be dropping multiplicative terms not involving it without warning. \begin{align*} [\mu | x_1,\ldots,x_n,\sigma^2] &\propto [x_1,\ldots,x_n|\mu,\sigma^2] \times [\mu|\sigma^2]\\ &\propto \prod_i \exp(-\frac{(x_i-\mu)^2}{2\sigma^2}) \times \exp(-\frac{(\mu-\beta)^2}{2\sigma^2/n_0})\\ &= \exp(-\frac{\sum_i(x_i-\mu)^2 + n_0(\mu-\beta)^2}{2\sigma^2})\\ & =\exp(-\frac{\sum_i (x_i^2 -2\mu x_i + \mu^2) +n_0(\mu^2-2\mu\beta+\beta^2)}{2\sigma^2})\\ &\propto \exp(-\frac{\mu^2(n+n_0) - 2\mu(\sum_i x_i + n_0\beta)}{2\sigma^2})\\ & \propto\exp(-\frac{(n+n_0)(\mu - \frac{\sum_i x_i + n_0\beta}{n+n_0})^2}{2\sigma^2})\\ & = \exp(-\frac{(\mu - \frac{n\bar{x}+ n_0\beta}{n+n_0})^2}{2\sigma^2/(n+n_0)}) \end{align*}

The last term is recognizable as the pdf of the $N(\frac{n\bar{x}+ n_0\beta}{n+n_0}, \frac{\sigma^2}{n+n_0})$ distribution. Note that the chi-squared distribution was not needed, because the sample variance $S^2$, which needs this distribution, was not used anywhere.

• Can you please elaborate a little on how you went from end of second line to third line ? Nov 18, 2015 at 21:09
• It is based on expanding the squares in the fraction. I have added an additional row with the intermediate step. Nov 19, 2015 at 21:03