helen99: Wow... (no words) (Wow)
helen99 ([personal profile] helen99) wrote2009-03-19 12:00 am

The Math of XKCD

A while ago, This Story appeared in Blogspot, posted by someone who was having a problem with Verizon billing. Apparently they thought he owed them a lot of money, when in fact he had not been a customer for five years, and furthermore, they owed him money according to his calculations. After this had gone on for a long time, it came to the attention of the author of XKCD, who became ... inspired.

Here is his inspiration: http://xkcd.com/verizon/

The check is written for an amount which contains the number "i", a.k.a., the square root of negative 1. Therefore the amount of the check would be called an 'imaginary' number in mathematical terms (because there is nothing you can multiply by itself to get -1). This should not be a problem, however, because the amount Verizon was charging was also imaginary...

Edit: From the comments, we see that the equation actually resolves to a real number that Verizon can spend whichever way it wants:

"Ah, but e^(i*pi) = cos(pi) + i*sin(pi) = -1 + 0i = -1.
And the infinite sum resolves to +1
So in fact he wrote them a check for two tenths of a cent.
That, of course, would require Verizon to do math to figure out."

XKCD - brilliant as usual.

Brought to my attention by way of [livejournal.com profile] lindsaybits

[identity profile] chiashurb.livejournal.com 2009-03-19 12:16 pm (UTC)(link)
Ah, but e^(i*pi) = cos(pi) + i*sin(pi) = -1 + 0i = -1.

And the infinite sum resolves to +1

So in fact he wrote them a check for two tenths of a cent.

That, of course, would require Verizon to do math to figure out.
ext_5300: tree in the stars (Default)

