So I have this density function f(x) = 3/2 x\^2, -1<=x<=1.

Mean = E(X) → this is an integral between -1 and 1 and it is 1.

Var(X) = E(X\^2)-(E(X))\^2 → but I get that this is 0,9 - 1 = -0,1. This can’t be correct, because variance can’t be negative.

The solution that I have is that the variance is 0,6, but they got 0 from the E(X) and that isn’t correct.

So how do I get correct variance in this case?
E(x)=Integral([-1,1])(xf(x)), and that is the integral of an odd function so it absolutely is 0
Without doing a single calculation, note that the density function is symmetric about x = 0. You have as much mass below x = 0 as above it. So the mean must be 0.

Do the calculation if you like: E(X) = [integral from -1 to 1] xf(x) dx = [integral from -1 to 1] (3/2)x^(3) dx = (3/8)[x^(4)]_[-1,1] = 0.

The variance is therefore just E(X^(2)) = [integral from -1 to 1] x^(2)f(x) dx = [integral from -1 to 1] (3/2)x^(4) dx = (3/10)[x^(5)]\_[-1,1] = 3/5 = 0.6.