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!
 Conditional Probability Density Function of \(Y\) given \(X=x\)

Suppose \(X\) and \(Y\) are continuous random variables with joint probability density function \(f(x,y)\) and marginal probability density functions \(f_X(x)\) and \(f_Y(y)\), respectively. Then, the conditional probability density function of \(Y\) given \(X=x\) is defined as:
\(h(yx)=\dfrac{f(x,y)}{f_X(x)}\)
provided \(f_X(x)>0\). The conditional mean of \(Y\) given \(X=x\) is defined as:
\(E(Yx)=\int_{\infty}^\infty yh(yx)dy\)
The conditional variance of \(Y\) given \(X=x\) is defined as:
\(Var(Yx)=E\{[YE(Yx)]^2x\}=\int_{\infty}^\infty [yE(Yx)]^2 h(yx)dy\)
or, alternatively, using the usual shortcut:
\(Var(Yx)=E[Y^2x][E(Yx)]^2=\left[\int_{\infty}^\infty y^2h(yx)dy\right]\mu^2_{Yx}\)
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 203 Section
Suppose the continuous random variables \(X\) and \(Y\) have the following joint probability density function:
\(f(x,y)=\dfrac{3}{2}\)
for \(x^2\le y\le 1\) and \(0<x<1\). What is the conditional distribution of \(Y\) given \(X=x\)?
Solution
We can use the formula:
\(h(yx)=\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 \(f_X(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 \(S_2\), 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 \(\frac{3}{2}\) units above the \(xy\)plane. To find \(f_X(x)\) then, we have to integrate:
\(f(x,y)=\dfrac{3}{2}\)
over the support \(x^2\le y\le 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}(1x^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. \(f_X(x)\) that we just calculated to get the conditional p.d.f. of \(Y\) given \(X=x\):
\( h(yx)=\dfrac{f(x,y)}{f_X(x)}=\dfrac{\frac{3}{2}}{\frac{3}{2}(1x^2)}=\dfrac{1}{(1x^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 \((x^2, 1)\). For example, if \(x=\frac{1}{4}\), then the conditional p.d.f. of \(Y\) is:
\( h(y1/4)=\dfrac{1}{1(1/4)^2}=\dfrac{1}{(15/16)}=\dfrac{16}{15}\)
for \(\frac{1}{16}\le y\le 1\). And, if \(x=\frac{1}{2}\), then the conditional p.d.f. of \(Y\) is:
\( h(y1/2)=\dfrac{1}{1(1/2)^2}=\dfrac{1}{1(1/4)}=\dfrac{4}{3}\)
for \(\frac{1}{4}\le y\le 1\).
What is the conditional mean of \(Y\) given \(X=x\)? Section
Solution
We can find the conditional mean of \(Y\) given \(X=x\) just by using the definition in the continuous case. That is:
Note that given that the conditional distribution of \(Y\) given \(X=x\) is the uniform distribution on the interval \((x^2,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=\frac{1}{2}\). We previously showed that the conditional distribution of \(Y\) given \(X=\frac{1}{2}\) is
\( h(y1/2)=\dfrac{1}{1(1/2)^2}=\dfrac{1}{1(1/4)}=\dfrac{4}{3}\)
for \(\frac{1}{4}\le y\le 1\). Now, we know that the conditional mean of \(Y\) given \(X=\frac{1}{2}\) 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: