# Conditional Distributions for Continuous Random Variables

Thus far, all of our definitions and examples concerned discrete random variables, but the definitions and examples can be easily modified for continuous random variables. That's what we'll do now!

 Definition. Suppose X and Y are continuous random variables with joint probability density function f(x,y) and marginal probability density functions fX(x) and fY(y), respectively. Then, the conditional probability density function of Y given X = x is defined as: $$h(y|x)=\dfrac{f(x,y)}{f_X(x)}$$ provided fX(x) > 0. The conditional mean of Y given X = x is defined as: $$E(Y|x)=\int_{-\infty}^\infty yh(y|x)dy$$ The conditional variance of Y given X = x is defined as: $$Var(Y|x)=E\{[Y-E(Y|x)]^2|x\}=\int_{-\infty}^\infty [y-E(Y|x)]^2 h(y|x)dy$$ or, alternatively, using the usual shortcut: $$Var(Y|x)=E[Y^2|x]-[E(Y|x)]^2=\left[\int_{-\infty}^\infty y^2h(y|x)dy\right]-\mu^2_{Y|x}$$

Although the conditional p.d.f., mean, and variance of X, given that Y = y, is not given, their definitions follow directly from those above with the necessary modifications. Let's take a look at an example involving continuous random variables.

### Example

Suppose the continuous random variables X and have the following joint probability density function:

$$f(x,y)=\dfrac{3}{2}$$

for x2y ≤ 1 and  0 < x < 1. What is the conditional distribution of Y given X = x?

Solution. We can use the formula:

$$h(y|x)=\dfrac{f(x,y)}{f_X(x)}$$

to find the conditional p.d.f. of Y given X. But, to do so, we clearly have to find fX(x), the marginal p.d.f. of X first. Recall that we can do that by integrating the joint p.d.f. f(x,y) over S2, the support of Y. Here's what the joint support S looks like:

So, we basically have a plane, shaped like the support, floating at a constant 3/2 units above the xy-plane. To find fX(x) then, we have to integrate:

$$f(x,y)=\dfrac{3}{2}$$

over the support x2 ≤ y ≤ 1. That is:

$$f_X(x)=\int_{S_2}f(x,y)dy=\int^1_{x^2} 3/2dy=\left[\dfrac{3}{2}y\right]^{y=1}_{y=x^2}=\dfrac{3}{2}(1-x^2)$$

for 0 < x < 1. Now, we can use the joint p.d.f f(x,y) that we were given and the marginal p.d.f. fX(x) that we just calculated to get the conditional p.d.f. of Y given X = x:

$$h(y|x)=\dfrac{f(x,y)}{f_X(x)}=\dfrac{\frac{3}{2}}{\frac{3}{2}(1-x^2)}=\dfrac{1}{(1-x^2)},\quad 0<x<1,\quad x^2 \leq y \leq 1$$

That is, given x, the continuous random variable Y is uniform on the interval (x2, 1). For example, if x = ¼, then the conditional p.d.f. of Y is:

$$h(y|1/4)=\dfrac{1}{1-(1/4)^2}=\dfrac{1}{(15/16)}=\dfrac{16}{15}$$

for 1/16 ≤ y ≤ 1. And, if x = ½, then the conditional p.d.f. of Y is:

$$h(y|1/2)=\dfrac{1}{1-(1/2)^2}=\dfrac{1}{1-(1/4)}=\dfrac{4}{3}$$

for 1/4 ≤ y ≤ 1.

#### What is the conditional mean of Y given X = x?

Solution. We can find the conditional mean of Y given x just by using the definition in the continuous case. That is:

Note that given that the conditional distribution of Y given Xis the uniform distribution on the interval (x2, 1), we shouldn't be surprised that the expected value looks like the expected value of a uniform random variable!

Let's take the case where x = 1/2. We previously showed that the conditional distribution of Y given X = ½ is

$$h(y|1/2)=\dfrac{1}{1-(1/2)^2}=\dfrac{1}{1-(1/4)}=\dfrac{4}{3}$$

for 1/4 ≤ y ≤ 1. Now, we know that the conditional mean of  Y given X = ½ is:

$$E(Y|\dfrac{1}{2})=\dfrac{1+(1/2)^2}{2}=\dfrac{1+(1/4)}{2}=\dfrac{5}{8}$$

If we think again of the expected value as the fulcrum at which the probability mass is balanced, our results here make perfect sense: