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

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.

• Hint: the conditional distribution of $Y-X$ given that $X = x$ just the distribution of $Y-x$ which is $N(0,1)$? Feb 8 '17 at 4:37
• @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. Feb 8 '17 at 5:07
• You should have something better than feelings to go on. Everything Dilip said is correct Feb 8 '17 at 9:53

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$.

• 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. Feb 8 '17 at 17:21
• @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... Feb 8 '17 at 21:00
• 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. Feb 9 '17 at 3:19