<s>[INST] Calculate the variance for the probability density function $f(x) = x/4$ for $1 \le x \le 3$ I am trying to use this formula:
$$V(X) = E(x^2)-E^2(x)$$
I already calculated $E(X) = \frac{13}{6}$.
I tried to calculate $E(x^2)$:
$$E(x) = \int_1^3 xf(x) dx \Leftrightarrow E(x^2) = \int_1^3x^2f(x^2) = ...$$ and so on. The final answer I got was $\approx 7.4$. It's different from my professor's solution because when he calculated $E(x^2)$ he did:
$$\int_1^3 x^2 f(x) dx = \int_1^3 x^2\frac{x}{4}dx$$
Did he make a mistake? It looks like he did but I want to make sure.
 [/INST] I think you have made a mistake at the calculation. The variance is $$Var(X)=E(X^2)-[E(X)]^2=\int_1^3 x^2\cdot f(x)\, dx-\left(\int_1^3 x\cdot  f(x) \, dx\right)^2$$
$$\int_1^3 x^2\cdot \frac{x}4\, dx-\left(\int_1^3 x\cdot  \frac{x}4 \, dx\right)^2=\int_1^3  \frac{x^3}4\, dx-\left(\int_1^3   \frac{x^2}4 \, dx\right)^2$$
$$=\left[\frac{x^4}{16}\right]_1^3-\left(\left[\frac{x^3}{12}\right]_1^3\right)^2=\frac{3^4}{16}-\frac{1^4}{16}-\left(\frac{3^3}{12}-\frac{1^3}{12}\right)^2$$
$$=5-\left(\frac{26}{12}\right)^2=\frac{11}{36}=0.30\overline 5$$
</s>