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?
 A: 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.
A: 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.
A: 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.
