I found few different formulas to calculate variance from different resources. I have searched the internet for quite a bit already and cannot understand why are they different.
1) $D(x) = \frac{\sum x_i^2}{n}-\bar{x}^2$
2) $\sigma^2=\frac{\sum x^2 - \frac{\left(\sum X\right)^2}{N}}{N}$
I found the second at Wikipedia:
$$\bar{S}^2=\frac{\sum_{i=1}^n x_i^2-\frac{\left( \sum_{i=1}^n x_i\right)^2}{n}}{n}=\frac{\sum_{i=1}^n x_i^2-n \bar{x}^2}{n}=\frac{\sum_{i=1}^n(x_i^2-\bar{x}^2}{n}$$
But there is no transition to the first formula I have found. Is there a mistake in the first formula which is the missing $\frac1n$? Or I don't understand something?