SigmaField
Mathematical Foundations for Quant Finance
0 of 256 lessons
      1. 5.4.1 Densities, distribution functions and the uniform distributionConcept · 30 min
      2. 5.4.2 The exponential distributionConcept · 25 min
      3. 5.4.3 The normal distributionConcept · 30 min
      4. 5.4.4 The lognormal, Student t and chi-squared distributionsConcept · 30 min
      5. 5.4.5 Practice set: continuous distributionsPractice set · 25 min
      6. 5.4.6 Case study: lognormal prices and fat-tailed returnsCase study · 35 min

Level 5, Probability and statistics 5.4 Continuous distributions Lesson 3 of 6

ConceptLesson 5.4.3 in Level 5, Probability and statistics. About 30 minutes.

The normal distribution

The normal density

Lesson 2.6.3 scaled the bell curve e−z2/2e^{-z^2/2} to area 1 and called it φ\varphi. Shift it to centre μ\mu and stretch it sideways by σ\sigma, and you get the normal distribution with mean μ\mu and standard deviation σ\sigma.

Rule: Normal distribution

X∼N(μ,σ2)f(x)=1σ2π e−(x−μ)2/(2σ2)\begin{gathered} X \sim \mathcal{N}(\mu, \sigma^2) \\[4pt] f(x) = \frac{1}{\sigma\sqrt{2\pi}}\,e^{-(x - \mu)^2/(2\sigma^2)} \end{gathered}

μ\mu and σ>0\sigma > 0 are in the units of XX. The second slot of N\mathcal{N} holds the variance σ2\sigma^2, not σ\sigma. The density is symmetric about μ\mu, highest there, and has area 1 for every μ\mu and σ\sigma.

The peak is 1σ2π\frac{1}{\sigma\sqrt{2\pi}}: a wider bell is lower, so that its area stays 1. The curve bends from concave down to concave up (lesson 2.4.2) at μ−σ\mu - \sigma and μ+σ\mu + \sigma, which is where to look for σ\sigma on a graph.

Filling bottles. A machine fills bottles with X∼N(500,42)X \sim \mathcal{N}(500, 4^2) millilitres: mean 500 ml, standard deviation 4 ml, variance 16 ml². The peak of its density is 142π≈0.099736\frac{1}{4\sqrt{2\pi}} \approx 0.099736 per ml.

The bell never reaches zero, so a normal variable can take any value. Values far from μ\mu are possible but rare: the tails fall like e−z2/2e^{-z^2/2}, much faster than the exponential's e−λxe^{-\lambda x} of lesson 5.4.2.

Standardising

Lesson 5.3.2 standardised any random variable to mean 0 and variance 1. For a normal variable the result is again normal: the standard normal. The z-score of a value counts how many standard deviations it lies from the mean.

Rule: Standardising

Z=X−μσ∼N(0,1)P(X≤x)=N(x−μσ)\begin{gathered} Z = \frac{X - \mu}{\sigma} \sim \mathcal{N}(0, 1) \\[4pt] P(X \le x) = N\left(\frac{x - \mu}{\sigma}\right) \end{gathered}

ZZ has no units. In reverse, X=μ+σZX = \mu + \sigma Z. Any probability for XX becomes one for ZZ, read off the single function NN.

ZZ has mean 0, since φ\varphi is symmetric about 0. Its variance is ∫z2φ(z) dz\int z^2\varphi(z)\,dz; by parts (lesson 2.6.2) with u=zu = z and dv=z φ(z) dzdv = z\,\varphi(z)\,dz, so that v=−φ(z)v = -\varphi(z), it is [−zφ(z)]−∞∞+∫φ(z) dz=0+1=1\big[-z\varphi(z)\big]_{-\infty}^{\infty} + \int \varphi(z)\,dz = 0 + 1 = 1.

Then lesson 5.3.2's rules for X=μ+σZX = \mu + \sigma Z give E[X]=μ\mathbb{E}[X] = \mu and Var⁡(X)=σ2\operatorname{Var}(X) = \sigma^2: the parameters are the mean and the variance.

