The normal distribution

Heights, exam marks and measurement errors often follow a normal distribution: a symmetric bell curve described by its mean μ and standard deviation σ.

The 68-95-99.7 rule

About 68% of values lie within 1σ of the mean, 95% within 2σ, and 99.7% within 3σ.

z-scores

A z-score says how many standard deviations a value is from the mean:

z = (x − μ) ÷ σ

A mark of 82 in an exam with mean 70 and σ = 8 has z = 1.5: well above average. z-scores compare values on different scales.

Probabilities

P(X ≤ x) is the area under the curve to the left of x. Python's math.erf (the error function) computes it:

P(X ≤ x) = ½ × (1 + erf(z ÷ √2))

from math import erf, sqrt

def below(z):
    # Rounded: erf's last digits differ a little from one computer to another.
    return round(0.5 * (1 + erf(z / sqrt(2))), 6)

for k in [1, 2, 3]:
    print("within", k, "SD:", round(below(k) - below(-k), 4))

mean, sd, mark = 70, 8, 82
z = (mark - mean) / sd
print("z =", z, " P(X <= 82) =", round(below(z), 4))
Open in compiler

Common mistakes

  • Assuming every dataset is normal. Incomes, waiting times and anything that cannot go below zero are often skewed.

Quick check

1. Mean 100, SD 15. What is the z-score of 130?
2. About what share of values lies within 2 SD of the mean?
3. z = 0 means the value is…

Practice problems for this lesson

My notes

Write down what you want to remember from this lesson. Notes are saved on this device as you type, and appear on your dashboard.