Deviations from the Mean

Introduction

Welcome to Understanding Standard Deviation, the fourth course in our learning path! Over the previous courses, you learned how to read distributions, measure center with the mean, median, and mode, and quantify spread using range and IQR. Now we are ready to tackle a more precise and widely used measure of spread: the standard deviation. In this first lesson, we lay the groundwork by introducing deviations from the mean, the small but powerful calculations that everything else in this course is built on.

Throughout this course, all calculations use the population standard deviation, which divides by the total number of values, nn. A related formula called the sample standard deviation divides by n−1n - 1 and is used when data represent only a subset of a larger group; that version is outside the scope of this course. Let's get started!

Why the Mean Is Only Half the Story

As you may recall from previous courses, the mean tells us where the center of a dataset lies. But two datasets can share the exact same mean and still look very different. Imagine two coffee shops that both average 50 customers per hour. One shop gets between 45 and 55 every hour, while the other swings wildly between 20 and 80. The averages match, yet the day-to-day experience is nothing alike.

To capture that difference, we need to measure how far individual values sit from the mean. That measurement starts with deviations.

What Is a Deviation?

A deviation is the difference between a single data value and the mean of the dataset. If we call a data value xx and the mean xˉ\bar{x}, the deviation is:

deviation=x−xˉ\text{deviation} = x - \bar{x}

The result carries a sign, and that sign is meaningful:

  • A positive deviation means the value is above the mean.
  • A negative deviation means the value is below the mean.
  • A deviation of zero means the value equals the mean exactly.

Think of each deviation as answering one simple question about a data point: "How far above or below average is this value?"

Computing Deviations Step by Step

Now that we know the formula, let's work through a small example from start to finish. Suppose five friends track how many glasses of water they each drink in a day: 4, 6, 7, 8, 5.

Step 1 — Find the mean.

xˉ=4+6+7+8+55=305=6\bar{x} = \frac{4 + 6 + 7 + 8 + 5}{5} = \frac{30}{5} = 6

Step 2 — Subtract the mean from each value.

Value (xx)Mean (xˉ\bar{x})Deviation (x−xˉx - \bar{x})
464−6=−24 - 6 = -2
666−6=06 - 6 = 0
767−6=17 - 6 = 1
868−6=28 - 6 = 2
565−6=−15 - 6 = -1

Each deviation tells us the direction and distance from the average. The person who drank 4 glasses was 2 below average, while the person who drank 8 glasses was 2 above. Notice that we always compute x−xˉx - \bar{x}, not the other way around. The order matters because it preserves the correct sign.

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