Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

Thanks for your help!

share|cite|improve this question
$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
up vote 1 down vote accepted

My mistake was mistaking f for a probability mass function, rather than a (continuous) probability distribution function.

To find the expected value of a continuous function, we use integration.

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

Thanks to everyone that commented!

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.