Sample Standard Deviation ($s$) and Variance ($s^2$) Formulas: For the sample, $x$ refers to individual values, $\hat{\mu}$ refers to sample mean, and $n$ refers to sample size. Population Standard Deviation ($\sigma$) and Variance ($\sigma^2$) Formulas: For the population, $x$ refers to individual values, $\mu$ refers to population mean, and $N$ refers to population size.
If the data represents the whole population of interest, we should use the population formulas above. Otherwise, if the data only represents a subset of the population of interest, we should use the sample formulas above.
For example, all voters in an election can represent the voting population. An election survey is a sample as it only includes a subset of the voting population.
In this example, let us calculate the standard deviation of $1,2,3,4,5$.
If these numbers represent the whole population,
we have the population size $N=5$, and the population mean $\mu=(1+2+3+4+5)/5=3$.
Next, we get the sum of squared numbers $\sum x^2=1^2+2^2+3^2+4^2+5^2=55$, $N\mu^2=5\times3^2=5\times9=45$, and the sum of squared deviations (also known as Sum of Squares, or SS) $\sum\left(x-\mu\right)^2=55-45=10$.
Therefore, the population variance is $\sigma^2=\frac{\left(55-45\right)}{5}=2$,
and the population standard deviation is $\sigma=\sqrt2=1.414$.
If these numbers represent a sample of the population,
we have the sample size $n=5$, and the sample mean $\hat{\mu}=(1+2+3+4+5)/5=3$.
Similarly, we get the sum of squared numbers $\sum x^2=1^2+2^2+3^2+4^2+5^2=55$, $n\hat{\mu}^2=5\times3^2=5\times9=45$, and the sum of squared deviations (also known as Sum of Squares, or SS) $\sum\left(x-\hat{\mu}\right)^2=55-45=10$.
Therefore, the sample variance is $s^2=\frac{\left(55-45\right)}{5-1}=2.5$,
and the sample standard deviation is $s=\sqrt{2.5}=1.581$.