Euler’s Identity

Very few things in maths are as uncanny as π\pi’s ability to just manifest out of absolutely nowhere. Perhaps the most prominent (and mind-boggling) instance is Euler’s identity: eiπ=1e^{i \pi} = -1. The constant ee is for logarithms, π\pi is for circles and ii is for square roots, yet somehow, they fit neatly together.

The first time I saw this equation, I was not equipped to understand it, and so it was just a curiosity out of my grasp. Some time later I stumbled across it again, took the time to understand it and promptly forgot the maths behind it. Since then, every couple of years I revisit the equation, only to loose that understanding again. But not this time, because this time I’m writing it down.

It’s complex, actually

Negative numbers aren’t real, in the sense that you can’t have -5 apples. However, people soon realized that they’re useful, and so they exist not because they have to, but because they can. Much like negative numbers, their roots exist because they can.

In fact, they don’t just technically exist, we can do proper maths with them. Just as we can divide roots: 36=49=49=6\sqrt{36} = \sqrt{4 \cdot 9} = \sqrt{4} \cdot \sqrt{9} = 6, we can divide negative roots: c=1c\sqrt{-c} = \sqrt{-1} \cdot \sqrt{c}. With that, we can do some basic maths: 94+4\sqrt{-9} \cdot 4 + \sqrt{4} =194+4= \sqrt{-1} \cdot \sqrt{9} \cdot 4 + \sqrt{4} =112+2= \sqrt{-1} \cdot 12 + 2. No matter the number, we can always divvy it up to a part with 1\sqrt{-1} and some other part that doesn’t have negative roots. Lets define i:=1i := \sqrt{-1}.

This opens up the space of complex numbers, they’re the sum of a non-complex (real) part aa, and bb, the “imaginary” part: z=a+biz = a + bi. Since these numbers are made up of two scalars (aa and bb), we can draw them as points in the 2 dimensional “complex plane” at (a,b)(a,b):

Gnuplot Produced by GNUPLOT 6.0 patchlevel 3 -5i -4i -3i -2i -1i 0i 1i 2i 3i 4i 5i -5 -4 -3 -2 -1 0 1 2 3 4 5 gnuplot_plot_1 1.0+1.0i -1.0+-1.0i -2.2+3.0i 3.0+2.2i -3.7+-2.0i 4.1+-3.7i

Let’s do some more maths: (a+bi)i=ai+bi2=1b+ai(a+bi) \cdot i = ai+bi^2 = -1b+ai. Note how real and imaginary parts almost switched places, except bb is now negative. If we take a number and multiply it by ii enough times, it eventually comes full circle: (1.5+2i)i4(1.5 + 2i) \cdot i^4 =(1.5i2)i3= (1.5i - 2) \cdot i^3 =(1.52i)i2= (-1.5 -2i) \cdot i^2 =(1.5i+2)i1= (-1.5i + 2) \cdot i^1 =(1.5+2i)i0= (1.5 + 2i) \cdot i^0. In fact, any multiplication by ii is a 90° counter-clockwise rotation in the complex plane.

Gnuplot Produced by GNUPLOT 6.0 patchlevel 3 -5i -4i -3i -2i -1i 0i 1i 2i 3i 4i 5i -5 -4 -3 -2 -1 0 1 2 3 4 5 gnuplot_plot_1 gnuplot_plot_2 1.5+2.0i -2.0+1.5i -1.5+-2.0i 2.0+-1.5i

Baby steps

We don’t know much about eiπe^{i \pi}, but we can use some basics to help us along. First, let’s generalize the problem to look at the function f(x)=eixf(x) = e^{ix}. Derivatives are the rate of change at a particular point, so if we know one point on the graph, we can use it’s derivative to get us to another, close by, point on that same graph. With f(0)=ei0=e0=1f(0) = e^{i \cdot 0} = e^0 = 1, we have that starting point. Luckily, the derivative in this particular case is simple; we know that ecxx=cecxe^{c \cdot x} \frac{\partial}{\partial x} = c \cdot e^{c \cdot x} for all cc, including c=ic = i. We can turn this derivative into a discrete sequence by iterating in small steps: limϵ0f(x+ϵ)=f(x)+ϵf(x)=f(x)+ϵif(x)\lim_{\epsilon \to 0} f(x + \epsilon) = f(x) + \epsilon \cdot f'(x) = f(x) + \epsilon i \cdot f(x).

So, here’s the plan:

  1. Define f(x)=eixf(x) = e^{ix}
  2. Start at x=0x = 0
  3. Transform f(x)f(x) to a discrete sequence sϵ(n)s_\epsilon(n) for some small step size ϵ\epsilon
  4. Analyse how that sequence develops
  5. Generalize that movement back to limϵ0\lim_{\epsilon \to 0}
  6. See how that behaves for f(π)=eiπf(\pi) = e^{i\pi}