For the bottles, a fill below 495 ml has z-score 495−5004=−1.25\frac{495 - 500}{4} = -1.25, so P(X<495)=N(−1.25)≈0.10565P(X < 495) = N(-1.25) \approx 0.10565. About one bottle in ten is under 495 ml.

fill xx (ml)492495500505510
z-score−2-2−1.25-1.2501.252.5
P(X≤x)P(X \le x)0.022750.105650.50.894350.99379

Exam scores. Scores are N(70,102)\mathcal{N}(70, 10^2). A score above 85 is 1.5 standard deviations up, so P(X>85)=1−N(1.5)≈0.066807P(X > 85) = 1 - N(1.5) \approx 0.066807.

φ\varphi and NN as probabilities

Lesson 2.6.3 computed areas under φ\varphi and called the area up to zz N(z)N(z). A density's areas are probabilities (lesson 5.4.1), so those areas now answer questions about ZZ. NN is the distribution function of ZZ.

  • N(1)≈0.841345N(1) \approx 0.841345 is P(Z≤1)P(Z \le 1).
  • The band from −1.96-1.96 to 1.96 held 0.950004 of the area, so P(−1.96<Z<1.96)≈0.95P(-1.96 < Z < 1.96) \approx 0.95.
  • The band from −1-1 to 1 held 0.683, so P(∣Z∣<1)≈0.682689P(|Z| < 1) \approx 0.682689.
  • N(0)=12N(0) = \frac{1}{2}: half the time ZZ is negative.

Rule: Symmetry of the standard normal

N(−z)=1−N(z)P(Z>z)=N(−z)\begin{gathered} N(-z) = 1 - N(z) \\[4pt] P(Z > z) = N(-z) \end{gathered}

The area above zz equals the area below −z-z, because φ\varphi is symmetric. For far tails use N(−z)N(-z) or norm.sf(z), not 1 - norm.cdf(z), which loses digits (case study 2.6.5).

Try it

norm(loc=500, scale=4) is N(500,42)\mathcal{N}(500, 4^2): scale is σ\sigma, not σ2\sigma^2. Its cdf and the standardised norm.cdf((x - 500) / 4) agree.

Then lesson 2.6.3's three areas, now probabilities. The last line checks Var⁡(Z)=∫z2φ(z) dz=1\operatorname{Var}(Z) = \int z^2\varphi(z)\,dz = 1 by quad.

⌘/Ctrl + Enter runs the cell

The 68–95–99.7 rule

Three numbers are worth knowing by heart. They hold for every normal, since standardising turns "within kk standard deviations of μ\mu" into ∣Z∣<k|Z| < k.

Rule: 68–95–99.7

P(∣X−μ∣<σ)≈0.6827P(∣X−μ∣<2σ)≈0.9545P(∣X−μ∣<3σ)≈0.9973\begin{gathered} P(|X - \mu| < \sigma) \approx 0.6827 \\[4pt] P(|X - \mu| < 2\sigma) \approx 0.9545 \\[4pt] P(|X - \mu| < 3\sigma) \approx 0.9973 \end{gathered}

Outside 3σ3\sigma lies only 0.0027, about 1 value in 370. Outside 4σ4\sigma lies 0.0000633, about 1 in 15,800.

The 68–95–99.7 rule for the bottle fills. Each band reaches one more standard deviation from the mean; the axis shows both the distance in standard deviations and the fill in ml.

For the bottles: 68.27% of fills lie between 496 and 504 ml, 95.45% between 492 and 508, and 99.73% between 488 and 512.

The bell is the same shape for every μ\mu and σ\sigma. Move μ\mu and σ\sigma, then set the interval to one standard deviation either side of the mean: it holds 0.6827 every time. Then try two standard deviations.

Explore

The curve is a density: probabilities are areas under it. Change the parameters, then set an interval and read the shaded area.

−4−202400.10.20.30.4

The dashed line is the mean.

Probability
P(−1 ≤ X ≤ 1) = 0.6827
Mean
0
Variance
1, so the standard deviation is 1

