Find $\operatorname{Var}(Y)$ when $f_{X}(x)=3x^{2}I_{\{0Let $X$ be a random variable with the following pdf:
$$
f_{X}(x)=3x^{2}I_{\{0<x<1\}}
$$
let $Y$ be a random variable so $\left(Y\mid X=x\right)\sim \operatorname{Uni}[96x,100x]$. Calculate $\operatorname{Var}(Y)$.
What I did: If $(Y\mid X=xt)\sim \operatorname{Uni}[96x,100x]$ then $f_{Y\mid X}(y\mid x)=\frac{1}{4x}$ and so:
$$
f_{X,Y}(x,y)=f_{Y\mid X}(y\mid x)\cdot f_{X}(x)=\frac{1}{4x}\cdot3x^{2}I_{\{0<x<1\}}=\frac{3}{4}xI_{\{0<x<1\}}
$$
Let's find $f_{Y}(y)$:
$$
f_{Y}(y)=\int_{-\infty}^{\infty}f_{X,Y}(x,y)\,dx=\int_{-\infty}^{\infty}\frac{3}{4}xI_{\{0<x<1\}}dx=\frac{3}{4}\int_{0}^{1}x\,dx=\frac{3}{8}
$$
Let's find $E\left(Y\right)$:
$$
E\left(Y\right)=\int_{-\infty}^{\infty}y\cdot f_{Y}(y)\,dy=\frac{3}{8}\int_{0}^{1}y\,dy=\frac{3}{16}
$$
Lets find $E\left(Y^2\right)$:
$$
E\left(Y^{2}\right)=\int_{-\infty}^{\infty}y^{2}\cdot f_{Y}(y)\,dy=\frac{3}{8}\int_{0}^{1}y^{2}\,dy=\frac{1}{8}
$$
Then we get:
$$
\operatorname{Var}(Y)=\frac{1}{8}-\left(\frac{3}{16}\right)^2=\frac{23}{256}
$$
I'm not even close to the answer $360.95$. Some questions:

*

*When should I write the indicator $I$? I'm a bit confused about what does it represent.

*Where is my mistake? I guess that the integral limits that were used in calculating $E(Y)$ and $E(Y^2)$ ($0$ to $1$) are not correct. What should they be?

 A: The entire calculation is unnecessary.  Rather, apply the law of total variance.
Note for all positive integers $k$, $$\operatorname{E}[X^k] = \int_{x=0}^1 3x^{k+2} \, dx = \frac{3}{k+3}.$$  Then $$\begin{align}
\operatorname{Var}[Y] &= \operatorname{Var}[\operatorname{E}[Y \mid X]] + \operatorname{E}[\operatorname{Var}[Y \mid X]] \\
&= \operatorname{Var}\left[\frac{96X + 100X}{2}\right] + \operatorname{E}\left[\frac{(100X - 96X)^2}{12}\right] \\
&= \operatorname{Var}[98X] + \operatorname{E}[\tfrac{4}{3}X^2] \\
&= 98^2 \operatorname{Var}[X] + \frac{4}{3}\operatorname{E}[X^2] \\
&= (98^2 + \tfrac{4}{3}) \operatorname{E}[X^2] - 98^2 \operatorname{E}[X]^2 \\
&= \left(98^2 + \frac{4}{3}\right) \frac{3}{5} - 98^2 \frac{9}{16} \\
&= \frac{7219}{20}.
\end{align}$$
If you must do it the hard way, we observe that the full joint density is $$f_{X,Y}(x,y) = \frac{3}{4}x \mathbb 1(0 \le x \le 1) \mathbb 1(96x \le y \le 100x),$$ since you cannot ignore the fact that $Y$ given $X$ is supported on an interval that is a function of $X$.  Thus the support is a triangle; the unconditional variance of $Y$ is then computed directly as
$$\begin{align}\operatorname{E}[Y^k] 
&= \int_{x=0}^1 \int_{y=96x}^{100x} y^k \frac{3}{4}x \, dy \, dx \\
&= \int_{x=0}^1 \frac{3}{4} x \left[\frac{y^{k+1}}{k+1}\right]_{y=96x}^{100x} \, dx  \\
&= \frac{3(4^k)(25^{k+1} - 24^{k+1})}{k+1} \int_{x=0}^1 x^{k+2} \, dx \\
&= \frac{3(4^k)(25^{k+1} - 24^{k+1})}{(k+1)(k+3)}.
\end{align}$$
Substituting $k = 1$ and $k = 2$ gives
$$\operatorname{Var}[Y] = \frac{28816}{5} - \left(\frac{147}{2}\right)^2 = \frac{7219}{20}.$$
A: You neglected using the support for $Y$ given $X$.  $$\begin{align}f_{\small Y\mid X}(y\mid x) & = \dfrac 1{4x}\mathbb I_{96x\leqslant y\leqslant 100x}\\[2ex]f_{\small X,Y}(x,y)&= \dfrac {3x}{4}\,\mathbb I_{0\leqslant x\leqslant 1}\,\mathbb I_{96x\leqslant y\leqslant 100x}\\[1ex]&=\dfrac{3x}{4}\,\Bbb I_{0\leqslant y\leqslant 100}\,\Bbb I_{y/100\leqslant x\leqslant y/96}\end{align}$$

When should I write the indicator $\Bbb I$? I'm a bit confused about what does it represent.

And indicator random variable equals $1$ in the event of its index, and $0$ elsewhere.$$\Bbb I_{96x\leqslant y\leqslant 100x}=\begin{cases} 1&:& 96x\leqslant y\leqslant 100x\\0&:&\text{otherwise}\end{cases} $$

Where is my mistake? I guess that the integral limits that were used in calculating $E(Y)$ and $E(Y^2)$ (0 to 1) are not correct. What should they be?

The Indicator function ... indicates that.
$$\begin{align}f_{\small Y}(y)&=\tfrac 38\left(\left(\min\{1,\tfrac y{96}\}\right)^2-\left(\tfrac y{100}\right)^2\right)\Bbb I_{0\leqslant y\leqslant 100}\\[1ex]&=\tfrac{3y^2}{8}(\tfrac 1{96^2}-\tfrac 1{10000})\Bbb I_{0\leqslant y\lt 96}+\tfrac 38(1-\tfrac{y^2}{10000})\Bbb I_{96\leqslant y\leqslant 100}\end{align}$$
A: You can use the Laws of Total Expectation and Variance.
$$\begin{align}\mathsf E(Y)&=\mathsf E(\mathsf E(Y\mid X))\\[2ex]\mathsf {Var}(Y)&=\mathsf E(\mathsf{Var}(Y\mid X))+\mathsf{Var}(\mathsf E(Y\mid X))\end{align}$$
