Given a population with size \(N\) and a sample from this population with size \(n\).
You can compute the exact value of population variance \(\sigma^2\) with:
$$
\sigma^2 = \frac1N \sum_{i=1}^N (x_i - \mu)^ 2
$$
where \(\mu\) is the mean of the population.
Second, you can compute the exact value of sample variance \(s^2\) with:
$$
s^2 = \frac1n \sum_{i=1}^n (x_i - \bar x)^ 2
$$
where \(\bar x\) is the mean of the sample.
Third, you can estimate the population variance based on the sample data when you don't know the mean of population:
$$
\sigma^2 \approx \frac1{n - 1} \sum_{i=1}^n (x_i - \bar x)^ 2
$$
where \(\bar x\) is the mean of the sample.
Finally, you can estimate the population variance based on the sample data when you know the mean of population:
$$
\sigma^2 \approx \frac1n \sum_{i=1}^n (x_i - \mu)^ 2
$$
where \(\mu\) is the mean of the population.
Ref: