## Saturday, March 21, 2015

We're going from straight philosophy in my last post to straight math in this one. But if you're an ancient Greek thinker type person, math and philosophy are the same thing, anyway.

So about a year and a half ago, I made a post that touched briefly on the relationship between trig functions and exponential functions as a way of justifying my tendency to make things more complex than they need to be. I mentioned there that I didn't have a firm enough mathematical grasp to explain how these two mathy bits are related. Well, the topic of Euler'sidentity came up a little while ago in my writing group, so I decided to do some research and figure out just how it is that trig functions and exponential functions come together.

For those of you that don't click links, Euler's identity says:

This is a pretty remarkable and frankly incredible equation, but it's true. It manages to link probably the three most famous mathematical constants in a very simple way. The identity arises from Euler's formula, which says:

If you replace x with π, then isin(π) = 0 and cos(π) = -1, so with a little rearranging you can get Euler's identity. But this raises the question of why it should be true that exponential functions and trig functions are connected by the imaginary unit.

First, a quick primer for those who need it. In the common parlance, something that is "exponentially" better is "really super" better. This kind of talk tends to aggravate the mathematically aware, however. Really, exponential functions are ones where adding a constant increment to the input multiplies the output by a constant factor.

So if you hear something like, "Kyrgyzstan's GDP has doubled every year for the last ten years," then that's exponential growth. The factor is 2, and the increment is yearly. But this also applies to, say, the interest rate on your savings account, which as we all know is not exactly "really super" better than anything except possibly 0. There, your balance is getting multiplied by something like 1.0025 every year, which is every bit as exponential as Kyrgyzstan's doubling GDP (totally made up).

The point is, however, that exponential functions (with a factor greater than 1) demonstrate constant (monotonic) growth. If you increase the x value, the y value will increase, too.

Trig functions, on the other hand, are the realm of waves, which go up and down and up and down. They are all about rhythmic or periodic behavior. But as their name suggests, the trigonometric functions are actually based on the angles formed by triangles. Trig functions are really expressions of the Pythagorean formula, A2 + B2 = C2. The relationship between this formula and periodic motion is that for some constant value of C, increasing A will decrease B, and vice versa.

So it's hard to see how exponential functions and trig functions could be related. As I hinted up above, the answer is through i.

i, the imaginary unit, is what the square root of negative one is defined to be. Imaginary numbers kind of get a bad rap, partly because of their name. They seem like something mathematicians just made up that couldn't possibly be real. The funny thing is people had the same opinion about negative numbers for a very long time. After all, how can you possibly have -3 apples? On this whole controversy, the great mathematician Carl Friedrich Gauss had this to say:
That this subject [imaginary numbers] has hitherto been surrounded by mysterious obscurity, is to be attributed largely to an ill-adapted notation. If, for instance, +1, -1, √-1 had been called direct, inverse, and lateral units, instead of positive, negative, and imaginary (or even impossible), such an obscurity would have been out of the question.
While his preferred notation might seem somewhat opaque, it does lend itself very well to a geometric interpretation of numbers. If you look at a Cartesian plot, you can think of Gauss's direct, inverse, and lateral numbers this way.

The direct unit (+1) moves you one to the right on the graph. The inverse unit (-1) moves you one to the left. And the lateral unit (√-1) moves you up one. Rather than being on the number line we're used to, imaginary numbers can be thought of as being at right angles to it.

This idea lets you plot numbers that are a combination of "real" and "imaginary." So if you have the complex number 3 + 2i, that's just 3 units to the right and 2 units up.

As you see, plotting numbers this way means you can draw right triangles that are related to those numbers. This is the first way that we can connect imaginary numbers to the trig functions. Getting from imaginary numbers to exponential functions will take a little more work, though.

If i is the square root of -1, we can play around with exponentiation to find an interesting pattern. i2 = (√-1)2, which by definition equals -1. i3 = (√-1)3, or (√-1)* (√-1)2, or i*-1, which just comes out to -i. i4 = i2 * i2, or -1 * -1, which equals 1. Multiply that by i, and you of course have i again. So through exponentiation, we have discovered something of a pattern.

i1 = i
i2 = -1
i3 = -i
i4 = 1
i5 = i

The exponents of i loop back in on themselves. You might even say they exhibit periodic behavior, like the trig functions.

Our next step is probably the toughest bit. Bear with me. So, if you recall from my foray into Fourier, many functions can be expressed as an infinite series of sines and cosines that eventually converge on a desired function. These infinite series turn out to be very useful to mathematicians, because not all patterns can be expressed as "elementary" functions, but only as infinite series of some other type of function. One type of infinite series is the power series, which looks like this:

To get different functions, just plug in different values for the coefficients an. The way you figure out which coefficients correspond to the function you want is basically by assuming your function can fit into some power series and then just playing around for awhile until you find a pattern that fits. Let me demonstrate.

