driving is kind of crazy

December 1st, 2008

It can be fun to ask yourself questions that help re-think our world. An example:

Suppose an advanced alien civilization discovered our human life on earth, and studied it carefully. There would certainly be some things that stand out to them as particularly strange, ironic, or just stupid. Which things would stand out?

I’m willing to bet that our current modes of popular transportation would stand out — in particular, driving a car somewhere (as opposed to taking a trian, boat, or plane).

Why? Let’s evaluate the danger of an action, very approximately, as the frequency you take this action multiplied by the probability at any point during the action that you will become seriously injured, mauled, and/or deadified. On average, this is basically proportional to the number of “man-made” fatalities caused per year in the course of performing an action (I say man-made as opposed to pre-existing medical conditions — otherwise, we would have to say “having a beating heart” is a dangerous action, since many people have heart attacks).

Along this line of reasoning, it stands out immediately that driving (or being a passenger in a car) is the single most dangerous activity you’re likely to perform on a regular basis. And, if you think about it just a little bit, it’s not so surprising.

Let’s add another test to help discover perilous conducts: does being drunk make the activity stupidly dangerous? Clearly, this is not true for 99% of the actions you take every day. You can read your email while drunk, you can walk around your house, you can listen to music, eat food, watch movies, try to do paper work, chat with friends, play with your dog or cat, read a book, sing karaoke, dance, or play games while drunk without any danger to your person. Yet, clearly, drunk driving is so dangerous that it is a serious legal and societal offense.

I don’t seriously expect anyone’s behavior to change in light of these thoughts — I still drive around all the time. But it continues to surprise me to apparently be alone in considering driving, while pragmatically necessary, a highly precarious practice. Certainly we can imagine worlds in which people move about in some way where a strong twitch at the wrong moment can’t kill anyone. Packets of information fly around the world following routing protocols and get safely where they’re going. Snail mail networks provide another huge and relatively safe means of transportation. Passenger trains, boats, and planes are operated by professionals under careful coordination with much lower risk of collision and higher standards of maintenance. Why not cars?

fairness is contageous

October 31st, 2008

Here is a trick to simulate a coin toss between two people if both of you are caught coinless: each person secretly chooses a number, either 0 or 1, and both announce their choice simultaneously. If both numbers match, this is heads; otherwise tails.

This idea can give surprisingly fair (i.e. close to 50/50) results.

Suppose you choose fairly, but your so-called friend is nefarious, and chooses their number in any non-50/50 manner. For example, they could always choose 1, or always choose 0, or always try to predict your answer and choose the same number as you.

As long as you choose fairly, though, the ultimate answer will also be exactly fair. Why? No matter what your friend chooses, you’ll choose either the same or the different number with 50/50 probability. If you’re really choosing your number fairly, then there’s no way for your friend to make any kind of prediction (by the way, this unpredictable property is one way to think about probabilistic independence).

Of course, the situation is symmetric: if your friend plays fair, then the ultimate outcome is fair, too, no matter how nefarious you are. Fairness trumps nefarness.

Even cooler: even if you both play unfairly, though still independently, then the ultimate outcome will still be more fair than either of you would have been acting on your own. The math on this is pretty simple.

Suppose you choose 0 with probability 1/2 + b1, and your friend chooses 0 with probability 1/2 + b2. I’m writing the probabilities this way because it makes the calculations easier. We can think of the b‘s as the “bias” of each person’s randomness. A bias closer to 0 means a more fair result — closer to 50/50.

Using b1 and b2, what is the probability that the outcome will be a match? It’s Prob(both heads) + Prob(both tails) =


(1/2 + b1)(1/2 + b2) + (1/2 – b1)(1/2 – b2) =
1/2 + 2b1b2.

In other words, the combined bias is 2b1b2. Notice that each individual bias is in the range [0, 1/2], so the combined bias is also in that range. Also notice that, if both biases are < 1/2, then the combined bias is less than either individual bias. This is what I meant by saying that the combined outcome is more fair than either player alone.

In fact, things are a lot more fair since this is a multiplicative effect. Suppose you’re sitting around with the unshakable urge to produce fair random binary digits. Alas, you empirically discover that you seem to choose 0 with probability 60%, and 1 the other 40% of the time. What are you to do??

Just write down a few random 0/1′s in a row, and take the XOR of this list of numbers. This is just a slight generalization from the above 2-player version. (By the way, this is the same as giving an ultimate outcome of 1 if there are an odd number of 1′s in your sequence; 0 otherwise.) If you started with bias b, then taking the XOR of n bits in a row will give you an ultimate answer with bias (2b)n/2.

Why? We can confirm this formula by repeated application of the above derivation that 2 players end up with combined bias 2b1b2. The sequence of biases for a single player looks like this:


b → 2b2 → 4b3 → … → (2b)n/2.

To get an idea of how incredibly useful this convergence is, suppose that your personal bias is b=60%, and that you want to be within 1 millionth of perfect fairness. How many times n must you perform a single (60%-biased) choice in order to arrive at an XOR which is this close to perfect fairness? Only nine times! This works because (2*.1)9/2 < 1/1,000,000. If you ask me, this is a pretty small price to pay to go from a 10% bias down to 0.0001%.

exposé: poorly Lego’d Eggos

September 22nd, 2008


It’s always interesting when a new mix of two different worlds pops up. Remember when Drew Barrymore married Tom Green? Sometimes these things work out – like the glory of rock stardom and video games. Other times the result is disturbing and creepy – like anime and ronald mcdonald.

I try to be optimistic, so I was pretty excited when I found out Eggo had released a Lego-themed waffle. At long last, food I can legitimately play with! This was awesome – two things I really enjoyed as a kid (and still do, though less often) – creativity and edibility, all in one.

Imagine the profound depths of my chagrin when I discovered the horrible truth. Gentle reader, let my folly be your tale of caution:

You can’t actually build anything with Lego Eggos.

Someone, somewhere along the way made an unspeakably heinous design decision and decided that three holes on the bottom of the wafflebricks would fit just fine with the 8 pegs on top. Please refer to the photographic evidence.

Why?!?!? As a mathematician, I can attempt to quantify the magnitude of this engineering catastrophe with a simple formula:

8 pegs + 3 holes = WTF

As you can see, these wafflebricks do not stack any better than standard waffles.

You have been warned.

mistaking your wife for a hat

August 30th, 2008

In 1985, neurologist Oliver Sacks published the book The Man Who Mistook His Wife for a Hat – a collection of 24 essays exploring fascinating case studies in neuropsychology. The title essay describes a man suffering from a form of visual agnosia – a result of brain damage in which vision is intact, but comprehension of vision is impaired.

For some reason, the man in question is able to see and understand the general shape of things, but has immense trouble “seeing” people and certain other things. The most curious example is the case when, as the man was leaving an office, he searched for his hat, and apparently attempted to remove his “hat” from the top of his wife’s head. Since he could understand that the top of her head was hat-shaped, he surmised that it must be the hat he was looking for.

In another case, he was easily able to recognize a wristwatch. Yet, when he was shown a glove, he had a great deal of trouble calling it a “glove”, or recalling its function. Instead, he was able to very accurately describe its general shape – a flexible series of tube-like structures ending in half-spherical tops, all joined at one end with a hole. In general, he had a great deal of trouble recognizing people and familiar faces, including his own wife.

I would like to add a hypothesis to the essay: that this form of agnosia suggests a neurological dichotomy between recognition of organic vs inorganic objects. Basically, this story fits the idea that there’s one part of the brain designed to recognize many natural objects – faces, hands (& gloves), dogs, cats, etc – and another part designed to recognize artificial or learned objects – wristwatches, tubes, cubes, etc. Such a dichotomy also makes sense evolutionarily, since brains that had built-in recognition of things that it could “evolutionarily know” were around, such as familiar human faces, would have a great survival advantage. The human race probably hasn’t had wristwatches long enough to evolve a glob of neurons just for them, so we may store the visual recall center for watches in a more learning-oriented part of the brain.

