# Solved – Question about deriving posterior distribution from normal prior and likelihood

I am trying to understand how to derive the posterior distribution of a parameter $$mu$$ given data vector $$z$$, $$P(mu|z)$$, where
$$mu sim N(0,A)$$
and
$$z|mu sim N(mu,1).$$

Obviously from Bayes theorem
$$P(mu|z) = g(mu) f(z|mu) /f(z).$$
where
$$f(z)= int g(mu) f(z|mu) d mu .$$

I can write $$g(mu) f(z|mu)$$ as a pointwise product of normal densities:

$$frac{1}{2 pi sqrt{A}} exp bigg(-frac{mu^2+A(z-mu)^2}{2A}bigg)$$

the solution is given in Efron's book on Large Scale Inference, p. 2. here:

$$mu|z sim N(zB,B)$$ where $$B=frac{A}{A+1}$$

I would appreciate advice on how to approach the problem (and the answer to this question is a proof). In particular I do not understand what to do with the integral in the numerator of Bayes theorem.

EDIT
Following answer by @Neil_G I took a next approach:

We have:
begin{align} g(mu) &propto expbigg(- frac{mu^2}{2A}bigg) \[8pt] f(z|mu) &propto expbigg(z mu – frac{1}{2}(z^2+mu^2)bigg) end{align}

so
begin{align} P(mu|z) &propto expbigg(- frac{1}{2A} mu^2 + zmu – frac{1}{2} z^2 – frac{1}{2} mu^2bigg) \[8pt] &= exp bigg(-frac{1}{2B} (mu^2+Bz^2-2Bz mu)bigg) \[8pt] &propto exp bigg(-frac{1}{2B} (mu^2-2Bz mu)bigg) \[8pt] &propto exp bigg(-frac{ (mu – Bz)^2}{2B}bigg) end{align}

which completes the proof.

Contents