Posterior distribution from normal prior

56 Views Asked by At

I was trying to compute the posterior distribution of $X|Y = y$ but I don't know what to do next. The problem is like this:

$X \sim N(10,1) $ and $Y|X = x\sim N(x,1)$, find the distribution of $X|Y = y$

And I was doing:

$f_{x|y}(x) \propto f_x(x)\cdot f_{Y|X=x}(y)$

$f_{x|y}(x) \propto exp(-\frac{(x-10)^2}{2}) \cdot exp(-\frac{(y-x)^2}{2})$

$f_{x|y}(x) \propto exp(-\frac{(x-10)^2 + (y-x)^2}{2})$

$f_{x|y}(x) \propto exp(-\frac{2x^2-20x-2xy+100+y^2}{2})$

$f_{x|y}(x) \propto exp(\frac{-2x^2+20x+2xy-100-y^2}{2})$

$f_{x|y}(x) \propto exp(\frac{-2x(x-10-y)}{2} - \frac{y^2+100}{2})$

How do I remove $x$ on the first term of the $exp(.)$, so I can have the new mean that I imagine would be $10+y$. Or I'm doing something wrong?

1

There are 1 best solutions below

0
On BEST ANSWER

For $f_{x|y}$, $y$ is a fix value. Then we can add or remove summed constants in the exponent:

$$f_{x|y}(x)\propto\exp\left(-\frac{2x^2-20x-2xy+100+y^2}{2}\right)$$ $$f_{x|y}(x)\propto\exp\left(-\frac{2x^2-20x-2xy}{2}\right)$$ $$f_{x|y}(x)\propto\exp\left(-\frac{\frac12(x-5-y/2)^2}{2}\right)$$

Finally $X|Y=y\sim\mathcal{N}\left(5+\frac{y}{2},\frac12\right)$