Saturday 26 July 2014

Randomly Infinite


As some of you might know, I am writing a popular book about Bayesian probabilities and science. The first draft, which is a work in progress, can be found for download here and I appreciate any feedback:


I am working on a revised version right now and I decided to expand the sections on randomness and make them a whole chapter. The problem is to know when to stop. Randomness is such an interesting and intriguing topic that one can write a whole book only on it. There are many things that I would like to say about randomness, but I have to leave out otherwise it would change the main theme of the book. 

I will consider writing a book only on randomness in the future, but I still have some consolation on the fact that I can at least share with you those things that, at present, will be left out. One of those things is related to the mind-boggling things you get when you mix the two dangerous concepts of randomness and infinity.

SPOILER ALERT. If you haven't read Contact by Carl Sagan yet, be aware that I will be talking about something that happens literally at the end of the book. Be warned. At the very end, the main character is running a program to find a message that has been left hidden in the digits of the number Pi by the supposed 'designers of the universe'. The program suddenly spills out a sequence of numbers that somehow form the picture of a circle. Now, you might be very truly amazed to know that Carl is right: there is indeed such a sequence hidden in the digits of Pi! That exact sequence, by the way! Have I just changed your life? Before you starting twitting about these amazing news, let me tell you a couple of things about Pi.

Well, everybody knows that Pi is a number which is a result of dividing the length of a circle by its diameter. In flat Eulidean space, which is the one obeying the geometric properties you have learned in the school, this works for every circle. But Pi is a very interesting number in many other aspects. One of them is the fact that it is an irrational number. This means that there is no way to write Pi as a fraction, or a rate, between two other integer numbers. A consequence of this is that the decimal digits of Pi cannot (ever, never) be periodic. What does that mean?

A periodic sequence is one that repeats itself after a certain amount of time. Examples are:

11111111111...
121212121212...
123567123567123567...

I am assuming these sequences repeat forever (I call the last one the 'Mambo Sequence' by the way). The first sequence has period one, the second has period 2 and the Mambo Sequence has period 6. The period is then, clearly, the number of digits that are repeating. A rational number, one that can be written as a fraction between two integers, always finishes with a periodic sequence. It can take a while to reach that sequence, but it is always there. For instance:

1.234566666666....

where the last digit '6' repeats forever is a rational number. In irrational numbers, like Pi, this never happens. The odd consequence behind this is that the digits of Pi, which start like:

3.141592653...

have all the properties of an infinite sequence of randomly distributed integers from 0 to 9! Each one with equal probability. If you are skeptical, take a look at the two graphs below.



These two graphs appear in my book. They represent two sequences of digits from 0 to 9 with a total of 100 digits. Can you see the difference between them? There is no regularity in any of the two graphs, but one of the above sequences is the digits of the number Pi and the other is a sequence of digits randomly generated by a computer program. Try to identify which one is Pi. There is a way, but it is definitely not by looking at their overall appearance.

Another detail is that the number of decimal digits in Pi is infinite. That is because any number whose sequence of decimal digits is finite IS a rational number. All you need to do to find its representation as a fraction is to multiply it by an appropriate power of ten until it becomes an integer. The number is then that integer divided by the power of ten.

Many of you must know Jorge Luis Borges' story The Library of Babel. In it, Borges imagine a library containing books in which every combination of the letters of the alphabet are present, in a random order. This means that, if you only look at the books with say 400 pages, the library contains all stories and all scientific books that have been ever written or that will one day be written as long as they fit in 400 pages! Even things that haven't been discovered yet! Even stories that nobody wrote yet, but that one day someone will! In fact, because the library is infinite, it contains all books that have ever been written or that will ever be.

Although Borges' library is fictional, it illustrates a truly amazing property of the infinite. When you put together infinity and randomness, you get something even more amazing. It can be proved that in an infinite random sequence, ANY finite sequence of characters appears an infinite number of times! Now, the punchline:

Every finite sequence of numbers appears an infinite number of times
in the sequence of decimal digits of Pi.

And so what? Think about this. In the same way as you can encode computer files in binary form, you can also encode any information in decimal form. If you doubt, just write down the binary representation of any file. That is an integer number. Write that integer in decimal base and voila! This means that every text that has ever been written or that will ever be written can be found somewhere in the sequence of decimal digits of Pi! An infinite number of times! This means that, whatever Sagan's character found in the sequence of digits of Pi, it is not a message from another race, but simply the result of good and old randomness!

If you are worried that there is so much information hidden in Pi or maybe trying to devise a plan to extract future information from it like the Bible Code, be aware that this is useless. Because the digits are random, there is no way to know where the information is before hand, or even which information is correct or not, because the same information appears with all possible mistakes!

Reading the text above again, I cannot stop being amazed myself. I am having second thoughts if I include this in the book or not already...

Update: Some friends are telling me that it's not proved that the digits of Pi are random. Maybe I should have been more cautious when I wrote it. It is absolutely true that there is no proof that the digits of Pi are random and, in fact, there seems to be evidence that it is actually pseudo-random, in the sense that one might predict them if we have a certain formula that was found by a couple of mathematicians.

Still, the possibly pseudo-random sequence of digits of Pi continues to satisfy most tests of randomicity, which although is not a proof that they are random, makes it more probable that it satisfies the most interesting properties, specially the one of having every other sequence written in it. 

No comments:

Post a Comment