ويكي

Standard Deviation: Measuring Data Spread

How to calculate standard deviation, variance, and the difference between sample and population formulas. Worked examples and practical uses.

Verified against Khan Academy - Statistics and Probability on 20 Feb 2025 Updated 20 February 2025 4 min read
فتح الحاسبة

Translation unavailable - this article is shown in English. View English version

Summary

Standard deviation measures how spread out a set of numbers is from their average (mean). A low standard deviation means values cluster tightly around the mean; a high standard deviation means they are widely dispersed. It is the most commonly used measure of variability in statistics, appearing in fields from finance (portfolio risk) to manufacturing (quality control) to science (experimental error).

How it works

The calculator computes three related statistics:

  1. Mean — the arithmetic average of all values: sum divided by count.
  2. Variance — the average of the squared differences from the mean. Squaring ensures positive and negative deviations don’t cancel out.
  3. Standard deviation — the square root of the variance, bringing the measure back to the original units (e.g., dollars, centimeters).

Population vs sample

There are two formulas depending on whether your data represents an entire population or a sample drawn from a larger population:

  • Population standard deviation divides by N (the total count). Use this when you have every data point — for example, test scores from every student in a class.
  • Sample standard deviation divides by N - 1 (called Bessel’s correction). Use this when your data is a subset of a larger group — for example, survey responses from 200 out of 10,000 customers. Dividing by N - 1 corrects for the bias that a sample tends to underestimate the true population variance.

The formulas

Population SD: sigma = sqrt((1/N) * sum((xi - mu)^2))

Where

sigma= Population standard deviation
N= Total number of data points
xi= Each individual value
mu= Population mean (average)
Sample SD: s = sqrt((1/(N-1)) * sum((xi - x_bar)^2))

Where

s= Sample standard deviation
N-1= Degrees of freedom (Bessel's correction)
xi= Each individual value
x_bar= Sample mean (average)
Variance = (Standard Deviation)^2

Where

Variance= The square of the standard deviation, in squared units

Worked examples

Population SD of {2, 4, 4, 4, 5, 5, 7, 9}

1

Calculate the mean

(2 + 4 + 4 + 4 + 5 + 5 + 7 + 9) / 8 = 40 / 8

= 5

2

Find each squared deviation

(2-5)^2 + (4-5)^2 + (4-5)^2 + (4-5)^2 + (5-5)^2 + (5-5)^2 + (7-5)^2 + (9-5)^2 = 9+1+1+1+0+0+4+16

= 32

3

Divide by N (population)

32 / 8

= 4 (variance)

4

Take the square root

sqrt(4)

= 2

Result

Population standard deviation = 2

Sample SD of {2, 4, 4, 4, 5, 5, 7, 9}

1

Mean and sum of squared deviations (same as above)

Mean = 5, sum of squared deviations = 32

= 32

2

Divide by N - 1 (sample)

32 / (8 - 1) = 32 / 7

= 4.571 (sample variance)

3

Take the square root

sqrt(4.571)

= 2.138

Result

Sample standard deviation = 2.138

Practical uses

  • Finance — standard deviation of returns measures investment risk. A stock with SD of 20% is more volatile than one with SD of 10%.
  • Quality control — manufacturing uses the “six sigma” framework where processes must produce output within 6 standard deviations of the target.
  • Grading — standardized test scores are often reported as how many standard deviations above or below the mean a student scored (z-scores).
  • Science — error bars on charts typically represent one or two standard deviations from the mean.

Assumptions & limitations

  • Normal distribution assumption — the “68-95-99.7 rule” (68% of data within 1 SD, 95% within 2 SD) only applies to normally distributed data. For skewed distributions, standard deviation alone can be misleading.
  • Outlier sensitivity — because deviations are squared, a single extreme value can dramatically inflate the standard deviation. Consider using median absolute deviation for data with outliers.
  • Minimum data — sample standard deviation requires at least 2 data points (division by N - 1 is undefined when N = 1).

المصادر

Academic
standard-deviation variance statistics mean math