The conditional distribution of $Y|X=x$ is Normal$(x,1)$. The marginal distribution of $X$ is Normal$(0,1)$

Find the distribution of $Y-X|X=x$.

I notice that since the conditional distribution of $Y$ has $x$ as a parameter, this implies that $X$ and $Y$ are not independent. Which is unusual because in my courses the theory has been mainly about independent random variables.

Anyway, I proceed by doing what seems natural. Let $Z = Y-X$. Then I need to find $$f_{Z|X=x}(z|x)=\frac{f(z,x)}{f_X(x)}$$

To find $f(z,x)$ I need to know $f_Y(y)$.

$$f_{Y|X=x}(y|x) = \frac{1}{\sqrt{2\pi}}\exp(-\frac12(y-x)^2)=\frac{f(x,y)}{f_X(x)}$$

This implies that $$f(x,y) =f_X(x)\cdot f_{Y|X=x}(y|x) = \frac{1}{\sqrt{2\pi}}\exp\left(-\frac12x^2\right) \cdot \frac{1}{\sqrt{2\pi}}\exp\left(\frac12(y-x)^2\right)$$ $$ = \frac{1}{2\pi}\exp\left(-\frac12(x^2 +(y-x)^2) \right)$$

Then according to Wolfram, $f_Y(y) = \frac{1}{2\sqrt{\pi}}\exp\left( -y^2/4\right)$

I thought that I could find $f(x,y)$, then create another variable to use the Jacobian method to find $f(z,x)$. But since $X$ and $Y$ are not independent, I have no idea how to find $f(x,y)$.

Would like some guidance for this problem. Any help would be appreciated.

  • 3
    $\begingroup$ Hint: the conditional distribution of $Y-X$ given that $X = x$ just the distribution of $Y-x$ which is $N(0,1)$? $\endgroup$ Feb 8, 2017 at 4:37
  • $\begingroup$ @DilipSarwate: I feel like in this case $Y-x$ would be Normal with mean $x$ and I don't know about the variance because $X$ and $Y$ are not independent. Don't you add (or subtract) the means? And if the random variables are independent you can sum their variances. $\endgroup$ Feb 8, 2017 at 5:07
  • 3
    $\begingroup$ You should have something better than feelings to go on. Everything Dilip said is correct $\endgroup$
    – Glen_b
    Feb 8, 2017 at 9:53
  • $\begingroup$ The accepted answer references the first comment here, but I think there is a word or phrase missing from the comment. At least it is hard for me to parse. @DilipSarwate, can you please clarify your comment here? $\endgroup$ May 25, 2023 at 16:30
  • $\begingroup$ @ChadSexington The conditional distribution of $Y-X$ given that $X=x$ is the same as the conditional distribution of $Y-x$ given that $X=x$. But, given that $X=x$, the conditional distribution of $Y$ is $N(x,1)$ and so the conditional distribution of $Y-x$ conditioned on $X=x$ has mean $0$, no? and variance $1$? Going back to what the first sentence is saying, we conclude that for every real number $x$, the conditional distribution of $Y-X$ conditioned on $X=x$ is $N(0,1)$ which suggests to me that $X$ and $Y-X$ are actually iid $N(0,1)$ random variables, but ymmv. $\endgroup$ May 25, 2023 at 18:22

2 Answers 2


You have found $f_{X,Y}(x,y)$ correctly.

  • Now observe that $f_{X,Y}(x,y)$ is a bivariate Gaussian density by expanding out the terms in that exponent, and then writing them in the standard form of the bivariate Gaussian density. Note down the values of the 5 parameters (means, variances and correlation coefficient) of this bivariate Gaussian density for later use.
  • Next, observe that since $(X,Y)$ is bivariate Gaussian, so is $(X,Y-X) = (X,Z)$ bivariate Gaussian.
  • Finally, note that for bivariate Gaussian $(X,Z)$, the conditional density of $Z$ given that $X=x$ is Gaussian.

In these last two steps, there is no need to write out the densities, or use Jacobians or something like that. Just use the known formulas that relate the five parameters of bivariate Gaussian $(X,Y-X)$ to the known five parameters of bivariate Gaussian $(X,Y)$ (e.g. $\mu_{Y-X} = \mu_Y - \mu_X$, $\sigma_{Y-X}^2 = \sigma_Y^2 + \sigma_X^2 -2 \rho_{Y,X}\sigma_Y\sigma_X$, etc) and then the known formulas for the mean and variance of the conditional Gaussian density of $Z$ given $X = x$ when $(X,Z)$ is bivariate Gaussian. If you do everything correctly, you should get the answer that I suggested in my hint on your question.

