# Question about a marginal distribution

If I observe the following:

$X \sim N(\mu_x,\sigma^2_x)$

$Y|X=x \sim N(x,\sigma^2_y)$

My objective is to calculate the marginal distribution of $Y$.

(Since the variance term does not address some form of correlation $\rho$, the dependence between both random variables clearly needs to be addressed w.r.t. to the expected value of $Y$)

By the usual formulas we will get $f(y)$ by:

$f(y) = \int_{-\infty}^\infty f(x,y)dx$

where $f(x,y) = f(y|X=x) f(x) = \frac{1}{\sqrt{2\pi\sigma_x^2}}\frac{1}{\sqrt{2\pi\sigma_y^2}}exp\{-\frac{1}{2}[(\frac{y-x}{\sigma_y})^2 + (\frac{x-\mu_x}{\sigma_x})^2 ]\}$

I know the usual bivariate case and this looks like that case, where the correlation $\rho$ is zero and solving would be easy. But here in both terms the $x$ factor needs to be addressed and I'm not quite sure how to solve for $x$.

• There's your problem! You don't 'solve for $x$'. You expand out, and complete the square in $x$ in the exponent, and pull out all the rest as constants out the front of the integration. If you organize it right, what's inside the integral is proportional to a normal density; you multiply and divide by the appropriate constants so the integral is 1 and what's left is now a density in $y$ with the various parameters ($\mu_x$, $\sigma_y$, $\sigma_x$ etc) taking part. Jun 11, 2013 at 2:03

The standard way to do the calculation is to expand the argument of the $\exp$ term as a quadratic in $x$, complete the square, and get to the result that $f(y)$ is also a normal density. Or, you can use the fact that you know that $E[Y\mid X=x] = x$ and so $E[Y\mid X]$ is a random variable (it equals $X$) with mean $$E[Y] = E[E[Y\mid X]] = E[X] = \mu_x.$$ Also, $E[Y^2\mid X=x] = x^2 + \sigma_y^2$ so that $$E[Y^2] = E[E[Y^2\mid X]] = E[X^2+\sigma_y^2] = \mu_x^2 + \sigma_x^2 + \sigma_y^2$$ from which we get that $\operatorname{var}(Y) = E[Y^2]-(E[Y])^2 = \sigma_x^2 + \sigma_y^2.$ Now, given the asserted normality of $Y$, we can write down the density of $Y$ without much further ado.
From a slightly different viewpoint, consider the model $Y = X + e$ where $X \sim N(\mu_x,\sigma_x^2)$ and $e \sim N(0,\sigma_y^2)$ are independent random variables with $e$ playing the part of "noise" in the measurement of $X$, with said measurement yielding $Y$ instead of the desired $X$. Clearly, given that the value of $X$ is $x$, the conditional distribution of $Y$ is normal with mean $x$ and variance $\sigma_y^2$ which is what you are given. Equally clearly, $Y$, being the sum of two independent normal random variables, is normal with mean $\mu_x$ and variance $\sigma_x^2+\sigma_y^2$. This calculation requires even less algebra than the two suggested above.