2

This is my first question and I hate making this a new question, as I found an answer to a similar question, but it's not quite clear and I don't have enough rep to leave a comment asking for more info.

So I got quite stumped trying to figure out $E(X^2)$ in statistics. I found this answer while googling: --Quote-- Actually, if $EX=\mu$ and $E(X-\mu)^2=\sigma^2$

$$ EX^2 = E[X-\mu+\mu]^2=\\ =E(X-\mu)^2-2E[(X-\mu)\mu]+E(\mu^2)=\\=\sigma^2-2\mu E(X-\mu)+\mu^2=\\ =\sigma^2+\mu^2 $$

So $EX^2 =\sigma^2+\mu^2$, no matter the distribution, and $EX^2\ne(EX)^2$ unless the variance equals zero. --End quote-- Here's a link to said answer: https://math.stackexchange.com/a/737227/693253

Now, if that answer is correct it certainly solves most of my problems but I'm having trouble figuring out this step: $$ \sigma^2-2\mu E(X-\mu)+\mu^2=\\ =\sigma^2+\mu^2 $$ I don't get how he gets rid of the $-2\mu E(X-\mu)$

I guess the question is both "is this answer correct?" and some help figuring out that step, if it is. If it's not correct, I'd like some help figuring out $E(X^2)$

Thanks in advance!

1 Answers1

7

$\mathbb E(X) = \mu$ so $\mathbb E(X-\mu) = 0$. This is because:

  1. Expected value is linear.
  2. Expected value of a constant is that constant.
Robert Israel
  • 448,999