Regarding programmers, monkeys and probability

Today, 7 January, we celebrate International Programmers Day. According to some sources, at least – there is also a Programmer’s Day happening on the 256th day of the year, 12/13 September, depending on whether it is a leap year. In a way the 256th day option makes more sense, as 256 is 2 to the power 8, which is the number of distinct values that can be represented with an eight-bit byte – something sure to amuse the programmers among us.

What makes 7 January an amusing date for a day dedicated to programmers, is that this is also the day that the French mathematician Emile Borel (7 Jan 1871 – 3 Feb 1956) was born. Borel, a pioneer in the field of probability theory, is the man who proposed the famous thought experiment that if you allow a monkey to randomly hit a typewriter’s keys, it will, with absolute statistical certainty, eventually type every book in the French National Library (known as the ‘infinite monkey theorem’).

The infinite monkey theorem, as applied to programming. (© All Rights Reserved)
The infinite monkey theorem, as applied to programming. Considering the quizzical look on his face, I’d say he’s just created some low-level assembly code…
(© All Rights Reserved)

Applied to programmers, does this mean that, if we let a monkey loose on a computer keyboard it will, given enough time, eventually write the code for every operating system and every computer programme ever developed?

I guess so… Which would support the often held opinion that people in IT get paid way too much… 🙂

Just kidding – of course I have the utmost appreciation for the computer whizzes who keep all the systems around us going. And when you think about it, there is almost no aspect of our daily lives that does not, in some way or another, have an aspect of programming involved in it. We certainly live in an age where IT is super-pervasive, and as such it makes perfect sense dedicating a day (or two) to celebrating the contributions programmers make in our lives. Good on you, each and every one!

Some paradoxical fun on Infinity Day

Today is 8 August, the eighth of the eighth, 8-8.  Or, if you turn it on it’s side, a couple of infinity signs stacked on top of each other… Yep, it’s Infinity Day!

The concept of infinity refers to something that is without limits. It has application in various fields such as mathematics, physics, logic and computing. Infinite sets can be either countably infinite (for example the set of integers – you can count the individual numbers, even though they go on forever) or uncountably infinite (e.g. real numbers – there are also infinitely many of them, but you cannot count the individual numbers because they are not discreet entities).

The wonderful ‘Numbers’ sculpture (artist: Anton Parsons), situated in mid-town, Palmerston North, NZ. While this sculpture does not explicitly deal with the concept, it always reminds me of infinity – from it’s resemblance to an infinity symbol, to the continuous cycle of random numbers. A definite favourite of mine.
(© All Rights Reserved)

Since infinity is really, really big – incomprehensibly so – it can lead to some amusing paradoxical scenarios; things that don’t make sense, by making complete sense.

An example of this is the Galileo Paradox, which states that “Though most numbers are not squares, there are no more numbers than squares.” In the set of positive integers, for example, the squares (1, 4, 9, 16, 25…) occur with much less frequency than the non-squares (2, 3, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24…). So there must be less of them, right? At the same time, however, every number is the square root of some square number, so there’s a one-to-one relationship between numbers and squares. Thus there cannot be more numbers than squares…

And therein lies the paradox… In a finite set, the square numbers would indeed be a minority, but in an infinite set, this is no longer the case.

Cool, right?

OK, here’s another fun one – Hilbert’s paradox of the Grand Hotel, presented by the German mathematician David Hilbert. This one states that “If a hotel with infinitely many rooms is full, it can still take in infinitely more guests.” In other words, let’s assume we have a hotel with a countably infinite number of rooms, all of which are occupied – in other words, each room has a guest in it. Then, since all the rooms are occupied, there can be no more room for new guests, right? Not so – simply move the guest in room 1 to room 2, move the guest in room 2 to room 3, and so on, to infinity. Then room 1 becomes available, so we can accommodate the new guest. And we can repeat this process indefinitely, so a hotel with an infinite number of fully occupied rooms can still accommodate an infinite number of new guests.

And on that note I will leave you to contemplate the concept of infinity. Don’t worry if it’s complicated – you have an infinite amount of time before the end of the day. Before you reach the end of the day, you have to reach the midway time between the current time and that time. And before you reach that midway time, you have to reach the midway between the current time and that time. And so on, to infinity…

It’s going to be a long day!