# Marginal Density Function from Joint Probability Density Function

I am in an introduction to probability class and we just covered joint probabilities. I came across a question which I cannot compute and would appreciate some help.

Suppose $$X$$, $$Y$$ are jointly continuous with joint probability density function $$f(x, y) = \frac{1}{2\pi}e^{-\frac{x^2}{2}-\frac{(x-y)^2}{2}}$$ with $$x$$, $$y$$ $$\in$$ (-$$\infty$$, $$\infty$$). Find the marginal density functions of $$X$$ and $$Y$$. Hint: you can do this without complicated integrals.

I am aware that $$f(x, y)$$ looks like two normal densities, but I am unable to figure out how to use this to my advantage when calculating the marginal densities without brute integration. Any help would be appreciated.

• To find the marginal of X, you want to integrate the joint density with respect to y. Rather than solving the resulting integral, try to manipulate it a little to make it look like a known density function, which you know integrates to 1. Mar 28, 2020 at 19:40
• @Nasenhaar I tried to manipulate it to look like the standard bivariate normal distribution, but wasn't able to. Is this the correct density function (which I know integrates to 1)? Mar 28, 2020 at 19:46

You are right that this looks like a bivariate normal distribution. Therefore let us try to express the given density in such a way. The density of a bivariate normal distribution is given by $$g(z)= \frac{1}{2\pi \sqrt{\text{det} \Sigma}} e^{-\frac{1}{2}(z - \mu)^T \Sigma^{-1} (z-\mu)}, z\in \mathbb{R}^2$$, where $$\Sigma \in \mathbb{R}^{2 \times 2}$$ is the covariance matrix and $$\mu \in \mathbb{R}^2$$ is the expectation. The fact that the term in the exponent of your given density function does not contain any terms that are not depending on $$x$$ or $$y$$ suggests $$\mu =0$$. Now easy calculations give that \begin{align} \Sigma^{-1}= \left( \begin{matrix} 2& -1 \\ -1 & 1 \end{matrix} \right) \end{align} fulfills \begin{align} \left( \begin{matrix} x &y \end{matrix} \right) \Sigma^{-1} \left( \begin{matrix} x \\y \end{matrix} \right) = x^2 + (x-y)^2. \end{align} Now inverting gives $$\Sigma= \left( \begin{matrix} 1& 1 \\ 1 & 2 \end{matrix} \right)$$ and $$\text{det}\Sigma=1$$. Therefore the given density function is the density of a bivarite normal distribution with covariance matrix $$\Sigma$$ as above and zero expectation. It is well known that for a multivariate normal distribution $$Z \sim N(\mu,\Sigma)$$ the random variable $$c^TZ$$ has the distribution $$N(c^T\mu, c^T \Sigma c)$$ and thus in your case $$X \sim N(0,1)$$ and $$Y \sim N(0,2)$$.
$$f_X(x)=\int_{-\infty}^\infty f(x,y)\, dy=\frac{1}{2\pi}e^{-x^2/2}\int_{-\infty}^\infty e^{-(x-y)^2/2}\, dy$$. Notice that with $$u=x-y,$$ above is equivalent to $$\frac{1}{2\pi}e^{-x^2/2}\int_{-\infty}^\infty e^{-u^2/2}\, du$$ In general, for a normal distribution $$N(\mu,\sigma)$$, the density is $$\frac{1}{\sqrt{2\pi\sigma^2}}e^{-(x-\mu)^2/2\sigma^2}.$$ For the integral above involving $$u$$, suppose $$\sigma=1$$. Then it can be rewritten as $$\left[\frac{1}{2\pi}\cdot\sqrt{2\pi\sigma^2} e^{-x^2/2}\right]\left[\frac{1}{\sqrt{2\pi\sigma^2}}\int_{-\infty}^\infty e^{-u^2/2\sigma^2}\, du\right],$$ with the term on the right evaluating to $$1$$. See if you can apply a similar technique for $$f_Y(y)$$. Also, if you clean up the term on the left, you will see that $$X\sim N(0,1)$$.
• Suppose $u=x-y$. Then you're right that $du=-dy$. But when $y \to -\infty$, we see that $u \to \infty$ and when $y \to \infty$, we see that $u \to -\infty$. Hence you get an integral like $-\int_{\infty}^{-\infty} ...$. But in general, $-\int_a^b=\int_b^a$. Thus, the sign doesn't really change. Mar 28, 2020 at 22:56