One of the defining features of the exponential function, ex, is that it is its own derivative. This means that its rate of change is equal to its value. So the derivative of ex is also ex, and so on.

One of the first tools you learn in calculus is that the derivative of a power function like x4 is 4x3. You multiply by the exponent, and then lower the exponent by one. If the exponent is already 0, then your derivative is 0. So if you take the derivative of our above model power series, you get:

And if you take the derivative of that, you get:

And if you take the derivative of that, you get:

And one more time, because there's a pattern I want you to see:

Now remember, all of these series are equal to the function ex, because ex is its own derivative. The missing ingredients are the values of an. If we evaluate ex at x=0, we have e0, and anything to the 0th power is equal to 1. In the above series, when x is 0, everything except the leading term is also 0. So we have:

1 = a0 = a1 = 2a2 = 6a3 = 24a4

and so on. So with a little bit of algebra, you can figure out the value of any an. It's just 1 divided by the factor preceding the coefficient. But there's a pattern here. 24 = 4*3*2*1. 6 = 3*2*1. 2 = 2*1. The value of the coefficient is equal to 1 over the index of the coefficient multiplied by each integer lower than it. This is known as a factorial in mathematics and looks like this:

5! = 5*4*3*2*1 = 120

With that information in hand, we know what the power series of the exponential function is:

I've gone through this process once so that you don't think I'm pulling this stuff out of a hat, but you can do the same thing to find the power series of a lot of different functions, including the trig functions. For example, the power series of sin(x) is:

And the power series of cos(x) is:

Weirdly, the sine and cosine power series look kind of similar to the exponential function, but with terms missing and some negative signs thrown in. This curious fact turns out to be very important for connecting exponential and trig functions. Let's remember that the key to that connection is i.

Let's see what happens if we try to find the power series of eix rather than ex. To do that, we just replace all instances of x with ix in our series above. That gets us:

Hey, that means we're finding powers of i. But we already did that up above. That follows a pattern, so we can just fill in from that pattern and get:

Now, just for the heck of it, let's separate our series into terms without i and terms with i. So we have:

Look familiar? That's the power series for cosine plus i times the power series for sine. In other words...

Just as Euler told us.

All of this may seem like some kind of tedious mathematical trick. After all, how do we know that the power series representation of a function behaves identically to the function itself in all instances? The truth is, it doesn't, and that's one of the things you have to be careful of when finding series expansions. It does happen to work in this case, though.

But there are ways in which this proof can help motivate understanding. One way to think of the idea is that the introduction of i into the exponential function breaks the function down into four interacting parts: one increasing in the direction of 1, another increasing in the direction of -1, and two others increasing in the direction of i and -i. Different values of x contribute more to one direction than another, and the whole thing repeats with a period of 2πi.

To see if this picture holds true, let's take another look at the powers of i. We saw that powers of i cycle from i to -1 to -i to 1 and then back to i again. But we were only looking at integer powers of i. What happens if we replace the integer with an unknown variable x? That is, how do we evaluate ix?

A neat tool that can sometimes work in mathematics is to perform some operation on an expression and then also perform the inverse of that operation. Doing so doesn't change the expression, but it does let us look at it in a different light. So how about we take the natural log of ix and then exponentiate the expression. That gets us:

The laws of logarithms mean we can move that x to outside the log, giving us:

We know how to evaluate ex, but it’s not immediately clear how to evaluate ln(i). Here it's useful to remember what ln means. The natural log of some number is the power to which you must raise e in order to get that number. So if you have, say, ln(e2), then our answer is 2, because e to the power of 2 obviously equals e2. So let's look at it this way: e to what power equals i?

Now we bring in Euler's formula again.

eix = i when cos(x) = 0 and isin(x) = i

This is true for x = π/2, because cos(π/2) = 0 and sin(π/2) = 1.

So then ln(i) = iπ/2, which means that ix = eiπx/2 = cos(xπ/2) + isin(xπ/2). With that conversion, we can evaluate i to any power at all, not just integer powers. But to reaffirm that this isn't some trick, let's go ahead and see what evaluating it to integer powers means.

This is the exact same pattern we saw above, but this time through the lens of Euler's formula rather than the logic of manipulating √-1. For non-integer values of x, you get complex numbers that, when treated as vectors on the complex plane, are all a distance of 1 from the origin, creating a circle of radius 1. Through purely algebraic means, this connects back up with the geometrical interpretation of imaginary numbers suggested by Gauss.

Okay, I'm done now. I hope this sheds some light on the interconnectedness of math, which can be demonstrated by taking the rules you're familiar with and applying them to unfamiliar situations. When people speak of the beauty of math, this is it. In the real world, we often find depth and meaning through metaphors that connect disparate ideas. That's what art and literature are all about. Math does the same thing, but with numbers, letters, and funny symbols.

(On the other hand, I may have written this post just to play around with LaTeX.)