Friday, May 22, 2015

The Most Beautiful Equation in Mathematics

What follows is a bit I did over at Math StackExchange.  Posting it over here was an experiment in whether the mathematical typesetting would transfer correctly in a copy-and-paste.  For the most part, as long as I leave it alone, it seems to have done so (modulo the line breaks being lost in the shuffle).

Euler's equation

eiπ+1=0

is considered by many to be the most beautiful equation in mathematics—rightly, in my opinion. However, despite what Gauss might say, it's not the most obvious thing in the world, so let's perhaps try to sneak up on it, rather than land right on it with a bang.

It's possible to think of complex numbers simply as combinations of real values and imaginary values (that is, square roots of negative numbers). However, plotting them on the complex plane provides a kind of geometric intuition that can be valuable.


On the complex plane, a complex number a+bi is plotted at the point (a,b). Adding complex numbers is then just like adding vectors—(a+bi)+(c+di)=(a+c)+(b+d)i, for instance—just as you might have expected. (It's probably useful to draw some of these out on graph paper, if you can.)

Multiplication is where things get a little unusual. Multiplication by real values is just as you'd expect, generalizing from the one-dimensional real number line to the two-dimensional complex plane: Just as k times a positive number is (for positive k) another positive number k times as far from the origin, and correspondingly for negative numbers, k times a complex number is another complex number, k times as far from the origin, and in the same direction.

But multiplication by imaginary values is different. When you multiply something by i, you don't scale that something, you rotate it counter-clockwise, by 90 degrees. Thus, the number 5, which is 5 steps to the east (so to speak) of the origin, when multiplied by i becomes 5i, which is 5 steps to the north of the origin; and 3+4i, which is to the northeast, becomes −4+3i, which is to the northwest. And so on.



OK, let's step away from the complex plane for a moment, and proceed to the exponential function. We're going to start with the ordinary ol' real-valued exponential function, y=ex. There are lots of exponential functions: 2x,10x,πx,… But there's something special about the exponential function with e, Euler's constant, as its base.

If you graph y=ex, you get a curve that starts out at the far left, at (−∞,0) (so to speak), and proceeds rightward, crawling very slowly upward, so slowly that by the time it gets to x=0, it's gotten no further upward than (0,1). After that, however, it picks up speed, so that further points are (1,e),(2,e2),(3,e3),…, and by the time x=20, we've nearly halfway to a billion.

Another way to put that is that the derivative of y=ex, which you might think of as its slope, starts out as an almost vanishingly small number far to the left of the origin, but becomes very large when we get to the right of the origin.

To be sure, all exponential functions do that basic thing. However, the very unusual thing about y=ex is that its derivative—its slope, in other words—is exactly itself. Other exponential functions have derivatives that are itself multiplied by some constant. But only the exponential function, with e as its base, has a derivative that is exactly equal to itself.

It's very rare that an expression has that property. The function y=x2, for instance, has derivative (or slope) y′=2x, which is not equal to x2. But if you want to know the slope of y=ex at any point, you just figure out what y is, and there's your slope. At x=1, for instance, y=e≐2.71828, so the slope there is also y′=e≐2.71828.

The only functions that have that property have the form y=Cex, where C is any constant.

There's another way to think of the derivative that is not the slope, although it's related. It has to do with the effect that incremental changes in x have on y. As we saw above, the derivative of y=ex, at x=1, is also y′=ex=e≐2.71828.

That means that if you make a small change in x, from 1 to 1+0.001=1.001, then y approximately makes 2.71828 times as much of a change, from 2.71828 to 2.71828+0.00271828≐2.72100. This is only accurate for small changes, the smaller the better, and in this case at least is exact only in the limit, as the change approaches zero. That is, in fact, the definition of the derivative.



Now, let's return to the complex plane, and put the whole thing together. Let's start with e0=1. We can plot that point on the complex plane, and it will be at the point with coordinates (1,0). It's important to remember that this does not mean that 0=e1. The value of x is not being plotted here; all we're doing is plotting y=e0=1=1+0i, and that 1 and 0 are the coordinates of (1,0), which is one step east of the origin. By the unusual property of ex, the derivative is also 1.

Suppose we then consider making a small change to x=0. If we add 0.001 to x, we make a change to ex that is equal to the derivative times the small change in x. That is to say, we add the derivative 1 times the small change, 0.001, or just 0.001 again. So the new value would be close to (though not quite exactly) 1.001, which is represented by the point (1.001,0). It would be in the same direction from the origin—east—as the original point, but 0.001 further away.

But what happens if we add not 0.001 to x, but 0.001i? The derivative is still 1, so the incremental impact on ex is the derivative ex=1 times 0.001i, or 0.001i again. So the new value would be close to (though, again, not quite exactly) 1+0.001i, which is represented by the point (1,0.001). It would be 0.001 steps to the north of (1,0), because the extra factor of i rotates the increment counter-clockwise by 90 degrees.

Symbolically, we would say

e0.001i≐1+0.001i

Now, suppose we added another 0.001i to the exponent, so that we are now evaluating e0.002i. We'll do what we did before, which was to multiply the increment in the exponent, 0.001i, by the derivative. And what is the derivative? Is it 1, as it was before? No, since we're making an incremental step from e0.001i, it should be the derivative at 0.001i, which is equal to e0.001i again, which we determined above to be about 1+0.001i. If we multiply this new derivative value by the increment 0.001i, we get an incremental impact on ex of −0.000001+0.001i, which is a tiny step that is mostly northward, but which is also just an almost infinitesimal bit to the west (that's the −0.000001 bit). We've veered ever so slightly to the left, so the new estimated value at x=0.002i is

e0.002i≐0.999999+0.002i

One thing to observe about the small steps that we've taken is that each one is at right angles to where we are from the origin. When we were directly east of the origin, our small step was directly northward. When we were just a tiny bit north of east from the origin, our small step was mostly northward, but a tiny bit westward, too.

What curve could we put around the origin, such that if we traced its path, the direction we're moving would always be at right angles to our direction from the origin? That curve is, as you might have guessed already, a circle. And since we start off 1 step east of the origin, the circle has radius 1. Unsurprisingly, this circle is called the unit circle.

If we follow this line of reasoning, then the value of eiπ must be somewhere along this unit circle; that is, if eiπ=m+ni, then m2+n2=1 (since that's the equation of a circle of radius 1, centered at the origin). The only reason our estimated values weren't exactly on the unit circle is that we made steps of positive size, whereas the derivative is technically good only for steps of infinitesimal size. But where on the unit circle is eiπ?

The crucial observation is in how fast we make our way around the circle. When we made our first step, from x=0 to 0.001i, that step had a size, a magnitude, of 0.001, and the incremental impact on ex was also of magnitude 0.001. Our second step, from x=0.001i to 0.002i, was also of magnitude 0.001, and the incremental impact on ex was, again, about 0.001.

In order to get to eiπ, we would have to make a bunch of steps, whose combined magnitude total π. The result would be, if we reason as we did above, to move a distance π around the unit circle. Since the unit circle has radius 1, and diameter 2, its circumference must be 2π. Therefore, eiπ must be halfway around the circle, at coordinates (−1,0). That is none other than the complex value −1+0i=−1:

eiπ=−1

or, in its more common form,

eiπ+1=0

The foregoing is not, by any means, a rigorous demonstration. It's an attempt to give some kind of intuition behind the mysterious-looking formula.

Tuesday, May 12, 2015

Let's Play the Last Line Game!

Possible last lines for AMC's Mad Men.

Status Quo is God: "Don.  Don Draper."

Status Quo is God (subverted): "Dick.  Dick Whitman."

Wrong Series: "Everything is all right."

Pete Campbell Being Pete Campbell: "Oh Peggy."

Matt Weiner, You Should Be Ashamed of Yourself: "I'm faaaaaalllllliiiiinnnnnngggggg."

The Long Con: "I always thought my death would be meaningless, and whaddyaknow."  (And who do you think would say that, huh?  Hint: The actor's name rhymes with "flattery.")

It Was a Long Summer, Charlie Brown: "What are you talking about?  You never liked working here."

Some of these are serious, honest!  I figure I'll keep adding to this list, to enhance the chances I guess the real one by sheer numbers.

Wednesday, January 14, 2015

Facing the Facts and Missing the Forest

Bill Nye, he of Science Guydom, recently had this to say about creationism and evolution, and the debates between them.

I have mixed feelings about his position on debating creationists.  I sort of agree with him that there should be debate—although I view most televised debates as theatre without much illumination—but I think he goes about it in an ineffective way.

And it's sort of lampshaded immediately, in that link, in his explanation as to why people oppose evolution.  "I think humans have an unwillingness to face the facts...."  I think many of his answers are well considered and on point, but with that sentence right off the bat, you might as well dig trenches for everyone and tell them to settle in.  Nothing's going to make people more hostile to evolution than telling them they're only opposed to it because they're delusional.

One of the more illuminating ideas in Michael Shermer's Why Smart People Believe Weird Things is the notion that people generally do not arrive at their beliefs through a series of rational arguments.  They might construct rational arguments once they've arrived at a belief (and smart people are usually better at that, convincing not only others but themselves), but the order is usually belief first, rational argument second, and that goes for evolutionists and creationists alike.  Of course, we all have conclusions that we do reach through rational argument, and that tends to make us think that we do that as a matter of course—because rational argument is good, right?—but I got from Shermer the principle that that sort of situation is the part of the iceberg above the water, the part we're conscious of.  The part below the water, the unconscious part, is much, much larger.

There's no way to prove that, of course—it's a way to view the world, not really a testable statement (yet)—but I find it useful.  It explains a lot of things to me, such as why Nye in some ways got owned by Ken Ham in their debate: He tried to make the debate about facts.  To do so is reasonable at first blush, since the facts are on his side, I think, but wouldn't evolutionists suppose that if the debate were about facts, it would have been over a long time ago?  Nye claims that he, unlike previous scientists in his position, was not outcompeted or outmaneuvered, but I think he was, a bit, because he failed to adequately address what makes creationism compelling.  If Nye, and others, are genuinely interested in drawing people "across the fence" (or, at least, "off the fence"), they must convey something of the elegance and wonder of the scientific view.  Scientists often say that the scientific view is elegant and wonderful (and it is!), but it's not enough to say it; one must, I think, illustrate it in a vivid way that's not simultaneously a knock on creationism.

I think scientists in this debate fail to consider sufficiently what draws people to the creationist perspective in the first place.  What is creationism, after all, but a way to view the natural world?  There's a wealth of beauty and danger in the world; how did that all come about?  Creationism provides an explanation for the natural world that is straightforward, intuitive, and convincing, if only largely because most of its adherents were exposed to creationism before anything else.  With theories, as with people, first impressions matter, a lot.

In speaking with people who find creationism at least plausible, I sometimes ask them why they like it.  One common thread is that they like it because they enjoy the thought of the ubiquitous immanence of God (although they don't usually put it that way).  It reinforces the pleasure they get from believing in God; each biological oddity becomes yet another brick in the divine edifice, a reminder that God is once again just around the corner.  The constant refrain of God-did-it, far from being the vehicle of ridicule intended by evolutionists, is encouraging to creationists.  It proclaims God's pervasive influence in the universe.  If you're invested in believing in an all-powerful deity (and evolutionists generally say that they want to accommodate these people), honestly—why wouldn't you find that appealing?

Science has, to a large extent, not spoken loud enough on this matter.  In my more cynical moments, I feel that creationists intentionally draw evolutionists toward facts, not because they're too clueless to realize that their facts are wrong, but because they're insightful enough to recognize that it doesn't matter whether their facts are wrong.  Even if that's not the case, though, it behooves scientists to every now and then resist the siren call of facts, and speak more about why science is a beautiful way to view the world.

And it is beautiful, in my (admittedly biased) opinion!  If one thinks of creationism as a sequoia with God in the towering trunk and the various aspects of the natural world as branches going outward at every height, then science in general and evolution in particular is a web of unimaginable richness, with connections in every conceivable direction, splitting and rejoining and looping in almost infinite variety.  The strength of the sequoia is its enormous trunk, a monolithic invulnerability; that of the web is its deep interconnectedness, so that even if a few of its strands are found to be flawed (and they surely are, from time to time), the overall structure retains its integrity with room to spare.  A scientific theory can tie a wide array of observations together, and do it with a beauty that is utterly captivating.  Albert Einstein was famously convinced of the rightness of his general theory of relativity, not through observation, but through its elegance and beauty.

One of my favorite stories as a child was Aesop's fable of the fasces, so much so that I reference it all the time.  Maybe you know it: An old man demonstrates to his squabbling sons the strength of unity, of a single purpose, by showing how easy it is to snap a single stick, but how difficult it is to snap a lot of sticks bundled together.  I was struck by the moral when I first read it, but when I was rather older, I began wondering why one wouldn't simply split the bundle down its length.  As far as I could tell, one could put together sticks in a more connected way that would be much harder to break down significantly.  And I find in that a deep metaphor for how I see the world.

I do not know which of these views of the world is more beautiful in any inherent sense.  It's entirely possible that the guiding principle here, as elsewhere, is de gustibus non disputandum est.  But I feel quite confident that there is little to be gained with continued debate that does not engage, at a significant level, the profound and abiding manner in which the human mind cleaves to beauty and elegance.  It's why many of us became scientists, and it seems a shame that we don't spend more time sharing it.

Monday, January 5, 2015

Little's Result and the Baseball Hall of Fame


Today, in purely descriptive blog post titles...

Baseball Hall of Fame voters have been getting in their annual opportunity to gnash their teeth and/or practice their sanctimony, as a result of drugs that were first banned by the sport barely a decade ago.  It's become a thing, by which I mean that it is now possible to get all "meta" about it and write not only about the Hall of Fame itself, but also about the tooth-gnashing and sanctimony-practicing that goes on around the Hall of Fame.
Here is my "meta"; here are my two big thoughts about the Hall of Fame.

I have a principle about PEDs and the Hall of Fame that is conceptually simple but practically challenging. And that is, how do I think the player would have performed if he didn’t take PEDs? If I’m certain he didn’t take PEDs, then he would have performed as he actually did. If I’m certain he did take them, then I have to correct for how he would have performed without them. If I think there’s a chance he took them (but a chance he didn’t), there’s a correspondingly smaller correction.

With that in mind, I don’t think there’s a chance in hell (or anywhere, really) that, let's say, Barry Bonds isn’t a Hall of Famer. Even without PEDs, I feel confident that he’s a top-20 player. He might be better than that, but I don’t need to know that. That’s enough to put him in the Hall of Fame with room to spare.

Other decisions are harder than that, of course. But the most damning thing about the "no PEDs in the Hall of Fame" rule of thumb is the same thing that damns so-called "zero-tolerance rules": it relieves us of our need to make judgment calls. To think. If we deny ourselves of that, why even have human voters? Why not just set a machine to the task and leave it at that? And my answer to that is, because we want and crave human approval. Well, I don’t know about anyone else (that’s a lie), but I’d like my approval to come from humans who at least exercise a bit of thought and reason in the matter.

Here’s another thing, which just got called to my attention: the ten-year limit on player eligibility. When I was just a wee lad in late youth, I’d wonder why it was that the player vote percentage would inch up slowly year after year until they either made it in, or were ruled ineligible after ten years. The other possibility—that they would be removed from the ballot after not getting enough votes—that made sense to me. But the other one was mystifying, at first.

In time, of course, I figured it out. Because of the other limit, on the number of players one is allowed to vote for, there’s limited space in the pipeline, so to speak. I received my training for my day job in a fairly abstruse field called queueing theory. It’s essentially the study of waiting in lines, and although it has some applicability to computer networks (which is indeed why I took the course), it’s usually the class that people try to avoid taking.

Nonetheless, there’s a result of queueing theory which is extremely important, is broadly applicable to fields way outside computer science, and which ought to be known by anyone who tries to make things more efficient. It’s called Little’s Result (or Little’s Law), and it is usually taught within the first six weeks of queueing theory. It goes as follows:

In any system, at equilibrium, the average number of things in that system equals the average rate at which things enter the system, multiplied by the average time they spend there.

That’s it. And as evidence that it’s applicable to lots of things, I’ll apply it to Hall of Fame voting. Voters can vote for ten players, but in order to make it into the Hall of Fame, players must receive 75 percent of the vote. Roughly speaking, that means that each year’s class can contain no more than about 13 players, and that assumes that all of the 13 players receive almost exactly 75 percent of the vote (13 times 0.75 = 9.75, leaving about a quarter vote for the remaining eligible players). Each player can stay eligible for ten years at most.

That means that at best, there’s room for 13 times 10 = 130 players in the pipeline. Everyone else will be squeezed out. And it also explains why player vote percentages inch up; the voters have to vote for players earlier on in the pipeline, to get them out of the system before they can vote in the more recent players. They have to vote for the younger players just enough to keep them eligible. This is defensible, by the way; if you just allowed people to vote for however many players they wanted to, you’d have no control on the overall consistency of the selection. More generous voters would have disproportionately more influence on the result than more selective ones.

That’s theory. In practice, of course, it’s lower than 130; I’d be surprised if it was as high as 100. Well, you might say, that’s OK. If a hundred players was good enough for Ted Williams’s time, it ought to be good enough for ours, right? All other things remaining equal, to be sure.

The problem is, all other things have failed to remain equal! The biggest culprit is expansion. In Williams’s day, the league contained sixteen teams. (Williams was voted in in 1966, when there were twenty teams, but he didn’t compete against players active in 1966; he competed against players active much earlier.) The number of players retiring to become eligible for the Hall of Fame was probably about a hundred a year—again, a number you can ballpark with Little’s Result.

Today’s league contains thirty teams, nearly twice the number in Williams’s day. A smaller but still not neligible factor is the increasing specialization in the league. There are more players playing a significant role on teams (especially with the pitching staff). The number of retiring players is therefore about twice was it was before, about 200. But here we are, trying to shoehorn all those extra players into the same pipeline we had back when the league was much smaller.

Little’s Result also tells us what you need to do to expand the pipeline. If you want to scale it to the size of the league, then you just need to expand the vote limit and the time limit enough to double the pipeline. You could expand the number of votes to 20. Or you could expand the time limit to 20. Or you could expand them to 12 and 15, and make up the difference by reducing the vote requirement to 70 percent. But keeping them the same artificially raises the bar for entry into the Hall of Fame, unless you think today’s league draws from a talent pool no larger than before, despite baseball’s growing internationalism and the world population boom.

I still care about the Hall of Fame, too. I’d rather care about a better product, but I’m human and can’t help myself: I’ll probably always care about the Hall of Fame.