[identity profile] helen99.livejournal.com 2009-03-19 12:46 pm (UTC)(link)
The cosine of Pi plus i times the sine of Pi equals -1+0i? (I haven't done that level of math since about 1980...) I'd be interested in seeing the interim steps if you have them handy or know them by memory. (Where's my spiffy, 300-function reverse Polish calculator when I need it...)

Edited to include an entire piece of the equation that my brain omitted, heh.
ext_5300: tree in the stars (Default)

[identity profile] helen99.livejournal.com 2009-03-19 02:48 pm (UTC)(link)
In which I answer my own questions.

e^(i*pi)=-1
Cos(pi) = -1
Sin(pi) = 0
Where's my spiffy 300-function calculator

I'm still not sure how/why e^(i*pi)=-1=cos(pi), though.

i*i = e^(i*pi)? How?

ext_5300: tree in the stars (Default)

[identity profile] helen99.livejournal.com 2009-03-19 03:45 pm (UTC)(link)
#7 on this page sort of explains it.

"... ln(x) is the inverse function of e^(x) (they are mirror images of each other on an x-y axis). But also there is no ln of a negative number. ln(-1) = i*Pi, which is not a real number but an imaginary number. That means that e^(i*Pi) = -1 by definition of logs."

So from what I can understand of the above, ln(-1) = i*pi. This means that e^(i*pi) = -1, since that's the way ln(y) and e^(x)=y work. I still don't know why, though. The closest that explanation came was that "this is the definition of how ln(x) (the base e logarithm of some number) works".

I still didn't get it, though. I went to a more extensive web page on the subject.

http://library.thinkquest.org/27512/c5i.html

Heh. I should have known it involved infinite series. Nothing with e and i in it will be anything but infinite.

apparently it's a famous equation:


" The five most important constants of Mathematics are e, i, pi, 1, and 0.

Euler's constant (e), the imaginary number, pi, one, and zero. All these numbers appear throughout Mathematics providing us with the ease of calculation and expressing certain Mathematical statements.

These five constants are combined in the following equation:

ei*pi + 1 = 0


========================================================
Here is the derivation.

Take a Taylor series.

A Taylor series expansion about a point x = a is a power series expansion that's useful to approximate the function in the neighborhood of the point x = a. If a function f has derivatives of all orders at a, then the Taylor series for f about x = a is:

The Sum from k=0 to Infinity (fka/k!)(x-a)k = f(a) + f'(a)(x-a) + (f"(a)/2!) (x-a)2 + ... + (fna/n!) (x-a)n + ...

The case of the Taylor series for a=0 is the Maclaurin series, shown below:

Sum from k=0 to Infinity fk0/k! (x)k =
f(0) + f'(0)(x) + (f"(0)/2!) (x)2 + ... + (fn(0)/n!) (x)n + ...

To find the Maclaurin series about a=0 generated by f(x) = ex:

First, we find the derivatives of ex and compute their values at x=0.

f(x) = ex --> f(0) = 1
f'(x) = ex --> f'(0) = 1
f"(x) = ex --> f"(0) = 1
f"'(x) = ex --> f"'(0) = 1
f(4)(x) = ex --> f(4)(0) = 1
...
f(n)(x) = ex --> f(n)(0) = 1

Next, if we plug these into the formula for Maclaurin series, we will generate the Maclaurin series that goes like this!

The Sum from k=0 to Infinity xk/k! = 1 + x + x2/2! + x3/3! + x4/4! + ...

This series is called the Maclaurin series for ex.

A Complex number is a number of the form a + bi where a and b are real numbers and i = sqrt(-1). If we substitute x = i * theta (theta is real) in the Maclaurin series for ex and use the relations:

i2 = -1,

i3 = i2i = -i,

i4 = i2i2 = 1,

i5 = i4i = i,

...

and after simplifying the result, we obtain

ei*theta = 1 + i*theta/1! + i2*theta2/2! + i3*theta3/3! + i4*theta4/4! + i5*theta5/5!

ei*theta = [1 - theta2/2! + theta4/4! - theta6/6! + ... ] + i[theta - theta3/3! + theta5/5! - ...]

or

ei*theta = cos(theta) + i*sin(theta)

This equation is called the Euler's formula.

When we substitute pi for theta we get :

ei*pi = cos(pi) + i*sin(pi)

which is equal to :

ei*pi = -1

Hence,

ei*pi + 1 = 0

====================================================

So I kind of see how they get it, but I doubt I could reproduce this on a test unless I memorized the sequence exactly. There's a bit of a jump between "Maclaurin Series" and "the sine and cosine of theta" that I'd have to review trig to understand.
ext_5300: tree in the stars (Default)

[identity profile] helen99.livejournal.com 2009-03-19 04:58 pm (UTC)(link)
Ah, that graph explains why this particular value of the Maclauren series acts like sine and cosine waves. ok. Thanks.
ext_5300: tree in the stars (Default)

[identity profile] helen99.livejournal.com 2009-03-19 05:38 pm (UTC)(link)
Haha! This same question was asked by a high school student because of a Simpsons episode. That's an incredibly cool event for all the wrong reasons! lol!

The author of the page immediately introduces a new question:

"So now, the question is, why is e^ix=cos(x)+isin(x) the "right" thing to define what e raised to an imaginary power means?"

Yep, he hit it on the head. I'll find the calculus derivations somewhere, but I like graphs to help wrap the brain around it.

[identity profile] chiashurb.livejournal.com 2009-03-19 05:45 pm (UTC)(link)
Yeah, it has to do with identities of infinite series.... I have it all in notes at home somewhere, but it's been years for me too.
ext_5300: tree in the stars (Default)

[identity profile] helen99.livejournal.com 2009-03-19 06:09 pm (UTC)(link)
Here we go:

Lemma: sinx = x - (x3/3!) + (x5/5!) - (x7/7!) + ...

Derivation:

Let f(x) = sin(x) --> f(0) = sin(0) = 0

f'(x) = cos(x) --> f'(0) = cos(0) = 1
f''(x) = -sin(x) --> f'(0) = 0
f'''(x) = -cos x → f'(0) = -1

From this, we see that:

fn(0) = 0 if n is even.
fn(0) = 1 if (n-1)/2 is even
fn(0) = -1 if (n-1)/2 is odd

Putting this all together gives us:
sin(x) = (x/1)(1) + (x2/2!)(0) + (x3/3!)(-1) + ...

QED

Lemma: cos x = 1 - (x2)/2! + (x4/4!) - (x6/6!) + ...

Derivation:

Let f(x) = cos x

f(0) = cos(0) = 1
f'(x) = -sin x → f'(0) = 0
f''(x) = -cos(x) → f'(0) = -1
f'''(x) = sin x → f'(0) = 0

fn(0) = 0 if n is odd.
fn(0) = 1 if (n/2) is even
fn(0) = -1 if (n/2) is odd

Putting this all together gives us:
cos(x) = 1 + (x2/2!)(-1) + (x3/3!)(0) + (x4/4!)(1) + ...

I can see where these series are behaving exactly like sine and cosine waves, just like the graph.

[identity profile] rebelfilms.livejournal.com 2009-03-19 01:11 pm (UTC)(link)
wonderful!

[identity profile] ahril.livejournal.com 2009-03-20 01:56 am (UTC)(link)
Verizon is Ev01, and has been since it was born backwards from what used to be good 'ol AT&T and then promptly proceeded to gobble up all the Baby Bells like my dear old Chesapeake & Potomac. Remember C&P Telephone?

That is a very cool way to mess with them. The Network = Borg, anyway.

However, I think several of my brain cells have suffered Death by Math now.
ext_5300: tree in the stars (Default)

[identity profile] helen99.livejournal.com 2009-03-20 02:07 am (UTC)(link)
I remember C&P Telephone. That was back before companies had to hire consultants to devise odd names for them so their domains wouldn't be already taken on the internet. Hence were spawned "Verizon," "Wachovia," and others, all of which sound like they were trying to be actual words, but met with some kind of disfiguring accident along the way...

Sorry about the Death by Math - I got carried away trying to solve a Puzzle...

[identity profile] ahril.livejournal.com 2009-03-21 01:41 am (UTC)(link)
Oh it's not your fault. My brain never did speak Math, and flat out refused to try to translate any further than about halfway through Algebra I.

It is one reason why I went to art school. :)