Quantiles

The pp-quantile of ZZ is zp=N−1(p)z_p = N^{-1}(p), norm.ppf(p) in SciPy. Like NN itself, it has no formula and is computed numerically.

pp0.50.90.950.9750.99
zpz_p01.2815521.6448541.9599642.326348

By symmetry z1−p=−zpz_{1-p} = -z_p: the 0.01-quantile is −2.326348-2.326348.

Rule: Normal quantiles

xp=μ+σ zpx_p = \mu + \sigma\,z_p

Standardise backwards: go zpz_p standard deviations from the mean. 1.96 is the zpz_p behind "95% within 1.96 standard deviations": 2.5% lies beyond it on each side.

The lightest 1% of bottles hold less than 500+4×(−2.326348)≈490.69500 + 4 \times (-2.326348) \approx 490.69 ml.

Setting the machine. To make only 1% of bottles fall under 495 ml, the mean must sit 2.326348 standard deviations above 495: μ=495+4×2.326348≈504.31\mu = 495 + 4 \times 2.326348 \approx 504.31 ml. This is the same equation, solved for μ\mu.

The top 10% of exam scores start at 70+10×1.281552≈82.8270 + 10 \times 1.281552 \approx 82.82.

Try it

norm.ppf gives the table's zpz_p. Then the three examples: a bottle quantile, the mean that puts 1% under 495, and the exam's 0.9-quantile.

⌘/Ctrl + Enter runs the cell

Linear changes and sums

A linear change of a normal variable is normal again. Lesson 5.3.2's rules give its mean and variance.

Rule: Linear change and sum

aX+b∼N(aμ+b, a2σ2)X1+X2∼N(μ1+μ2, σ12+σ22)\begin{gathered} aX + b \sim \mathcal{N}(a\mu + b,\ a^2\sigma^2) \\[4pt] X_1 + X_2 \sim \mathcal{N}(\mu_1 + \mu_2,\ \sigma_1^2 + \sigma_2^2) \end{gathered}

For a≠0a \ne 0. The second line needs X1X_1 and X2X_2 normal and independent (lesson 5.1.3); it is stated here, and lesson 5.6.3 shows why. Variances add; standard deviations do not.

A temperature in °F. If a temperature is N(20,32)\mathcal{N}(20, 3^2) in °C, then 1.8C+321.8C + 32 is N(68,5.42)\mathcal{N}(68, 5.4^2) in °F.

A pack of six bottles filled independently holds N(3000,6×16)\mathcal{N}(3000, 6 \times 16) ml, so its standard deviation is 96≈9.798\sqrt{96} \approx 9.798 ml, not 6×4=246 \times 4 = 24. A pack under 2,980 ml has z-score −2.0412-2.0412 and probability 0.020613.

A difference behaves the same way: X1−X2X_1 - X_2 is N(0,32)\mathcal{N}(0, 32) for two bottles, with standard deviation 32≈5.657\sqrt{32} \approx 5.657. The variances still add, because Var⁡(−X2)=Var⁡(X2)\operatorname{Var}(-X_2) = \operatorname{Var}(X_2).

Try it

rng.normal(loc, scale, size) draws from N(loc,scale2)\mathcal{N}(\text{loc}, \text{scale}^2); scale is the standard deviation. Earlier lessons drew data this way, starting with case study 3.1.4.

The first line is the exact pack: its standard deviation, the z-score of 2,980 and its probability, then 32\sqrt{32}.

Then 100,000 packs of six bottles, in one seeded run. Their mean, standard deviation and share under 2,980 land near 3000, 9.798 and 0.0206. Last, the difference of two bottles.

⌘/Ctrl + Enter runs the cell

Shape, and where the normal does not fit

Lesson 5.3.3 measured shape with skewness and kurtosis. The normal is the benchmark: skewness 0, because it is symmetric, and kurtosis 3. SciPy reports the excess kurtosis, kurtosis minus 3, so the normal's is 0: norm.stats(moments="mvsk") gives mean 0, variance 1, skewness 0 and excess kurtosis 0.

