方差一瞥
\[\frac{1}{m}\sum\limits_{i=1}^m(a_i-\frac{sum}{m})^2\\=\frac{1}{m}\sum\limits_{i=1}^ma_i^2+\frac{sum^2}{m^2}-2\times a_i\times\frac{sum}{m}\\=\frac{1}{m}\times m\times\frac{sum^2}{m^2}-\frac{2}{m}\times sum\times\frac{sum}{m}+\frac{1}{m}\sum\limits_{i=1}^ma_i^2\\=-\frac{sum^2}{m^2}+\frac{1}{m}\sum\limits_{i=1}^ma_i^2
\]
乘上\(m^2\)后就变成了
\[-sum^2+m\sum\limits_{i=1}^ma_i^2 \]