When looking at the variance of a function of a r.v. $X$ (say continuous), can you use $Var(g(X)) = E(g(X)^2) - E^2(g(X))$, and then use integration?

51 Views Asked by At

I'll illustrate this question with an example:

Suppose $X$~Uniform[0,1] and I wish to determine $Var$($X\cos \left(X\right)$). Can I say that this is equal to $E\left(X^{2}\cos ^{2}\left(X\right)\right)-E^{2}\left(X\cos \left(X\right)\right)$ and evaluate these via the integrals $$ E^2\left(X\cos \left(X\right)\right) = \left(∫_0^1 {x\cos \left(x\right)}dx\,\right)^2 $$ and $$E\left(X^2\cos ^2\left(X\right)\right) = ∫_0^1 {x^2\cos ^2\left(x\right)}dx\, $$ and combine them together \left(given that these both are easily evaluated\right)?