The expected value of x^{2} can be found by summing the product x^{2}p(x) over all possible values of the random variable X. Thus the formula for the expected value of x^{2} is given as,

where, p(x) is the probabilty mass function for the discrete ransom variable X and the summation is taken over all values of X.

**Example:**

Suppose that we are given the following probability distribution for a random variable X.

X | P(X) |

0 | 0.25 |

1 | 0.5 |

2 | 0.25 |

We calculate E(X^2) as follows,

X | X^{2} | P(X) | X^{2}P(X) |

0 | 0 | 0.25 | 0 |

1 | 1 | 0.5 | 0.5 |

2 | 4 | 0.25 | 1 |

ΣX^{2}P(X) = 1.5 |

Since we see that ΣX^{2}P(X) = 1.5 from the above table we conclude that E(X^2) = 1.5

**For Continuous Random Variables:**

If the variable X is continuous with pdf f(x) , then we can calculate it using the formula,

E(X^2) = \int x^2f(x)dxwhere, the integration is taken over the entire range of X.

**Remark:**

The value of E(X^{2}) is not equal to [E(X)]^{2}. In fact, E(X^{2}) is always greater than or equal to [E(X)]^{2}