## Think Before You Act: A (quick) recap of an interesting thought experiment (Part 1)

Thought is so powerful that we can use it to reveal aspects of reality that cannot be reached any other way.

New scientist has inspired me to write another post based on a recent article they published about thought experiments. The article is relatively short in length, so I’d like to expand on a few thought experiments that revolutionized the way we think about the world. (I’ll talk about one today, and a few more over the next few weeks.) However, I won’t be talking about Galileo’s Leaning Tower of Pisa (acceleration under gravity is constant) or anything as famous as this because a quick Google search can yield tons of related articles. I will be writing about the more obscure thought experiments that have led to amazing discoveries, but you perhaps might not recognize at first glance.

In particular, hopefully this article will inspire you to conduct some thought experiments yourself as they are incredibly liberating in the sense that irrelevant physical constraints can be abstracted away without adding any additional physical machinery. (We can’t actually do that experiment because we don’t have a rocket that can travel at the speed of light. –Oh wait, who says we can’t…in our minds.)

METHINKS IT IS A WEASEL

Suppose you have a roomful of monkeys and typewriters. You let the monkeys type at the typewriters for an infinite amount of time. Conclusion: eventually one monkey will produce the complete works of Shakespeare. (Boring! I’ve heard this before!) Alright, let’s make this a bit more interesting. We don’t have a room full of monkeys. We have only one monkey, Bob. Instead of typing out the complete works of Shakespeare, let’s say Bob only needs to type one phrase, “METHINKS IT IS A WEASEL.” Furthermore, Bob gets a special keyboard that only has all 26 letters in caps and a space bar. How long does it take Bob to type out the phrase?

Before you start asking me to clarify the question with details like how fast can Bob type and if spaces matter, let’s stop and think for a moment and abstract away all these physical details. Since Bob is a monkey, he will choose one of the letters or the spacebar with roughly equal probability. The specific phrase we want him to type contains 23 characters. Bob will produce this phrase out of all possible 23 character phrases with probability $p = \frac{1}{27}^{23}$. Let’s say Bob can produce one phrase per second (unrealistic, but, hey, we’re not in the real world here). The expected number of seconds it would take Bob to produce the phrase is $E[X] = \displaystyle\sum\limits_{i=0}^\infty (i+1)*(1-(\frac{1}{27})^{23})^i*(\frac{1}{27})^{23} = (\frac{1}{27})^{23} \displaystyle\sum\limits_{i=0}^\infty (i+1)*(1-(\frac{1}{27})^{23})^i$
$\approx 8.3*10^{32}\,\,seconds = (1.9*10^{15})*age\,\,of\,\,universe$. This is not infinity, but it’s still a very large number. In fact even if Bob started typing right at the beginning of the universe, he still wouldn’t have typed the phrase “METHINKS IT IS A WEASEL” by today (nope, still got a couple of trillions of year to go).

So what did we learn from this thought experiment?

As you can see, simply selecting random letters each time Bob types a different phrase is not the most effective way to obtain the desired phrase in the shortest time possible. Richard Dawkins was the first to formulate this thought experiment and subsequently apply it to genetics and evolution.

What this thought experiment says about “random mutations” in evolutionary algorithms is that these mutations are not necessarily randomly picked with each iteration of the algorithm. Mutations that are closer to the desired result are kept and used in the next cycle. In the case of the thought experiment above, the closer a 28 letter phrase gets to “METHINKS IT IS A WEASEL,” the less likely that the phrase would undergo further mutations.

The formal algorithm given by Dawkins is the following: