The formulae
There are two formulae for standard deviation.
\(s = \sqrt {\frac{{\sum {{{(X - \bar X)}^2}} }}{{n - 1}}}\) (where n is the sample size).
The second formula is a re-arrangement which may make it better for calculation purposes.
\(s = \sqrt {\frac{{\sum {{X^2} - {{\frac{{(\sum {X)} }}{n}}^2}} }}{{n - 1}}}\) (where n is the sample size).
You may use either of the formulae; they'll give you the same answer.
More about formulae
Comparing these formulae with standard deviation formulae in books or in your calculator, you may notice that sometimes the \(n - 1\) in the denominator is replaced by \(n\).
When you're finding the standard deviation of a set of measures, which are only a sample of the total set of measures, then it's correct to use \(n - 1\).
When statisticians know they're working with the whole set or the population then they use \(n\) instead of \(n - 1\).
Remember\(\sum\)means 'sum of' and \({\bar X}\) is the 'mean'.
Example
Find the mean and standard deviation of the following numbers.
4, 7, 9, 11, 13, 15, 18
\(mean=\) \({\bar X}\) \(=\frac {(4+7+9+11+13+15+18)}{7}=11\)
Here are two ways of calculating the standard deviation, using formulae.
Method 1
Use the formula \(s = \sqrt {\frac{{\sum {{{(X - \bar X)}^2}} }}{{n - 1}}}\)
\(X\) | \(X-\)\({\bar X}\) | \((X-\)\({\bar X}\)\()^2\) |
4 | -7 | 49 |
7 | -4 | 16 |
9 | -2 | 4 |
11 | 0 | 0 |
13 | 2 | 4 |
15 | 4 | 16 |
18 | 7 | 49 |
\(\sum\)\((X-\)\({\bar X}\)\()^2=138\) |
\(X\) | 4 |
---|---|
\(X-\)\({\bar X}\) | -7 |
\((X-\)\({\bar X}\)\()^2\) | 49 |
\(X\) | 7 |
---|---|
\(X-\)\({\bar X}\) | -4 |
\((X-\)\({\bar X}\)\()^2\) | 16 |
\(X\) | 9 |
---|---|
\(X-\)\({\bar X}\) | -2 |
\((X-\)\({\bar X}\)\()^2\) | 4 |
\(X\) | 11 |
---|---|
\(X-\)\({\bar X}\) | 0 |
\((X-\)\({\bar X}\)\()^2\) | 0 |
\(X\) | 13 |
---|---|
\(X-\)\({\bar X}\) | 2 |
\((X-\)\({\bar X}\)\()^2\) | 4 |
\(X\) | 15 |
---|---|
\(X-\)\({\bar X}\) | 4 |
\((X-\)\({\bar X}\)\()^2\) | 16 |
\(X\) | 18 |
---|---|
\(X-\)\({\bar X}\) | 7 |
\((X-\)\({\bar X}\)\()^2\) | 49 |
\(X\) | |
---|---|
\(X-\)\({\bar X}\) | |
\((X-\)\({\bar X}\)\()^2\) | \(\sum\)\((X-\)\({\bar X}\)\()^2=138\) |
\(s = \sqrt {\frac{138}{6}} = 4.796\,(to\,3\,d.p.)\)
If you're having a problem with this table, this is how it works.
- The first column lists the numbers.
- The second column finds the difference between each of the numbers and the mean.
- The third column squares these differences. This makes all of them positive numbers.
The next step is to add them up and divide by six (one less than the number of numbers).
The final step is to take the square root.
Method 2
Use the formula \(s = \sqrt {\frac{{\sum {{X^2} - {{\frac{{(\sum {X)} }}{n}}^2}} }}{{n - 1}}}\)
\(X\) | \(X^{2}\) |
4 | 16 |
7 | 49 |
9 | 81 |
11 | 121 |
13 | 169 |
15 | 225 |
18 | 324 |
\(\sum {{X^2}} = 985\) |
\(X\) | 4 |
---|---|
\(X^{2}\) | 16 |
\(X\) | 7 |
---|---|
\(X^{2}\) | 49 |
\(X\) | 9 |
---|---|
\(X^{2}\) | 81 |
\(X\) | 11 |
---|---|
\(X^{2}\) | 121 |
\(X\) | 13 |
---|---|
\(X^{2}\) | 169 |
\(X\) | 15 |
---|---|
\(X^{2}\) | 225 |
\(X\) | 18 |
---|---|
\(X^{2}\) | 324 |
\(X\) | |
---|---|
\(X^{2}\) | \(\sum {{X^2}} = 985\) |
\(s = \sqrt {\frac{{985 - \frac{{{{77}^2}}}{7}}}{6}} = \sqrt {\frac{{985 - 847}}{6}}\)
\(s = \sqrt {\frac{{138}}{6}} = 4.796\)
So the standard deviation \(s = 4.796\), using either of the formula.