What is standard deviation and how does it differ from variance?
Learn what standard deviation and variance measure, how they differ in units, why deviations are squared, and when to use each to describe data spread.
Expected Interview Answer
Standard deviation measures how spread out data values are around the mean, and it is simply the square root of the variance — variance is the average of the squared deviations from the mean.
Variance is computed by taking each value's difference from the mean, squaring it, and averaging those squared differences. Because squaring changes the units (e.g., dollars become dollars-squared), variance is hard to interpret directly. Standard deviation takes the square root, returning to the original units so the spread is expressed on the same scale as the data. A small standard deviation means values cluster tightly around the mean; a large one means they are widely dispersed.
- Standard deviation is in the same units as the data, so it is interpretable
- Variance is mathematically convenient and additive for independent variables
- Both quantify dispersion and risk
- They enable comparison of consistency across datasets
- They feed directly into the CLT, z-scores, and confidence intervals
AI Mentor Explanation
A batter's consistency is about spread around their average. Variance squares each innings' distance from the mean, over-penalising a wild score, and leaves you in odd 'runs-squared' units. Standard deviation square-roots it back to plain runs, so you can say scores swing by about 20 runs. A low standard deviation marks a dependable, steady batter.
Step-by-Step Explanation
Step 1
Compute the mean
Find the average of all data values as the reference point.
Step 2
Find deviations
Subtract the mean from each value to get how far each point sits from center.
Step 3
Square the deviations
Square each difference so negatives don't cancel positives and larger gaps count more.
Step 4
Average to get variance
Take the mean of the squared deviations (dividing by N for a population, N-1 for a sample).
Step 5
Square-root to get standard deviation
Take the square root of the variance to return to the original units.
What Interviewer Expects
- The exact relationship: standard deviation is the square root of variance
- Why squaring is used (avoids cancellation, penalises large deviations)
- The units difference between the two
- The N vs N-1 distinction for population versus sample
- An interpretation of what small vs large spread means
Common Mistakes
- Saying variance and standard deviation are the same thing
- Forgetting variance is in squared units
- Using N instead of N-1 for a sample estimate
- Confusing standard deviation with standard error
- Ignoring that both are sensitive to outliers
Best Answer (HR Friendly)
“Both measure how spread out data is around the average. Variance is the average of the squared distances from the mean, but its units are squared and hard to read; standard deviation is just the square root of variance, putting the spread back into the original units so it is easy to interpret.”
Code Example
import numpy as np
data = np.array([4, 8, 15, 16, 23, 42])
# Population variance/std (ddof=0)
pop_var = np.var(data)
pop_std = np.std(data)
# Sample variance/std (ddof=1, divides by N-1)
samp_var = np.var(data, ddof=1)
samp_std = np.std(data, ddof=1)
print('Population variance:', round(pop_var, 2))
print('Population std dev :', round(pop_std, 2))
print('Sample variance :', round(samp_var, 2))
print('Sample std dev :', round(samp_std, 2))
print('sqrt(variance)==std:', np.isclose(np.sqrt(pop_var), pop_std))Follow-up Questions
- Why do we divide by N-1 for a sample variance?
- How does standard deviation relate to the standard error?
- What is the coefficient of variation and why use it?
- How do outliers affect variance and standard deviation?
- What does one standard deviation cover in a normal distribution?
MCQ Practice
1. What is the relationship between standard deviation and variance?
Variance is the average squared deviation; its square root is the standard deviation, restoring the original units.
2. Why are deviations squared when computing variance?
Squaring makes all deviations positive so they don't cancel, and it weights larger gaps more heavily.
3. For an unbiased sample variance, what do you divide by?
Dividing by N-1 (Bessel's correction) gives an unbiased estimate of the population variance from a sample.
Flash Cards
Standard deviation definition — A measure of spread equal to the square root of the variance, in the same units as the data.
Variance definition — The average of the squared deviations from the mean; its units are squared.
Key relationship — Standard deviation = sqrt(variance); variance = (standard deviation)^2.
Sample vs population divisor — Population divides squared deviations by N; sample divides by N-1 (Bessel's correction).
Why square the deviations — To stop positive and negative deviations cancelling and to weight larger gaps more.
Continue Learning
Related Interview Questions
What is the difference between mean, median, and mode, and when do you use each?
easy
What is the difference between correlation and causation in data analysis?
easy
What is the Central Limit Theorem and why does it matter for data science?
medium
What is exploratory data analysis (EDA) and what does it involve?
easy