The sequence starts at x=0x = 0 and then repeatedly adds the “derivative” to each point:

We can plot this walk and connect the steps with lines:

Gnuplot Produced by GNUPLOT 6.0 patchlevel 3 -5 i -4 i -3 i -2 i -1 i 0 i 1 i 2 i 3 i 4 i 5 i -5 -4 -3 -2 -1 0 1 2 3 4 5 ε = 0.75 ε = 0.75 gnuplot_plot_2 n = 0 n = 1 n = 2 n = 3 n = 4 n = 5 n = 6 n = 7

Note how this creates a spiral. Since ϵ\epsilon is not complex, multiplying by ii means that the derivative/delta sϵ(n+1)sϵ(n)s_\epsilon(n+1) - s_\epsilon(n) =ϵisϵ(n)= \epsilon i \cdot s_\epsilon(n) is orthogonal to sϵ(n)s_\epsilon(n). Since i=1\mid i \mid = 1, the length of each step is ϵsϵ(n)\epsilon \cdot \mid s_\epsilon(n) \mid: It increases with the distance of sϵ(n)s_\epsilon(n) from the centre; hence the spiral. Let’s see how this spiral changes if we decrease the step size:

Gnuplot Produced by GNUPLOT 6.0 patchlevel 3 -5 i -4 i -3 i -2 i -1 i 0 i 1 i 2 i 3 i 4 i 5 i -5 -4 -3 -2 -1 0 1 2 3 4 5 ε = 0.75 ε = 0.75 ε = 0.65 ε = 0.65 ε = 0.55 ε = 0.55 ε = 0.45 ε = 0.45 ε = 0.35 ε = 0.35 ε = 0.25 ε = 0.25 ε = 0.15 ε = 0.15

Circling back

It’s not too hard to convince ourselves that limϵ0sϵ(n)\lim_{\epsilon \to 0} s_\epsilon(n) approaches a circle, but we can make sure with some maths: Since each step transposes orthogonally, we can calculate the distance of the next element from (0,0)(0,0) with Pythagoras: sϵ(n+1)=sϵ(n)2+ϵ2(isϵ(n))2\mid s_\epsilon(n+1) \mid = \sqrt{\mid s_\epsilon(n) \mid ^2 + \epsilon^2 \cdot (\mid i \cdot s_\epsilon(n) \mid )^2}.

Gnuplot Produced by GNUPLOT 6.0 patchlevel 3 0i 1i 2i 0 1 2 gnuplot_plot_1 gnuplot_plot_2 gnuplot_plot_3 s(0) s(1) s(2)

As ϵ\epsilon approaches zero, we get sϵ(n+1)=sϵ(n)2\mid s_\epsilon(n+1) \mid = \sqrt{\mid s_\epsilon(n) \mid ^2}. This means that each element has the same distance from the centre. Of course, at ϵ=0\epsilon = 0 we’re pretty much just looking at f(x)f(x). We know that f(0)=1f(0) = 1 is on the unit circle, and so, all f(x)f(x) have to be.

The distance travelled on the spiral from sϵ(n)s_\epsilon(n) to sϵ(n+c)s_\epsilon(n+c) is i=nn+c1ϵsϵ(i)\sum_{i = n}^{n+c-1} \epsilon \cdot \mid s_\epsilon(i) \mid (the sum of our deltas). With sϵ(i)=1\mid s_\epsilon(i) \mid = 1, that sums to cϵc \cdot \epsilon. So to calculate f(x)f(x), we have to travel cc increments of ϵ\epsilon along the circumference of the unit circle such that cϵ=xc \cdot \epsilon = x. For f(π)=eiπf(\pi) = e^{i\pi} we have to travel the unit circle for a distance of π\pi (half a circle) counter-clockwise, starting from (1,0)(1,0).

Gnuplot Produced by GNUPLOT 6.0 patchlevel 3 -1i 0i 1i -1 0 1 eix eix gnuplot_plot_2 e0 iπ e0.5 iπ e e1.5 iπ

So eiπ=1+0i=1e^{i \pi} = -1 + 0 \cdot i = -1, it’s one of the few values that happens to not have an imaginary part (similar to ei0e^{i \cdot 0}). Since it’s a circle, we can also plot the real and imaginary parts of eixe^{i \cdot x} separately to yield the cosine and sine:

Gnuplot Produced by GNUPLOT 6.0 patchlevel 3 -1 0 1 -1 0 1 2 3 4 5 6 x = π real(eix) real(eix) imag(eix) imag(eix)