Elements of Mathematics

From First Principles for Data Scientists, AI Engineers and Quants


Some objects turn up in the Elements of Mathematics series because they are needed, not because the argument at hand is about them. The normal distribution appears in an option price. Euler's number appears in a discount factor. A Taylor expansion appears in the middle of a proof about something else.

Stopping to build each one where it appears would wreck the flow of the piece that needed it. Not building it at all would break the promise this series makes, which is that nothing is used without being explained.

So they live here. Each entry is self-contained and can be read on its own. Articles link to the relevant entry at the point of use, and you can follow the link or take the one-line summary and carry on.

This page grows as the series does. Entries are added when an article first needs them.


Contents


A. The bell curve, and the function with no formula

Used by: Ito's calculus, in the Black-Scholes formula.

In one line: N(x)N(x) is the area under the bell curve to the left of xx, and it has no formula in terms of ordinary functions, so it gets a name instead.

What the bell curve is

The standard normal distribution is the curve

φ(x)=12πex2/2\varphi(x) = \frac{1}{\sqrt{2\pi}}\,e^{-x^2/2}

Read that as: take xx, square it (so negative and positive xx give the same answer, making the curve symmetric), halve it, and put a minus sign in front. Feed that to the exponential function, which turns large negative numbers into numbers very close to zero. So the curve is tall in the middle, where x2x^2 is small, and falls away fast in both directions. The 12π\frac{1}{\sqrt{2\pi}} at the front is a scaling constant, and its job is explained below.

The symbol φ\varphi is a Greek lower-case phi. It is a name, not an operation.

What N(x)N(x) is

N(x)N(x) is the area under that curve to the left of xx:

N(x)=xφ(t)dtN(x) = \int_{-\infty}^{x} \varphi(t)\,dt

Read that as: the elongated S is an integral sign, which means "the area under". The -\infty underneath and the xx on top say the area runs from the far left up to the point xx. The dtdt at the end says tt is the variable being swept across, and it is a different letter from xx only to avoid using one symbol for two jobs in the same expression.

Since the total area under the whole curve is 1, N(x)N(x) is a probability: the chance a standard normal random draw comes out below xx. That is why it appears in an option price. N(d2)N(d_2) in the Black-Scholes formula is literally the probability the option finishes in the money.

Three values worth knowing, which pin the shape down:

xxN(x)N(x)meaning
000.50.5half the area is left of centre, by symmetry
1.961.960.9750.975the source of the "95% confidence interval"
1.96-1.960.0250.025the mirror image

The part that surprises people

There is no formula for N(x)N(x) in terms of the functions you know. No combination of powers, roots, exponentials, logarithms and trigonometric functions equals that integral. This is not a gap in anyone's cleverness: it was proved impossible, by Liouville in the 1830s, in much the same spirit as proving no formula solves the general fifth-degree polynomial.

So the integral is given a name and treated as a function in its own right. The conventional name is the error function:

erf(z)=2π0zet2dt\mathrm{erf}(z) = \frac{2}{\sqrt{\pi}}\int_0^z e^{-t^2}\,dt

That is the same shape of integral, with the constants arranged differently by historical accident. Converting between them is a change of scale:

N(x)=12(1+erf ⁣(x2))N(x) = \frac{1}{2}\left(1 + \mathrm{erf}\!\left(\frac{x}{\sqrt2}\right)\right)

Where the 2\sqrt2 comes from: the bell curve uses ex2/2e^{-x^2/2} and erf uses et2e^{-t^2}, so substituting t=x/2t = x/\sqrt2 converts one into the other. The 12\tfrac12 and the +1+1 shift the range from erf's [1,1][-1, 1] to a probability's [0,1][0, 1].

The Python companion code implements exactly this identity, which is why an option price in this series depends on no library beyond math.erf.

Why the 2π\sqrt{2\pi} is there

The scaling constant exists to make the total area equal 1, and the fact that it involves π\pi is one of the pleasant surprises in mathematics. There is no circle anywhere in sight.

The move: you cannot integrate ex2e^{-x^2} directly, so square the problem instead. Squaring turns one integral into a double integral over the plane, and a double integral over the plane can be done in circular coordinates, where the circle finally appears.

Write I=ex2dxI = \int_{-\infty}^{\infty} e^{-x^2}dx, the quantity we want. Then

I2=(ex2dx)(ey2dy)= ⁣ ⁣e(x2+y2)dxdyI^2 = \left(\int_{-\infty}^{\infty} e^{-x^2}dx\right)\left(\int_{-\infty}^{\infty} e^{-y^2}dy\right) = \int\!\!\int e^{-(x^2+y^2)}\,dx\,dy

The second step uses different letters for the two copies, which is legal because each is a definite integral producing a number, and the letter used inside is irrelevant. Multiplying two integrals then combines into one integral over the whole plane.

Now x2+y2x^2 + y^2 is the squared distance from the origin, so in circular coordinates it is just r2r^2, and the area element becomes rdrdθr\,dr\,d\theta. That extra factor of rr is what rescues the calculation:

I2=02π ⁣ ⁣0er2rdrdθI^2 = \int_0^{2\pi}\!\!\int_0^{\infty} e^{-r^2}\,r\,dr\,d\theta

The inner integral is now elementary, because rdrr\,dr is exactly the derivative pattern er2e^{-r^2} needs: it evaluates to 12\tfrac12. The outer one contributes 2π2\pi. So I2=πI^2 = \pi and I=πI = \sqrt{\pi}.

