Let [mathjaxinline](X,Y)[/mathjaxinline] be a pair of random variables with joint density [mathjaxinline]h(x,y) = x+y[/mathjaxinline] over the space [mathjaxinline][0,1]^2[/mathjaxinline].

What is the marginal density of [mathjaxinline]X[/mathjaxinline]? We denote this by writing [mathjaxinline]h(x)[/mathjaxinline].

[mathjaxinline]h(x)=[/mathjaxinline]

What is the conditional density of [mathjaxinline]Y[/mathjaxinline] given [mathjaxinline]X=x[/mathjaxinline]? We denote this by writing [mathjaxinline]h(y|x)[/mathjaxinline].

[mathjaxinline]h(y|x)=[/mathjaxinline]

Consider the joint density setup as in the previous problem. What is the variance of Y given X=x?

\textsf{Var}(Y | X=x)=

1 answer

To find the marginal density of X, we integrate the joint density over the range of Y:

[math]\begin{align*}
h(x) &= \int_{0}^{1} (x+y) dy \\
&= xy + \frac{1}{2}y^2 \Bigg|_{0}^{1} \\
&= x + \frac{1}{2}
\end{align*}[/math]

So the marginal density of X is [math]h(x) = x + \frac{1}{2}[/math].

To find the conditional density of Y given X=x, we divide the joint density by the marginal density of X:

[math]\begin{align*}
h(y|x) &= \frac{h(x, y)}{h(x)} \\
&= \frac{x+y}{x+\frac{1}{2}}
\end{align*}[/math]

To find the variance of Y given X=x, we use the formula for conditional variance:

[math]\begin{align*}
\text{Var}(Y|X=x) &= E\left[(Y-E(Y|X=x))^2|X=x\right] \\
&= E\left[(Y-E(Y|X=x))^2\right] \quad \text{(since }X=x\text{ is already given)} \\
&= E\left[Y^2 - 2YE(Y|X=x) + (E(Y|X=x))^2\right] \\
&= E(Y^2) - 2E(YE(Y|X=x)) + E(Y|x)^2 \\
&= E(Y^2) - 2\left(E(YE(Y))|X=x\right) + E(Y|x)^2 \quad \text{(using the law of iterated expectations)} \\
&= E(Y^2) - 2\left(E(YE(Y))\right) + E(Y|x)^2 \quad \text{(since }X=x\text{ is constant)} \\
&= E(Y^2) - 2E(Y^2) + E(Y|x)^2 \quad \text{(since }Y\text{ and }E(Y)\text{ are independent given }X) \\
&= - E(Y^2) + E(Y|x)^2 \\
\end{align*}[/math]

Now we need to find [math]E(Y^2)[/math]:

[math]\begin{align*}
E(Y^2) &= \int_{0}^{1} y^2 h(y|x) dy \\
&= \int_{0}^{1} y^2 \frac{x+y}{x+\frac{1}{2}} dy \\
&= \frac{x^2+2x+\frac{5}{6}}{3x+1}
\end{align*}[/math]

Finally, substituting this into the formula for the variance, we have:

[math]\begin{align*}
\text{Var}(Y|X=x) &= - E(Y^2) + E(Y|x)^2 \\
&= -\frac{x^2+2x+\frac{5}{6}}{3x+1} + \left(\frac{x+1}{2}\right)^2 \\
&= -\frac{x^2+2x+\frac{5}{6}}{3x+1} + \frac{x^2+2x+1}{4} \\
&= -\frac{4x^2+8x+\frac{5}{6}}{12x+4} + \frac{3x^2+6x+3}{12} \\
&= -\frac{4x^2+8x+\frac{5}{6}}{12x+4} + \frac{3x^2+6x+3}{12} \\
&= \frac{9x^2+18x+9-4x^2-8x-\frac{5}{6}}{12} \\
&= \frac{5x^2+10x+\frac{49}{6}}{12}
\end{align*}[/math]

So the variance of Y given X=x is [math]\frac{5x^2+10x+\frac{49}{6}}{12}[/math].