# Why is my variance calculation wrong?

Suppose $X$ has the the probability function: $$f(x)=\begin{cases} \frac{1}{2x} & \text{for }x=2,3,4,5,6\\ \frac{11}{40} & \text{for }x=1. \end{cases}$$ Find the mean and variance for $X$.

The mean is easy: $2.275$.

I calculated the variance using the expectation of the squared distance to the mean but I got $2.824375$ while the answer on the textbook was $2.574375$. Who is correct?

-
The mean is $\frac{11}{40}+\frac{5}{2}$. I get 2.775 for the mean, 2.574375 for the variance... – copper.hat Apr 3 '13 at 14:13

You can show that $f$ is a PDF because

$$\sum_{k=1}^6 f(k) = 1$$

Then

$$E(X) = \sum_{k=1}^6 k\,f(k) = \frac{111}{40} = 2.775$$

and

$$\text{Var}(X) = \frac{11}{40} \left (\frac{111}{40} - 1\right)^2 + \sum_{k=2}^6 \frac{1}{2 k} \left ( \frac{111}{40} - k \right )^2 = \frac{4119}{1600} = 2.574375$$

-

$$E(X) = 2.775,$$ $$E(X^2)= 10.275,$$ $$Var(X) = 2.574.$$