# Difference between these two standard deviation formulas?

Today I started reading statistics and I came across these two S.D formulas:

$$\sqrt{\frac 1 n \sum (X - \overline X)^2} \textrm{ and } \sqrt{\frac 1 {n-1}\sum (X - \overline X)^2}$$

What is the difference between these two and in which situations I should use them?

• The first is for the population and the second for the sample.
– user10575
Sep 13, 2015 at 10:49
• Note that for large samples, the differences between the two tends to be very small. Sep 13, 2015 at 11:00
• Have you looked at this page? Sep 13, 2015 at 12:04
• @Shahab Could you please tell what population is? Sep 13, 2015 at 14:15
• What Shahab probably meant is that the value of second formula, calculated from the sample is often used to estimate the value of first calculated over whole of the population. Sep 13, 2015 at 15:27

The first one is used for population and second one is for sample.

What is the difference between a population and a sample?

A sample is a subset of people, items, or events from a larger population that you collect and analyze to make inferences. To represent the population well, a sample should be randomly collected and adequately large.

To understand the basic foundation for hypothesis testing and other types of inferential statistics, it’s important to understand how a sample and a population differ.

A population is a collection of people, items, or events about which you want to make inferences. It is not always convenient or possible to examine every member of an entire population. For example, it is not practical to count the bruises on all apples picked at an orchard. It is possible, however, to count the bruises on a set of apples taken from that population. This subset of the population is called a sample.

If the sample is random and large enough, you can use the information collected from the sample to make inferences about the population. For example, you could count the number of apples with bruises in a random sample and then use a hypothesis test to estimate the percentage of all the apples that have bruises.

Neither of these is the actual definition of standard deviation. If you have a random variable $X$, the standard deviation $\sigma$ is defined by $$\sigma^2 = E [ (X-EX)^2 ]$$ where $E$ denotes the expected value (i.e., if $X$ takes $k$ values $a_1, ..., a_k$ with probabilities $p_1,...,p_k$ respectively, $EX=\sum_{i=1}^k p_i a_i$). Of course, $\sigma^2$ is called the variance. When people refer to "population" quantities, they mean taking expectations as above.

The 2 formulae given are ways to estimate $\sigma$ when you have observations $X_1,..., X_n$ that are independent and drawn from the same distribution as $X$ (which you do not know the standard deviation of). Often it is assumed that the distribution of $X$ (or any of the $X_i$) is Gaussian, but with unknown mean and variance; in this situation, you say that you have a parametric statistical model for the unknown distribution from which you have data. The goal of statistical inference is to figure out something about the unknown distribution from the data, and if you are looking at IID data from an unknown Gaussian distribution, it is not hard to show that the sample mean $\bar{X}$ is the best way to estimate the unknown mean. (When people refer to "sample" quantities as opposed to "population" quantities, they mean these are quantities computed from a data sample.) When it comes to estimating the unknown standard deviation, there are various natural candidates that arise, and the 2 formulae mentioned in the question are among them. As pointed out in a comment, they are almost the same when the sample size $n$ is large, as one should expect (since when $n$ is large, we want both to converge to the unknown standard deviation, or they would be rather useless estimates). The main difference is that when your goal is estimating the variance rather than the standard deviation, the formula with $1/n$ is the maximum likelihood estimate but is biased, whereas the formula with $1/(n-1)$ is unbiased. Here unbiased means that the expected value of the estimated variance is equal to the unknown variance; it was a traditional criterion that people considered important some decades ago but is no longer considered that critical these days.

The first one is used, if $\bar X$ is indepently calculated.
This second one, if you compute $\bar X = \frac{1}{N} \sum X$ with the data you are also using for the S.D.

This is important for the epxectation of those to be equal fo the real S.D.