Sunday, 31 August 2014

Visualizing Euler's Identity

Euler's Identity is often considered the most beautiful equation in mathematics because it elegantly combines one each of 0, 1, i, e, π, addition, multiplication and exponentiation. But intuitively, what does it mean?

Answering that requires a brief tour of exponential growth (to understand e) and complex numbers (to understand i and π). My previous post on complex numbers is here.

e, or Euler's number, is a mathematical constant (approximately 2.72) that represents 100% continuous growth when starting at 1. For example, 100% compound interest on $1 for a year would be e in dollars, or $2.72. With continuous growth, the interest is calculated at every instant as compared with yearly (where you would only end up with $2), quarterly ($2.44), monthly ($2.61) or daily ($2.71). The formula for calculating compound interest is:
  (1) compound interest = (1 + 1 / time periods)time periods
And e is the limit that is approached as the number of time periods increase.

e is used to calculate continuous growth for any rate, time period or starting point. So 10% compound interest on $1,000 for 3 years would be $1,000 * e 0.1 * 3 = $1,349.86. The formula is:
  (2) final amount = initial amount * e rate * time periods
If we know the initial and final amounts but not the interest rate, then the natural logarithm function is used, as follows:
  (3) rate = ln(final amount / starting amount)
The natural logarithm of a number is the exponent that e is raised to in order to get that same number. For example, 2 = e0.69, so the natural logarithm of 2 is 0.69. That is, the compound interest rate required to grow from $1 to $2 in 1 year is 69%.

This is where I think things get interesting! Any number can be interpreted as the end result of continuous growth starting from 1, that is:
  (4) number = e ln(number)
This same idea can be applied to numbers with exponents. For example, 23 can be understood as 1 growing to 2 at a rate of ln(2) (or 69%) and then again to 4 and finally to 8, for a total of 3 growth periods. That is, 23 = e ln(2) * 3. Generalizing, we get:
  (5) number time periods = e ln(number) * time periods
In geometric terms, continuous growth can be visualized as a scaling operation on the real number line (i.e., the distance travelled in each growth period is increasingly larger, as with 1, 2, 4, 8, 16, ...) However if a logarithmic scale is used for the number line then the distance travelled in each growth period will be the same (the equidistant points can be marked as 1, e, e2, e3, ...)

As with real numbers, imaginary numbers also can be interpreted as the end result of continuous growth starting from 1. However instead of exponential growth along the real number line, imaginary growth follows a linear circular path around the origin on the complex plane. The reason the growth is linear is because the scale is logarithmic with a growth rate of i represented by an angular distance of 1 radian. You can see this linearity when multiplying by i. 1 multiplied by i rotates 1 by π / 2 radians (90 degrees) to i and multiplying by i again rotates a further π / 2 radians to -1.

To summarize, a growth rate of 1 (or 100%) results in growth from 1 to e1 on the real number line, whereas a growth rate of i results in growth from 1 to ei on the complex number plane - a distance of 1 radian around the unit circle (see the diagram below).


Similarly, a growth rate of 2i will travel 2 radians from 1 to e2i. A growth rate of π / 2i will travel π / 2 radians to e π / 2 i or i. A growth rate of π i will travel π radians to eπ i or -1. And a growth rate of 2π i will travel all the way around the unit circle to arrive back at 1.

That second-to-last calculation is Euler's Identity: e π i = -1. It just means that starting at 1 and growing at an imaginary rate of π (via an anti-clockwise rotation), we will end up at -1 on the real number line. A way to remember this is that if you deposit $1 in a bank offering π imaginary interest, you'll end up owing them $1 after 1 year! Fortunately, if you wait for another year, you will get your original money back...

The basic formulas for calculating real growth can easily be applied to imaginary numbers. The key insight is to transform the number to base e and then the growth rate will be expressed in the exponent (as imaginary or real). Some further fun equations to end this post.
  (a) 23i = e ln(2) * 3i = e 0.69 * 3i = 2.08 radians
Start at 1 and grow at a 69% compound rate three times for a distance of 2.08 radians.
  (b) i = e ln(i) = e π / 2i = π / 2 radians
Start at 1 and grow at a rate of π / 2 radians to arrive at i.
  (c) i2 = e ln(i) * 2 = e π / 2i * 2 = e π i = π radians = -1
Euler's Identity derived from the complex number identity i 2 = -1.
  (d) ii = e ln(i) * i = e π / 2 * i * i = e π / 2 * -1 = e -π / 2 = 0.21
Start at 1 and grow at a rate of -π / 2 to arrive at 0.21.
  (e) (ii)i = e ln(ii) * i = e ln(e -π / 2) * i = e -π / 2i = -i
Start at 1 and grow at a rate of -π / 2 radians to arrive at -i.

Wednesday, 20 August 2014

Lunchbox game theory

A practical lesson in game theory: the three-person game.

When helping the kids pack yoghurt for their lunch boxes, I found there was only strawberry yoghurt left in the fridge in the tear-off individual containers. Their preferred yoghurts, mango and vanilla, were finished.

So I asked Liam to grab new yoghurt from the garage fridge. He came back with two large containers (there were no tear-off packs left) which happened to be mango and vanilla. Since we could only open one of them, I asked Liam which one he wanted.

"Mango."

Liam then asked Michelle the same question, who replied, "Vanilla."

I said, "Sorry, we can only open one. So which one will we have?"

Same responses.

"Michelle.", I said, "We can only have one, so how about we have mango this week?"

"No!", she says, "I want vanilla!", as she starts to melt down.

"OK, Liam.", I said, "How about we have vanilla this week, since it seems to be important to Michelle?"

"No!", he says, "I want mango and I said it first!", as he also starts to melt down.

"OK.", I said, "Since you can't agree, I'm going to put them away and you can both have strawberry today."

"Noooooooo!"

OK that was traumatic. Unfortunately, in addition to the yoghurt wars, I see that tomorrow we will only have one bread roll left and one of the kids will have to have sliced bread...