Comment: For arbitrary random variables $X$ and $Y$ (not necessarily bivariate Gaussian), it is true that the conditional distribution of $Y-X$ given that $X=x$ is the same as the conditional distribution of $Y-x$ given that $X = x$. The basic idea is that since we are assuming that the event $X=x$ has occurred, then $Y-X$ must have value $Y-x$ under this assumption, and so the conditional distribution of $Y-X$ given that $X=x$ has occurred is the same as the conditional distribution of $Y-x$ given that $X = x$ has occurred.

As corroborative detail intended to give a touch of artistic verisimilitude to the otherwise bald and unconvincing narrative above, consider that if $X$ and $Y$ are jointly continuous random variables with joint density $f_{X,Y}(x,y)$, then $$f_{Y\mid X}(y\mid X=x_0) = \frac{f_{X,Y}(x_0,y)}{f_{X}(x_0)}$$ while the usual Jacobian method of random vector density transformation gives $$f_{X,Z}(x,z) = f_{X,Y-X}(x,z) = f_{X,Y}(x,z+x)\\ f_{X,\hat Z}(x,z) = f_{X,Y-x_0}(x,z) = f_{X,Y}(x,z+x_0)$$ and so $$f_{Z\mid X}(z\mid X=x_0) = \frac{f_{X,Z}(x_0,z)}{f_{X}(x_0)} = \frac{f_{X,Y}(x_0,z+x_0)}{f_{X}(x_0)} = f_{Y\mid X}(z+x_0\mid X=x_0)\\ f_{\hat Z\mid X}(z\mid X=x_0) = \frac{f_{X,Y-x_0}(x_0,z)}{f_{X}(x_0)} = \frac{f_{X,Y}(x_0,z+x_0)}{f_{X}(x_0)} = f_{Y\mid X}(z+x_0\mid X=x_0)$$ that is, $f_{Y-X\mid X}(z\mid X = x_0)$, the conditional density of $Z=Y-X$ conditioned on $X = x_0$ is the same as $f_{Y-x_0\mid X}(z\mid X = x_0)$, the conditional density of $\hat Z = Y-x_0$ conditioned on $X = x_0$.

  • $\begingroup$ Expanding the exponent gives $2x^2 - 2xy + y^2$. Since $X$ is $N(0,1)$, we know that $\sigma_x = 1$ and $\mu_x=0$. But with those two values I can't reduce the standard form of the bivariate Gaussian to what I have. $\endgroup$ Feb 8, 2017 at 17:21
  • $\begingroup$ @SOULed_Outt You computed the pdf of $Y$ from which you can deduce (I hope) that $\mu_Y = 0, \sigma_{Y}^2 = 2.$ So you have 4 of the five parameters already. Now, notice that the $2\pi \sqrt{1-\rho^2}\sigma_X\sigma_Y$ that occurs somewhere in the bivariate Gaussian density formula happens to have value $2\pi$ in this case, which suggests that $\rho = \pm \cdots$. So, keep chugging away... $\endgroup$ Feb 8, 2017 at 21:00
  • $\begingroup$ I thought my pdf of $Y$ was incorrect, so I didn't think to use the fact that it was $N(0,2)$ to save computational time (and lots of mistakes). I was wondering if you had any suggestions to text where I could practice with concepts like this. Thanks for the help. $\endgroup$ Feb 9, 2017 at 3:19

We are given: \begin{equation} Y|X=x \sim N(x, 1) \;\mathrm{and}\; X \sim N(0, 1) \tag{1} \end{equation} The goal is to find \begin{equation} (Y-X|X=x) \sim \;?. \tag{2} \end{equation}

With \begin{equation} Z=Y-X \tag{3}, \end{equation} we are looking for the probability density $f_{Z|X=x}(z|x)$. We perform a coordinate transform to find, \begin{equation} f_{Z,X}(z,x)(dx \wedge dz) = f_{Z,X}(y-x,x)\frac{\partial z}{\partial y} (dx \wedge dy) \equiv f_{Y,X}(y,x)(dx \wedge dy), \end{equation} where the $(dx \wedge dx)=0$ term has been dropped. From Eq. (3), $\frac{\partial z}{\partial y}=1$. Now we can write \begin{equation} f_{Z|X}(z|x)=\frac{f_{Z,X}(z,x)}{f_{X}(x)}=\frac{f_{Y,X}(y,x)}{f_{X}(x)}=f_{Y|X}(y|x)=f_{Y|X}(z+x|x) \end{equation}

From Eq. (1) we have the conditional probability density \begin{equation} f_{Y|X}(y|x) = \frac{1}{\sqrt{2\pi}}e^{-\frac{1}{2}(y-x)^2}, \end{equation} so plugging in $y=z+x$ gives \begin{equation} f_{Z|X}(z|x)=\frac{1}{\sqrt{2}}e^{\frac{1}{2}z^2}. \end{equation} Which means that \begin{equation} (Y-X|X=x) = (Z|X=x) \sim N(0,1). \end{equation}

If you're looking for a description of the "wedge" ($\wedge$) there is a really good description in this Cross Validated answer.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.