Calculating Standard Deviation

Introduction

Welcome back to Understanding Standard Deviation! You have reached lesson four of five — the moment where everything comes together. In the previous three lessons, you computed deviations from the mean, developed a conceptual picture of standard deviation as typical distance, and learned why squaring those deviations solves the cancellation problem. Today, we connect all of those pieces into a single, complete calculation that produces the population standard deviation for any small dataset.

From Building Blocks to a Complete Formula

Think of the work so far as gathering ingredients for a recipe. You know how to find the mean, measure each value's distance from it, and square those distances to prevent cancellation. What we have not done yet is combine those ingredients in sequence and finish the dish.

The population standard deviation formula does exactly that. It chains together the building blocks from our previous lessons and adds two final operations — dividing by the number of values and taking a square root — to produce a single number that tells us how spread out the data is. Let us start by looking at the formula, and then we will walk through a full example.

The Population Standard Deviation Formula

The population standard deviation is written as σ\sigma (the lowercase Greek letter sigma). Its formula is:

σ=∑(x−xˉ)2n\sigma = \sqrt{\frac{\sum (x - \bar{x})^2}{n}}

Each piece maps to a concept we have already explored:

  • xˉ\bar{x} is the mean of the dataset.
  • (x−xˉ)(x - \bar{x}) is the deviation of each value from the mean (lesson one).
  • (x−xˉ)2(x - \bar{x})^2 is the squared deviation (lesson three).
  • ∑(x−xˉ)2\sum (x - \bar{x})^2 is the sum of squared deviations, all squared deviations added together.
  • nn is the number of values in the dataset.
  • Dividing by nn gives the variance, the average squared deviation.
  • The square root converts the result back to the original units.

The only truly new operations here are dividing by nn and taking the square root. We will see exactly what each one contributes as we work through a full example.

Minimal flowchart with six rounded boxes connected by thin arrows in a left-to-right pipeline, each box representing one step of the standard deviation calculation: Mean, Deviations, Square, Sum, Divide by n, Square Root, with the Greek letter sigma at the end. Charcoal outlines on a warm off-white background with a subtle teal accent on the final sigma symbol.

A quick note on terminology: This formula uses nn in the denominator and applies when we have data for an entire population. A related formula for samples uses n−1n - 1 instead. In this course, we focus exclusively on the population version.

Sign up

Join the 1M+ learners on CodeSignal

Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal