Instead of going into maths I'll try to put it in plain words. If you have the whole population at your disposal then its variance (population variance) is computed with the denominator N
. Likewise, if you have only sample and want to compute this sample's variance, you use denominator N
(n of the sample, in this case). In both cases, note, you don't estimate anything: the mean that you measured is the true mean and the variance you computed from that mean is the true variance.
Now, you have only sample and want to infer about the unknown mean and variance in the population. In other words, you want estimates. You take your sample mean for the estimate of population mean (because your sample is representative), OK. To obtain estimate of population variance, you have to pretend that that mean is really population mean and therefore it is not dependent on your sample anymore since when you computed it. To "show" that you now take it as fixed you reserve one (any) observation from your sample to "support" the mean's value: whatever your sample might have happened, one reserved observation could always bring the mean to the value that you've got and which believe is insensitive to sampling contingencies. One reserved observation is "-1" and so you have N-1
in computing the variance estimate. The unbiased estimate is called sample variance (not to be confused with the sample's variance) which is an argot; it is better call what it is: sample unbiased estimate of population variance estimated with the sample's mean.
[Pasting here from my below comments: Imagine you are taking repeatedly samples of N=3
size. Of the 3 values in a sample, only 2 values express random deviatedness of observations from the population mean, but the left one expresses (takes on itself) the shift of the sample's mean from the population mean. Thus the "degree of free" observational variability is 2 of the 3, in each separate sample. When we estimate variability on a sample but want it to be an unbiased (unshifted) estimate of populational variability, we "believe" only those 2 free observations. We "pay" for the decision to measure variability off the sample mean as if it were the population mean, for we need to infer about the population variability. This "fee" (N-1
denominator, the Bessel correction) makes the variability wider, incorporating the oscillation of sample means within the variance, but it makes such variance an unbiased estimator.]
But imagine now that you somehow know the true population mean, but want to estimate variance from the sample. Then you will substitute that true mean into the formula for variance and apply denominator N
: no "-1" is needed here since you know the true mean, you didn't estimate it from this same sample.