By the way, if you have any interest whatsoever in curious neuropsychological phenomena (who doesn’t??), I highly recommend Sack’s book. It also includes a case of a “Jimmy G.” who suffers from Korsakoff’s syndrome (to simplify – severe amnesia) which I’m guessing was an inspiration for the (very cool) movie Memento; and another case about an elderly woman who’s happy to be suffering the tertiary stages of a usually fatal disease, which I’m guessing was an inspiration for a certain subplot in an episode of House, MD :)

PS Tangent: why does it “sound wrong” to say “an usually fatal disease” when I know that’s grammatically correct?

should considered harmful

July 17th, 2008

When I was young, I learned a few words to never say. The entire concept of “bad words” always seemed funny and weird. It really doesn’t make much sense to disallow the utterance of a few key phonetic components, as if these somehow could really be inexcusably more offensive than other more coherent and meaningful strings of sound.

As I’ve played with the character of a personal dialect, I came to my own decision to swear less because, often, swearing simply means you couldn’t think of a more articulate way to express yourself.  To stretch an analogy, swearing is to communicating as drinking is to having fun.  It might seem cool when you first try it, but in the end it’s more a pain than a panacea.
Finally getting to the point: this post is not all about the classically crude curses, but rather about the existence of a few choice words – well, one in particular so far – that might actually deserve all the hullabaloo of a terminological taboo: the word “should”.  It is extraordinarily easy to invoke this word as a means of detached and elitist censure.
So what makes a truly bad word?  I proffer that a word which strongly implies, or depends upon, the acceptance of questionable ideas as a basis for its meaning, is a word which allows for easy abuse.  In the case of should, the questionable idea is that of either a universally-agreed moral code, or a moral expert.  A phrase like “you should never burp at dinner” carries with it the weight of unjustified authority.  In fact, such advice might leave you a rude dinner guest in some cultures.
To be constructive, let’s consider what can be said instead.  If you want to avoid the embarrassment of someone new to the dining customs of the U.S., you might say that many American hosts consider it rude to burp loudly during meals.  If you’re teaching your child about your moral position on theft (let’s assume you’re against it), you could explain the legal, material, and emotional consequences of stealing, along with your own personal disapproval.  If you have your own moral decisions that you’ve reached rationally, then it’s always possible to express yourself without resorting to vague implied universal standards.
Am I so vulgar as to say you should never say should?  Absolutely not — I’m really trying to emphasize personal choice and rationality here, after all.  So, with respect to any readers who chuckle at such lexical eccentricities, this post aims at nothing more than a reminder to speak responsibly :)

Turning a convex partition into a Voronoi diagram

June 29th, 2008

[New wiki page on Voronoi diagrams]

A Voronoi diagram (named after Russian mathematician Georgy Voronoi, 1868-1908) is a partition of space based on a set of points. This is the main idea: we are given a set – usually small and sparse – of points which we’ll call Voronoi centers. Let’s suppose that each of these center points has its own color. Then we can color all of space by coloring any point according to the center it is closest to.

In the figure here (from wikipedia), each black dot is a Voronoi center, and the cells are colored accordingly.

It’s easy to think of some places where we might see similar patterns in nature. For example, the shapes on a turtle’s shell, or the hexagons of a honeycomb resemble Voronoi diagrams. Close-packed living cells sometimes do as well, maybe because as they became further squished together, their boundaries approached a shape optimized for packing.


You might notice that every cell in a Voronoi diagram is convex - it is a shape without “dents” – every line between two points in a Voronoi cell is contained within that cell (contrast this with, say, pac man). So every Voronoi diagram is a convex partition. Is every convex partition also a Voronoi diagram? No! In fact, there are many ways to draw a convex partition which is impossible to represent as a Voronoi diagram (see the wiki for some details).


