# Finding expected value of $X^2$

The question is:

$X$ is a random variable, and $f(x) = (x-1)/2$ for $1 \le x \le 3$

Find $\Bbb E (X^2)$

Here's my solution: \begin{align} \Bbb P(1)&= 0/2= 0 \\ \Bbb P(2)&= 1/2 \\ \Bbb P(3)&= 2/2= 1 \\ \end{align} \begin{align} \Bbb E(X^2) = & 1^2 \Bbb P(1) + 2^2 \Bbb P(2) + 3^2 \Bbb P(3) \\ = & 1 \cdot 0 + 4 \cdot 1/2 + 9 \cdot 1 \\ = & 11 \end{align} This is my solution, but it is wrong. I need help in understanding where my mistake is.

-
$X$ apparently is a continuous random variable, not a discrete one. You need to calculate $\int_1^3 x^2f(x)\,dx$. – David Mitra Dec 15 '12 at 21:13
To emphasise David Mitra's point, if $f(2)= \frac12$ and $f(3)=1$, then these are not probabilities. However $\int_1^3 \frac{x-1}{2}dx =1$ , so you should interpret $f(x)$ as the probability density function of a continuous random variable – Henry Dec 15 '12 at 21:24
Also if $1 \le X \le 3$ then as a basic check you should have $1 \le E[X^2] \le 9$ – Henry Dec 15 '12 at 21:25
Or, note the sum of your "probabilities" exceeds $1$. So whatever $f$ is, it certainly is not the the probability mass function of an rv taking the values $1$, $2$, and $3$. – David Mitra Dec 15 '12 at 21:27
The point is the distribution of this ramdom variable is continuous but not discrete. What you have done is assumed X is discrete only taking on the integers between 1 and 3. – Scorpio19891119 Dec 15 '12 at 22:41

Therefore, to find $$E(X^2)$$ we take the integral $$∫_1^3x^2f(x)dx$$ which I calculated to be 17/3