Find the new variance In a sample of size $21$ the sample mean is $58$ and the sample variance is $10.7$. If an observation of value $52$ is added to the sample, what now is the sample variance of the observations?
I found the new mean i just 
$$\frac{21 \times 58 + 52}{22} = 57.727272$$ 
$$\text{Variance } = E(X^2) - ((E(X))^2$$
But how can I find the $E(X^2)$?
Thank you for helping me
 A: Compute the sum of the samples
$$
\begin{align}
\sum_{k=1}^{21}x_k
&=nE(X)\\
&=21\cdot58\\[9pt]
&=1218
\end{align}
$$
and the sum of the squares of the samples
$$
\begin{align}
\sum_{k=1}^{21}x_k^2
&=nE\!\left(X^2\right)\\
&=21\left(10.7+58^2\right)\\[9pt]
&=70868.7
\end{align}
$$
Compute the new sum of samples
$$
\begin{align}
\sum_{k=1}^{22}x_k
&=1218+52\\
&=1270
\end{align}
$$
and the new sum of squares of samples
$$
\begin{align}
\sum_{k=1}^{22}x_k^2
&=70868.7+52^2\\
&=73572.7
\end{align}
$$
Thus, the new mean is
$$
\begin{align}
E(X)
&=\frac1{22}\sum_{k=1}^{22}x_k\\
\end{align}
$$
and the new variance is
$$
\begin{align}
E\left(X^2\right)-E(X)^2
&=\frac1{22}\sum_{k=1}^{22}x_k^2-\left(\frac1{22}\sum_{k=1}^{22}x_k\right)^2\\
\end{align}
$$
A: You can calculate $E(X^2)$ using the Online Algorithm Method, in which you update the variance with a recurrent relation.  This way you only require the old variance and the new data:
$s^2_n = \frac{(n-2)}{(n-1)} \, s^2_{n-1} + \frac{(x_n - \bar x_{n-1})^2}{n}, \quad n>1 $
You can observe that $E(X^2)$ is $\frac{(n-2)}{(n-1)} \, s^2_{n-1}$
