Incompatible results in finding the variance of random variable

25 Views Asked by At

Let $f(x) = 3/64(2x - 2)$ whenever $x \in [1, 5]$, zero otherwise, be the PDF of a random var. I know the expected value of $X$ is $2.75$. I was asked to find its variance. For the sake of practice I used two methods. First, I calculated $E(X^2)$ and used the fact that $V(X) = E(X^2) - E(X)^2$. This gives

\begin{align*} \frac{3}{64}\int_1^5 (2x -2)x^2 ~ dx &= \frac{3}{64}\int_1^5 x^2(2x) - 2x^2 ~ dx \\ &= \frac{3}{64} \left( \int_1^{25} u ~ du - 2\int_1^5 x^2 ~ dx \right) & \{u = x^2\} \\ &= \frac{3}{64} \left( \left( \frac{25^2}{2} - \frac{1}{2} \right) - 2 \left( \frac{5^3}{3} - \frac{1}{3} \right) \right) \\ &= \frac{3}{64} \left( 312 - \frac{248}{3} \right) \\ &= 10.75 \end{align*}

Online calculators confirm this result. From this should follow that $V(X) = 10.75 - 2.75^2 = 3.1875$.

Now, via direct definition of the variance, one obtains (I skip the steps, but one can confirm with online calculators)

$$ V(X) = \frac{3}{64}\int_1^5 (2x-2)(x-2.75)^2 ~ dx = 1.296875 $$

The results should be the same. My error cannot be one of calculation, because both integrals are correctly solved according to online calculators. It seems I am wrong in expecting that this identity holds:

$$ \int_{1}^{5} f(x)(x- E(X)) ~ dx = E(X^2) - E(X)^2 $$

But this is a standard property. What am I missing?