Skip to content

Standard Deviation and Variance Formulas

Review population and sample standard deviation formulas, notation, variance, deviations, z-scores, calculation order, and rounding rules.

How do the Standard Deviation Calculator formulas work?

This formula page defines the variables used by the Standard Deviation Calculator, shows how those values are combined, and explains the order of operations behind the result. Use the worked steps to verify an estimate, compare scenarios, and understand which assumptions or rounding rules can affect the displayed answer.

Formula Overview

Both formulas begin with distances from the arithmetic mean. Those deviations are squared, added, divided by the appropriate denominator, and square-rooted. The denominator is the important difference: N for a complete population and n - 1 for a sample used to estimate population variation.

Variable Definitions

SymbolMeaning
xᵢThe observation at position i
μPopulation mean
x̄Sample mean
NNumber of observations in the population
nNumber of observations in the sample
σPopulation standard deviation
sSample standard deviation

Population Standard Deviation Formula

μ=∑i=1NxiN\mu=\frac{\sum_{i=1}^{N}x_i}{N}
σ=∑i=1N(xi−μ)2N\sigma=\sqrt{\frac{\sum_{i=1}^{N}(x_i-\mu)^2}{N}}

Use this formula when the observations are the complete population being described. Every squared deviation contributes to the average, and the variance denominator is N.

Sample Standard Deviation Formula

xˉ=∑i=1nxin\bar{x}=\frac{\sum_{i=1}^{n}x_i}{n}
s=∑i=1n(xi−xˉ)2n−1s=\sqrt{\frac{\sum_{i=1}^{n}(x_i-\bar{x})^2}{n-1}}

Use this formula when the observations are a sample from a larger population. Replacing n with n - 1 applies Bessel's correction to the sample variance estimate. At least two observations are required.

Variance Formulas

σ2=∑(xi−μ)2N,s2=∑(xi−xˉ)2n−1\sigma^2=\frac{\sum(x_i-\mu)^2}{N},\qquad s^2=\frac{\sum(x_i-\bar{x})^2}{n-1}

Variance is standard deviation squared. If observations are measured in meters, variance is expressed in square meters, while standard deviation returns to meters.

z-Score Formula

zi=xi−μσz_i=\frac{x_i-\mu}{\sigma}

A z-score states how many population standard deviations an observation is above or below the mean. A positive z-score is above the mean and a negative score is below it. z-scores are undefined when standard deviation is zero.

Calculation Order

  1. Count the observations and find their sum.
  2. Divide the sum by the count to calculate the mean.
  3. Subtract the mean from each observation.
  4. Square each deviation and add the squares.
  5. Divide by N or n - 1 to calculate variance.
  6. Take the nonnegative square root to calculate standard deviation.

Worked Population Calculation

For 2, 4, 4, 4, 5, 5, 7, 9, the sum is 40 and N is 8, so μ = 5. The squared deviations are 9, 1, 1, 1, 0, 0, 4, and 16. Their sum is 32.

σ2=328=4,σ=4=2\sigma^2=\frac{32}{8}=4,\qquad \sigma=\sqrt{4}=2

This verified scenario is also the calculator's default example. See the examples page for the sample result and additional cases.

Precision and Rounding

The calculation engine retains Decimal.js precision through the mean, deviations, variance, and square root. Only displayed values are rounded to the selected two or three decimal places. Do not round each deviation before adding the squared deviations.

Formula Assumptions and Exclusions

  • Every observation has equal weight.
  • All observations use one consistent measurement scale.
  • The user chooses the correct population or sample interpretation.
  • The calculator does not handle frequency weights, grouped intervals, missing-data imputation, or multivariate covariance.

References

These references support the calculation method, assumptions, or current program guidance.

Corrections and Review

Report an issue or error in the calculator using the Contact Us page.