Pi Day: the i and the pi

Today is often referred to as “Pi Day”, since in the United States and various other countries, the date March 14 is written as 3/14. Beyond those who write the date 14/3, there are a few who object to Pi Day for other reasons. For pedants who want to point out that 3.14 is not actually equal to pi, you’re right. However, note that the difference in numerical calculations is 0.05%. (The real pedants will also point out that in Greek, “pi” is pronounced “pee”, but nobody wants a “Pee Day”.)  So, because I am not a complete curmudgeon, I dusted off an older mathy post and updated it.

Leonhard Euler, one of the greatest mathematicians of all time. He also contributed to physics, astronomy, and the fashion of wearing boxer shorts on his head.

Nobody can write about the history of science and mathematics without eventually bringing up Leonhard Euler (1707-1783). (Most Americans end up pronouncing his name like “oiler”.) So many important findings in math and physics that it’s hard to list them all, so I won’t try. I don’t really want to write a biography of him anyway: I just want to focus on one profound equation he discovered, and follow where it leads into some other interesting math…and of course physics.

Without further ado, here’s one of several formulas known as “Euler’s equation”:
e^{i \pi} + 1 = 0
The numbers 0, 1, and π are hopefully familiar to you; the exponential number e may be less well-known. It’s another geometrical number like π, and it has a value approximately equal to 2.71828… (but since it goes on forever without repeating, I’ll spare you any more digits). There are several ways to get at e, but we don’t need to worry about them for now. The main thing is that it’s standard, built into scientific calculators, and well-understood. The imaginary unit i also appears in the equation: recall that
i^2 = -1 \quad \mbox{so that} \quad \sqrt{-1} = i
So maybe you can see why Euler’s equation is a bit unexpected: e and π are real irrational numbers. (Irrational means these numbers can’t be expressed as the ratio of integers; integers are the whole numbers 0, 1, -1, 2, -2, 3, -3, etc.) Including i in the mix naïvely should yield a complex number, but it doesn’t: combining e, π, and i gives the negative integer -1.

In case you’re thinking I’m making a big deal out of nothing, type “exp(pi)” (without the quotation marks) into Wolfram Alpha. You should get
e^{\pi} = 23.140692632779...
and so on, which is significantly larger than 1, and a positive number to boot. In fact, you won’t ever get a negative number by raising e to a real number. Try these in Wolfram Alpha: exp(-10), exp(-1), exp(0), exp(1), exp(10). Something weird and cool happens when you include an imaginary number in the exponent, and Euler realized after some careful computation what was going on.

Illustration of the complex plane: the connection between complex numbers and points in two dimensions. Four points are plotted so you can see the correspondence between x and y coordinates and the real and imaginary parts of the complex numbers.

First of all, the number π is special: if you plug another number in its place (say 1), you won’t get a real number out:
e^i = 0.54 + 0.84 i
(rounding to two digits for conciseness). That’s a complex number: the sum of a real number with an imaginary number; refer to the figure on the right for a refresher on how to interpret complex number using coordinates. However, watch what happens when we square the real part and the imaginary part and add them together:
(0.54)^2 + (0.84)^2 \approx 1.00
Rounding makes these numbers not quite equal, but if you include more and more digits while running e^i, reaching ever higher levels of precision, you find that the sum is exactly equal to 1. You’ll also find this is true for other similar expressions like e^{i 2}: you get a complex number, but if you square the real and imaginary parts, they add up to 1. Pi and its integer multiples are special, though: e^{i (n \pi)} yields a real integer if n is any integer: 0, -1, 1, -2, 2, etc.

Euler determined that you can split the exponential into real and imaginary parts like this:
e^{i\theta} = \cos(\theta) + i \sin(\theta)
where “cos” is the cosine function, “sin” is the sine function, and θ is any real number. If you’re like me, you first learned about sine and cosine in the context of triangles, and that’s a pretty useful way to think of them here too. To start, let’s draw a circle with radius equal to 1. All points on the circle will be the same distance—1—from the center; after all, that’s really what a circle means. Take an arbitrary point on the circle and map its x– and y-coordinates; draw a line from the center of the circle to your point. Now complete the triangle by connecting your point with the x-axis and the center, as shown in the figure below:

Relating a circle to complex numbers. The radius line (in blue) has a length of 1, and we’ll use that as the hypotenuse of a triangle. Then the x- and y-coordinates of the end of the line are given by the cosine and sine of the angle θ as shown.

The standard trick in math is to associate the x– and y-axes with the real and imaginary parts of a complex number, so that the angle between the blue line and the x-axis, marked by θ, is the same as in Euler’s formula. The x-coordinate is the cosine of the angle, and the y-coordinate is the sine of the angle. Properly, we need to write the angle in radians, not degrees: one circle (360°) is 2π radians, so a half-circle (180°) is π radians. Looking at the circle above, you can see that an angle of π corresponds to x = -1 and y = 0, exactly what Euler’s formula predicts!
e^{i \pi} = -1 \quad \mbox{so that} \quad e^{i \pi} + 1 = 0

I won’t prove Euler’s formula (since it really needs calculus to do properly), but with a little more work we can see how useful it is. By drawing a larger or smaller circle, we can represent any complex number using a variation on Euler’s formula:
z = r e^{i\theta}
where r is a real number representing the radius of the new circle. Instead of writing the real and imaginary parts of the complex number like x– and y-coordinates, we can use r and θ, which are known as polar coordinates. The angle θ is also known as the phase of the complex number, and r is its magnitude. That’s a very simple formula, and makes doing many calculations with complex numbers quite easy.

For example: if you want to mathematically represent rotations in two dimensions, you can do it using complex numbers. Take the coordinates of (say) the corners of a square, and write them as four complex numbers:
a = 1 + 2 i,\ b = 2 + 2 i, \ c = 2 + i , \mbox{ and } d = 1 + i

Rotating a square using complex numbers: write the coordinates for each corner as complex numbers. Use Euler’s formula to write a complex number with the angle you want to rotate. Multiplying “a” by the rotation factor gives you “A”, and so forth. Despite how it may look, each corner is the same distance from the axis of rotation before and after.

To rotate the square by angle θ, multiply the number for each corner of the square by
R(\theta) = e^{i \theta}
and you’ll get the coordinates of the rotated square:
A = R(\theta) \times a,\ B = R(\theta) \times b,\ C = R(\theta) \times c, \mbox{ and } D = R(\theta) \times d
For the example image, I used \theta = \pi/3 radians (or 60° if you prefer, but it’s Pi DAY so use the friggin’ radians already).
R(\pi/3) = \cos(\frac{\pi}{3}) + \sin(\frac{\pi}{3}) = 0.500 + 0.866 i
Therefore,
A = (0.500 + 0.866 i) \times (1 + 2 i) = -1.23 + 1.87 i
and so forth, as in the picture.

It’s endlessly fascinating how many places π shows up where you don’t necessarily expect it. However, once you’re attuned, you realize its ubiquity is because geometry hides in many places: the spiral of shells, the strength of gravity, the fluctuations of waves. Pi is an interesting number, encoding a deep connection between many apparently disparate areas of the natural world.