We know that $E[(X-p)^2] = E[X^2 - 2pX + p^2]$.
Using the linearity of expectation, we have:
$E[X^2 - 2pX + p^2] = E[X^2] - 2pE[X] + p^2$.
Since $E[X] = p$, we can substitute this back into the equation:
$E[X^2] - 2p^2 + p^2 = E[X^2] - p^2$.
So, we have
Show more…