The expected value of x^{2} can be calculated using the formula,

**E(X**^{2}) = Σ x^{2} * p(x).

^{2}) = Σ x

^{2}* p(x)

- Here p(x) is the probability mass function for the discrete random variable X.
- The sum Σ x
^{2}p(x) is taken over all values of X_{i}from i=1 to n.

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.

**Example 1:**

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

X | Probability P(X) |

0 | 0.12 |

1 | 0.14 |

2 | 0.08 |

3 | 0.16 |

4 | 0.1 |

5 | 0.15 |

6 | 0.25 |

Notice that the sum of all the probabilities adds up to 1. This is always true of any probability distribution. We calculate E(X^{2}) as follows,

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

0 | 0.12 | 0 | 0 |

1 | 0.14 | 1 | 0.14 |

2 | 0.08 | 4 | 0.32 |

3 | 0.16 | 9 | 1.44 |

4 | 0.1 | 16 | 1.6 |

5 | 0.15 | 25 | 3.75 |

6 | 0.25 | 36 | 9 |

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

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

**E(X ^{2}) = 16.25**

**Expected Value of X**^{2} for Continuous Random Variables:

^{2}for Continuous Random Variables:

If the variable X is a continuous random variable with pdf f(x) then the expected value of X^{2} can be calculated using the formula,

**E(X**^{2}) = ∫ x^{2}f(x)dx

^{2}) = ∫ x

^{2}f(x)dx

Here the integration is taken over the entire range of X.

**Is Expected Value of X**^{2} Equal to Variance?:

^{2}Equal to Variance?:

Note that the value of E(X^{2}) is not equal to the variance. In fact, variance is given by the formula,

Variance V(X) = E(X^{2}) – [E(X)]^{2}

This means that the variance is obtained by subtracting the square of the expectation from the expected value of X^{2}.

The expected value of X^{2} is not equal to the expected value of x squared because their difference is equal to the variance.

Therefore they will be equal only if the variance is equal to zero. Hence, they will be equal only if we are dealing with a set of constant data values.

**Expected Value of ****X**^{2} for Normal Distribution:

**X**:

^{2}for Normal DistributionSuppose that X is a random variable following the normal distribution with parameters µ and σ.

Therefore the mean (expected value) of X is equal to µ, that is, E(X) = µ.

Also, the variance of X is equal to σ^{2}, that is, V(X) = σ^{2}. We use the formula for variance,

Variance V(X) = E(X^{2}) – [E(X)]^{2}

⇒ σ^{2} = E(X^{2}) – [µ]^{2}

Transposing µ^{2} to the other side we get the expected value of X^{2} for the normal distribution.

E(X^{2}) = σ^{2} + µ^{2}.