# Expected value of the square of a random variable

Having $\hat\theta= \frac{1}{N}\sum_{n=1}^{N} D_n$, with $D_1 ... D_N$ independent random variables, which would be the solution of $E[{\hat\theta}^2]$?

Would it be just $\frac{1}{N^2}\sum_{n=1}^{N}E[{D_n}^2]$ ?

And if so, knowing that $E[\hat\theta] = \theta$, and therefore $E[D_n] = \theta$, would the result of $E[{\hat\theta}^2]$ be $\frac{1}{N^2}N\theta^2 = \frac{\theta^2}{N}$?

Any help is appreciated!

$$\hat{\theta}^2 = \left[\dfrac{1}{N} \sum_{n=1}^{N}D_n \right]^2 = \dfrac{1}{N^2}\left[ \sum_{n=1}^{N}D_n \right]^2 \ne \dfrac{1}{N^2}\left[ \sum_{n=1}^{N}D_n^2 \right]\,.$$ Notice that the last equality doesn't hold because in general $(a + b)^2 \ne a^2 + b^2$. Because of this reason,
$$E[\hat{\theta}^2] \ne \dfrac{1}{N^2}\left[ \sum_{n=1}^{N}E[D_n^2] \right] \,.$$
To find $E[\hat{\theta}^2]$, you will have to find the distribution of $\hat{\theta}$, and then calculate its second moment. Alternatively, if you know the variance of the estimator, then $$E[\hat{\theta}^2] = Var(\hat{\theta}) + E[\hat{\theta}]^2 = Var(\hat{\theta}) + \theta^2 \,.$$
• That is really helpful! I have the p.d.f. of D so I can find its variance, and therefore the variance of $\hat\theta$. Thanks for the answer! @greenparker Oct 26, 2017 at 10:17