But for those convex partitions which allow a Voronoi diagram, how hard is it to find the corresponding center points? With the right algorithm, it’s not so difficult. Here’s the main idea: draw a circle around some intersection of three boundaries in the convex partition, pick a random point, and reflect it around the boundaries. After reflecting three times, take the average of this point, and the starting point, along the circle. What you get is a working Voronoi center for that intersection. Reflect this point around to find the other two centers (if you reflect it three times, you’ll just get back to your original point). Check out the figure.

Once we have candidate Voronoi centers for any two adjacent 3-intersections, you can expand the circles on which these centers exist until the centers line up. These centers are guaranteed to be the correct unique center for their cells (assuming that the convex partition is a Voronoi diagram). From here, just reflect the centers over the neighboring boundaries of the partition to find all other centers.

This is just a quick summary of a few of the thoughts on the wiki page.

Company ToDo: Something New

June 2nd, 2008

Let’s imagine: tomorrow your employer dissolves. All corporate assets are split evenly among all employees, and everyone is told to work for themself, or in a group of former co-workers. Would the innovation in your sector get better or worse?

Let’s call this hypothetical post-employer innovation your company’s creative baseline.

A lot of companies follow goals that look like this: make money by solving problems we can get paid to solve. Often, they think this way because it’s just a job to most employees — including executives.

Without any serious experience or business degrees to justify my claims (well, beyond some raw rationalization below), I’m going to propose the following business paradigm:
1. Do one thing very well
2. Keep your creative baseline high
3. Exceed your baseline

Of course, these ideas go together. You could always claim 1 as your ultimate goal, and argue that money and innovation are just subgoals to keep doing that one thing really well, for more customers, over a longer timespan.

But it seems as if a lot of companies aren’t thinking about 2 and 3.

Keeping your baseline high means working with people who think for themselves – and are good at it. If you’re hiring people you couldn’t imagine as worthy competitors, why are you expecting anything more from them at your company?

Exceeding your baseline is even trickier. But this is the fundamental idea of growing a company in the first place – you can do better together than you could apart. The problem is that an employee, as opposed to a founder, inherently has less freedom and less accountability for their contributions. At the same time, you can offer them access to invaluable resources they’d probably miss on their own: capital, an existing corporate reputation, and each other.

Why should these goals, among the plethora of proffered principles, be singled out?

Because stagnant and errant businesses die, but sectors keep on going. Company Old doesn’t disappear because customers stop caring about a general problem they need solved — it gets replaced by Company New that offers a better approach. The golden ticket for Company Old to avoid replacement is to employ the creative minds that can create the new – and to enable them to build Company New from within.

wiki time

May 16th, 2008

Have you ever wanted to put something very silly, esoteric, zany, or just very poorly edited on wikipedia, but never bothered because you knew it would be removed immediately anyway? I know the feeling. But now at long last is your chance to edit a very new, wide-open, and very-poorly-edited wiki!

Introducing the thinking blog’s wiki.

To get things started, I’ve added a few brainteasers. Add your own! Or anything you’d like! Enjoy.

a measure of civilization

May 7th, 2008

civilization = opportunity available to every individual

It might be good to have a way to measure civilization, since it’s certainly something we want to improve throughout the world, and (a fact which I think is often overlooked), things are not always improving. If you compare the enlightened advances made by Greek polymaths and efficient Roman administration to the backwards thinking and atrocious living conditions of the dark ages, you might be able to imagine how such a relative change might still occur from our current seemingly-secure quality of life. It’s not an Orwellian dystopia or world war III we should fear so much as it is a gradual and subtle shift of cultural and moral attitudes toward dogmatic, authority-based, or mystically-inspired modes of “thinking”.