That π\pi is where the 2π\sqrt{2\pi} in the bell curve comes from, and the 2π2\pi is the angle swept by a full circle. The circle was hiding in the fact that ex2e^{-x^2} depends only on distance from the origin.

This is one of the derivations worth seeing once. If you skipped it, the only thing to carry is that the constant makes the total area 1.


B. Euler's number, and why it appears in discounting

Used by: Ito's calculus, in the discount factor erTe^{-rT}.

In one line: e2.71828e \approx 2.71828 is what compound interest converges to when compounded continuously, and erTe^{-rT} is the factor converting a future amount into its value today.

Where the number comes from

Invest £1 at 100% interest for a year. Paid once at the end, you have £2. Paid twice a year at 50% each, you have (1+12)2=£2.25(1 + \tfrac12)^2 = £2.25, because the first payment earns interest during the second half. Paid monthly at 112\tfrac{1}{12} each:

(1+112)122.613\left(1 + \tfrac{1}{12}\right)^{12} \approx 2.613

Keep going, and the total does not run away to infinity. It settles:

compoundedvalue
once a year2.00000
monthly2.61304
daily2.71457
hourly2.71813
continuously2.71828…
e=limn(1+1n)n2.718281828e = \lim_{n\to\infty}\left(1 + \frac{1}{n}\right)^{n} \approx 2.718281828

Read that as: lim\lim means "what this settles down to as nn grows without bound". Not what it equals at any particular nn, but the value it approaches. That the limit exists at all is guaranteed by the completeness property, which is the subject of the first article in this series: the sequence increases and stays below 3, and a sequence that increases and stays bounded has to converge to something.

What erTe^{-rT} does

At a continuously compounded rate rr for time TT, an amount grows by erTe^{rT}. So to go the other way, from a future amount to what it is worth today, you multiply by erTe^{-rT}.

With r=5%r = 5\% and T=1T = 1 year, e0.050.9512e^{-0.05} \approx 0.9512. A pound a year from now is worth about 95 pence today.

In the Black-Scholes formula, KerTKe^{-rT} is the strike price discounted back to today, because that is when the price is being quoted, while the strike is paid at expiry.


C. Taylor expansion

Used by: Ito's calculus, where the second-order term refuses to vanish.

In one line: approximate a curve near a point by a straight line, then a parabola, then a cubic, with an error term that tells you what the approximation costs.

The idea

Near any point, a smooth curve looks almost like a straight line. That line is the tangent, and its slope is the derivative. Taking the tangent as an approximation to the curve is the first-order Taylor expansion:

f(x+h)f(x)+f(x)hf(x + h) \approx f(x) + f'(x)\,h

Read that as: to find the value a small step hh away, start where you are and add the slope times the step. f(x)f'(x), said "f prime of x", is the slope of ff at xx.

That is exact for a straight line and wrong for anything curved, so add a term measuring the curving:

f(x+h)f(x)+f(x)h+12f(x)h2f(x + h) \approx f(x) + f'(x)\,h + \tfrac{1}{2}f''(x)\,h^2

ff'', "f double prime", is the derivative of the derivative: how fast the slope itself is changing. The 12\tfrac12 appears because differentiating h2h^2 gives 2h2h, and the factor has to be cancelled for the term to come out right.

You can keep going, dividing by 66, then 2424, then n!n! at the nn-th term.

Why the second term usually gets thrown away

For a small step hh, the terms shrink fast: hh is small, h2h^2 is much smaller, h3h^3 smaller still. If h=0.01h = 0.01, then h2=0.0001h^2 = 0.0001. So for smooth functions along smooth paths, everything past the first term is negligible, and ordinary calculus proceeds by discarding it.

This is exactly what stochastic calculus cannot do. Along a Brownian path, the typical step over a short interval δ\delta is not proportional to δ\delta but to δ\sqrt{\delta}, so the squared step is proportional to δ\delta itself, which is the same size as the first-order term. The term ordinary calculus discards is the same order as the term it keeps.

Ito's lemma is that observation, written down. Nothing more.


D. The characteristic function

Used by: Ito's calculus, in the Fourier route to an option price.

In one line: a way of compressing an entire probability distribution into a single function, chosen so that adding independent random quantities becomes multiplying their functions.

What it is

For a random quantity XX, its characteristic function is

φX(u)=E ⁣[eiuX]\varphi_X(u) = \mathbb{E}\!\left[e^{iuX}\right]

Read that as: E[]\mathbb{E}[\cdot] means "the average value of", over all the ways XX could come out. ii is the imaginary unit, the number whose square is 1-1. uu is a dial you can turn: the characteristic function is not one number but a whole function of uu.

Why the imaginary exponential? Because eiuxe^{iu x} traces a circle as xx varies rather than growing without bound, the average is guaranteed to exist for every distribution, including ones with tails so heavy they have no mean. A real exponential would blow up.

Why it is useful

Two properties do all the work.

It determines the distribution completely. Two random quantities with the same characteristic function have the same distribution. Nothing is lost in the compression, so anything you want to know can in principle be recovered from it.

Adding becomes multiplying. If XX and YY are independent,

φ(X+Y)(u)=φX(u)φY(u)\varphi_{(X+Y)}(u) = \varphi_X(u)\,\varphi_Y(u)

Adding random quantities is otherwise an unpleasant operation requiring an integral over all the ways the two could combine. In characteristic function form it is multiplication.

That is the trick behind the Fourier route to an option price: instead of integrating a payoff against a distribution directly, write down the characteristic function of the log price, which is short and explicit, and recover the price from it.