Preview

A lesson from Essential Probability & Statistics for ML

£29/month

£29/month£29/month or £249/year · 30-day money-back guarantee

Get full access

Our content is best on a larger screen

The normal distribution

The normal PDF

Explanation

A uniform PDF is constant on its support, so every interval of the same length inside the support has the same probability. Many quantities behave differently: their values cluster around a central value, and values further from it are less likely.

This pattern appears again and again across the natural and social sciences, from measurement errors and heights to exam scores and economic data. The distribution that describes it is the normal distribution, the most widely used in probability and statistics.

The normal distribution

Definition

A continuous random variable XX has the normal distribution, also called the Gaussian distribution, with mean μ\mu and variance σ2\sigma^2, so standard deviation σ\sigma, written X∼N(μ,σ2)X \sim \mathcal{N}(\mu, \sigma^2), when its PDF is

f(x)=1σ2π e−((x−μ)/σ)2/2f(x) = \dfrac{1}{\sigma\sqrt{2\pi}}\,e^{-\left((x - \mu)/\sigma\right)^2/2}

for every number xx.

The constant 1σ2π\dfrac{1}{\sigma\sqrt{2\pi}} makes ff a valid PDF: the total area under it is 11.

In the exponent, (x−μ)/σ(x - \mu)/\sigma is the number of standard deviations xx lies from the mean. So the exponent is 00 at x=μx = \mu and more negative the further xx is from the mean.

Tip

Some books, and code libraries such as NumPy, put the standard deviation second: np.random.normal(0, 4) draws from N(0,16)\mathcal{N}(0, 16). We always put the variance second.

Example

A random variable XX satisfies X∼N(4,0.25)X \sim \mathcal{N}(4, 0.25). Its PDF is ff. Find f(5)f(5), the density of XX at 55.

Solution

The PDF of X∼N(μ,σ2)X \sim \mathcal{N}(\mu, \sigma^2) is

f(x)=1σ2π e−((x−μ)/σ)2/2f(x) = \dfrac{1}{\sigma\sqrt{2\pi}}\,e^{-\left((x - \mu)/\sigma\right)^2/2}

Here μ=4\mu = 4 and the variance is 0.250.25, so σ=0.25=0.5\sigma = \sqrt{0.25} = 0.5 and the constant is 10.52π=22π\dfrac{1}{0.5\sqrt{2\pi}} = \dfrac{2}{\sqrt{2\pi}}. 55 is 22 standard deviations from the mean:

5−40.5=2\dfrac{5 - 4}{0.5} = 2

Squaring gives 44 and halving gives 22, so

f(5)=22π e−2f(5) = \dfrac{2}{\sqrt{2\pi}}\,e^{-2}

Practice questions

5 questions

The score XX on a test is normal with mean 5050 and standard deviation 1010. How is the distribution of XX written?

Select the correct answer:

+ 4 more questions · unlocked with a subscription

The bell curve

Explanation

The graph of a normal PDF is called a bell curve. The diagram below shows its properties one at a time.

−6
−5
−4
−3
−2
−1
1
2
3
4
5
6
0.2
0.4
0.6
0
x
f(x)
x=μ

The blue curve is the PDF of a normal random variable with mean μ and standard deviation σ.

Step 1: The peak is at the mean

Here μ=2 and σ=1. The curve is highest at the mean, on the dashed line x=μ. The red point marks the peak.

Its height is 1σ2π, which here is about 0.40.

Step 2: The curve is symmetric about the mean

The two red points are 1.5 either side of the mean, and they are at the same height.

The same holds at every distance, so each half of the curve is the mirror image of the other in the line x=μ.

Step 3: The curve is positive everywhere

The two red points are 3 standard deviations from the mean, where the density is about 0.004. The curve is very close to the horizontal axis there, but it never meets it.

A power of e is always positive, so f(x)>0 for every x.

Step 4: Changing σ rescales the curve

Move the sliders. Changing μ moves the curve along the axis. Doubling σ halves the peak height and stretches the curve to twice the width.

The table below summarises these properties.

PropertyStatement
PeakAt x=μx = \mu, with height 1σ2π\dfrac{1}{\sigma\sqrt{2\pi}}
Symmetryf(μ−d)=f(μ+d)f(\mu - d) = f(\mu + d) for every number dd
Positivef(x)>0f(x) > 0 for every xx
Changing μ\muMoves the curve along the axis without changing its shape
Changing σ\sigmaMultiplying σ\sigma by kk divides the peak height by kk and stretches the curve horizontally by a factor of kk

Practice questions

5 questions

XX is normal with mean μ=3\mu = 3 and standard deviation σ=1\sigma = 1. Four curves are drawn below. Which one is the graph of the PDF of XX? (Use 2π≈2.5\sqrt{2\pi} \approx 2.5.)

−1
1
2
3
4
5
6
7
8
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0
x
A
B
C
D

Select the correct answer:

+ 4 more questions · unlocked with a subscription

Memory is built by recalling, not by reading.

Every time you pull an answer from memory, the memory gets stronger. Reading doesn't do that. Nodeledge asks you questions on every step of every lesson, then asks again after days, weeks and months.

Get full access

£29/month or £249/year · 30-day money-back guarantee

See the learning path