The point is that we should keep our eyes open to how well the world is doing.

Of course, there are too many factors and subjective terms to immediately quantify “civilization” as if it were some kind of test score. Nonetheless, numbers, as objectively defined as is reasonably possible, are less likely to fall prey to misinterpretation.

So how can we quantify opportunity? As any engineer is likely to suggest, when you’re trying to improve the overall performance of a complex system, it’s a good idea to start with the bottlenecks – the pieces that are holding everything else back.

With that in mind, I propose that we could currently use the number of years of wasted life as a number for how much the world could be improved. It will be a great day when we can pragmatically measure opportunity and civilization in some more optimistic terms, such as average years of education per individual, or amount of nutrition practically attainable to anyone. For now it seems that preventable (by education or otherwise) diseases, conditions, or circumstances (such as war or human-created accidents) is certainly the most significant reason typical for an individual to be deprived of a great deal of living opportunities.

To list just a few major preventable causes of death at large today in the world:

cause deaths per year (approx) source(s)
HIV/AIDS 3 million 1
vehicular accidents 1 million 1
malaria 1 million 1
measles 1 million 1
malnutrition/bad drinking water 1 million 2
war 1 million (est.) 3, 4, 5, 6

Current (very rough approximation) civilization score (in #deaths / year): -8 million

proofs as explanations

April 1st, 2008

Most proofs that I’ve seen feel like defensive, motley soups of disparate thoughts whose composition does indeed imply the theorem in question; but the reader is left without a strong intuition as to why the fact is true.

To illustrate: Consider one of the most fundamental theorems of mathematics: the Pythagorean. Given a right triangle with sides of lengths a, b, and hypotenuse c, we must have a2 + b2 = c2. Euclid, in The Elements, presented an argument for a proof involving many steps (14, by wikipedia’s current count) which involves showing the similarity of several triangles and the equivalence in area of various different shapes. Check out wikipedia for the full proof.

Euclid’s proof is mathematically sound. It achieves its aim of demonstrating, beyond a doubt, that in fact a2 + b2 = c2 for all (Euclidean) right triangles. What it leaves wanting is intuition. Why? How can a human, without resorting to memorization, understand that the sides must relate in this manner, upon seeing any right triangle? [The word grok comes to mind.]

I think that some proofs do achieve this higher standard of explaining the fact that they defend. Here, in a single picture, is a complete proof of the Pythagorean:


If I were a teacher, trying to convey as best I could the intuition behind this theorem, I would animate this figure so that the ratio a/b transitioned from 0 to infinity and back repeatedly — the point being to further the deep comprehension that the equality in area between the squares in question is independent of the acute angles of the triangle.

To give another example: one way to view De Moivre’s theorem is

cos (nx) = Real[ (cos x + i sin x)n ].

De Moivre proved this before Euler’s formula, eix = cos x + i sin x, was known. One proof follows by induction on n — assume it holds for n, then show it still holds for n+1. (The base case, n=1, is trivial.)

Suppose you saw this formula and the proof by induction. Would you really say that you knew why the formula was true? I am guessing that most people, including mathematicians, would gain profound new insight into this theorem when seen in terms of Euler’s formula. In that case, we should restate De Moivre’s theorem as

(cos x + i sin x)n = cos(nx) + i sin(nx),

and it becomes a very straightforward corollary of Euler’s formula:

(eix)n = ei(nx).

With Euler’s formula, De Moivre is just one perspective of a special case; it’s a shadow on our allegorical wall, while Euler shows us the true form of the fact.

Most math work today is presented as if intuition were a burden to be borne rather than the enabler of our creativity. Gauss in particular is infamous for hiding the how-d’you-think-of-that of his work. Perhaps the math community as a whole would move along more constructively if we embraced the major role intuition and deep understanding play in our creative efforts.

One does not discover a complex path of reasoning without a guess at the lay of the land. Why ignore the curve of the lines while we strive to connect the dots?