A normal model can mislead in two ways.

  • It allows every value. Model a lifetime as N(2,1.52)\mathcal{N}(2, 1.5^2) years and P(X<0)=N(−1.3333)≈0.091P(X < 0) = N(-1.3333) \approx 0.091: a negative lifetime one time in eleven. The lognormal of lesson 5.4.4 stays positive.
  • Its tails are thin. Beyond 4σ4\sigma it puts only 0.0000633. Many data sets, daily returns among them, have more values out there. Lesson 5.4.4 meets the Student t, and case study 5.4.6 compares both with return data.

Try it

The first line prints the four moments of the standard normal, with the excess kurtosis last.

Then the chance of a negative lifetime, and the tails beyond 3 and 4 standard deviations. Each comes with its "one in how many". norm.sf(k) is 1−N(k)1 - N(k), so the two-sided tail is twice it.

⌘/Ctrl + Enter runs the cell

Lesson 5.4.4 builds three distributions from the normal: the lognormal, the Student t and the chi-squared.

Common mistakes

  1. The second slot is the variance. N(500,16)\mathcal{N}(500, 16) has σ=4\sigma = 4, and SciPy wants norm(500, 4).
  2. Standardise before reading NN. P(X<495)P(X < 495) is N(−1.25)N(-1.25), not N(495)N(495).
  3. Use symmetry for the upper side. P(Z>z)=1−N(z)=N(−z)P(Z > z) = 1 - N(z) = N(-z); for far tails use norm.sf.
  4. Add variances, not standard deviations, for independent sums and for differences.
  5. Sums of normals are normal when they are independent (or, lesson 5.5.3, jointly normal). Normality alone is not enough.
  6. A normal model gives every value some probability, including impossible negative ones, and it understates extreme values in fat-tailed data.

The normal distribution

0 of 12 correct

  1. 1.
  2. 2.
  3. 3.
  4. 4.
  5. 5.
  6. 6.
  7. 7.
  8. 8.
  9. 9.
  10. 10.
  11. 11.
  12. 12.
How to type answers
  • Powers with ^: x^7, 2^(1/3), a^-2.
  • Multiply with * or by writing side by side: 3x^2, 2(x+1).
  • ln(x) is the natural log, log(x, 2) is log base 2, e is Euler's number, sqrt(x) is a square root.
  • sin(x), cos(x) and tan(x) take radians; write pi for π and sin(x)^2 for sin²x.
  • Your first answer to each question is saved: it counts towards your score and brings the question back for review.
  • Exact answers like ln(20)/ln(3) are best. Decimals need about 4 significant figures.

Summary card

  • N(μ,σ2)\mathcal{N}(\mu, \sigma^2) has density 1σ2πe−(x−μ)2/(2σ2)\frac{1}{\sigma\sqrt{2\pi}}e^{-(x - \mu)^2/(2\sigma^2)}, mean μ\mu and variance σ2\sigma^2. In SciPy, norm(loc=mu, scale=sigma).
  • Z=X−μσZ = \frac{X - \mu}{\sigma} is standard normal, so P(X≤x)=N(x−μσ)P(X \le x) = N\left(\frac{x - \mu}{\sigma}\right). NN is lesson 2.6.3's area, read as a probability; P(Z>z)=N(−z)P(Z > z) = N(-z).
  • 68.27%, 95.45% and 99.73% lie within 1, 2 and 3 standard deviations of the mean.
  • Quantiles: xp=μ+σzpx_p = \mu + \sigma z_p, with zpz_p from norm.ppf: 1.645 for 0.95, 1.960 for 0.975, 2.326 for 0.99.
  • aX+baX + b is normal, and independent normals add to a normal with the variances added. rng.normal(mu, sigma, n) draws from N(μ,σ2)\mathcal{N}(\mu, \sigma^2).
  • Skewness 0, excess kurtosis 0. The normal gives negative values some probability and has thin tails.

Free further reading

Optional. This lesson covers what you need; these add more examples and practice. All are free to read.