# π day!

We suddenly got hit with a barrage of π questions today.  Turns out it’s not a coincidence.

π is defined, very humbly, as the ratio of the circumference of any circle to its diameter.  From that definition alone it’s managed to worm its way into damn near every branch of math and physics.  For example, did you know that $1+\frac{1}{2^2}+\frac{1}{3^2}+\frac{1}{4^2}+\frac{1}{5^2}+\cdots=\frac{\pi^2}{6}$?  It even shows up in the mathematical form of the vaunted Heisenberg Uncertainty Principle: $\Delta x \Delta p \ge \frac{h}{4\pi}$.

But what’s often cited as the most exciting thing about π is that its decimal expansion, “3.14159…”, goes on forever without repeating.  This isn’t really special to π.  In fact this is the case with (effectively) all irrational numbers.  But π is probably most people’s first exposure to the weirder realities of math, so it’s near and dear to a lot of hearts out there.

Q: Could the sequence of numbers making up the infinite expansion of Pi (or any other irrational number) be considered to make up an even random distribution? If not, how does it differ? If yes, couldn’t it be used when randomness is needed?

Mathematician: The digits of Pi are certainly not random, but its first few billion digits work well enough as random numbers for a lot of applications (i.e. it acts nicely as a source of pseudo random numbers).

Q: If it is true that Pi has all possible finite sequences, and the universe is finite, then then entire universe is somewhere described in the digits of Pi. Talk about your compression algorithms. “You can find a complete description of the universe, zip-encoded, starting at digit 10^120239234884840302929393482022039948393492039483940293849348203949384….”

Physicist: Assuming that decimal expansion of π (“3.1415…”) really is perfectly random, then yes; every possible finite description of the universe is encoded somewhere in the unending digits of π.  That said, there isn’t actually any compression.  If you think of any random number, for example, your 7 digit phone number, then the probability that any particular digit in π is the start of that particular string of 7 numbers is about 1 in 107.  That means that, on average, you’ll have to go out about 107 digits to find a particular phone number.  But to describe that “address” takes exactly 7 digits.

Point is, any sequence of numbers (may/probably) exist in π, but the description of where to find that sequence is effectively always as long as the string of numbers itself.  Sometimes a little shorter, sometimes a little longer.  In fact, try it yourself!  So, if you want to find the string of numbers that describes an entire universe in detail, you’d need a computer about as big as that universe to hold the location of where that number starts in π.

Q: If we changed the math system away from a base 10 system could we find a system where π was not irrational?

Physicist: Rational numbers are numbers that can be expressed as one integer number over another, like “$\frac{a}{b}$“.  What’s not involved in that definition is the base of the numbers involved, and it turns out not to matter.

The decimal form of a rational number always repeats forever.  It may take some fractions longer than others, and sometimes there’s a “settling down” period, but they always repeat.  In fact, the longest a pattern can go before repeating is always at least a little less than the denominator of the fraction.  Regardless of the base used.  For example:

5/7 = 0.714285714285714285714285… repeats every 6 digits.

37/40 = 0.925000000… settles down, and then repeats every 1 digit.

2/3 = 0.6666666… repeats every 1 digit.

In binary you’d write “2/3” as “10/11” and its binary representation is 10/11 = 0.10101010101…., which repeats every 2 (still less than 3, isn’t that strange?).

Using geometric series, you can convert any repeating number, in any base, into a fraction.  So anything with a repeating representation in decimal (base 10), binary (base 2), hexadecimal (base 16), whatever, can be written as one number over another (it’s a rational number).  Conversely, if a number is not rational, it can never have a repeating representation in any base.  It was difficult to prove the irrationality of π conclusively (for a couple thousand years), but we’ve known for about 250 years that π is definitely irrational, so there’s no way to write it in a way that repeats.

This entry was posted in -- By the Mathematician, -- By the Physicist, Math. Bookmark the permalink.

### 16 Responses to π day!

1. Sean says:

I can’t remember the details… but didn’t two Canadian scientists find a way of predicting sequences of PI digits WITHOUT finding the digits that came before? They used ‘dynamic chaos theory’ or similar and the ability to do this proved that PI was indeed entirely random?

2. The Physicist says:

Entirely cool!
That does sound like a Canadian thing to do. Do you remember the name of the technique/paper or anything like that?

3. Nathan says:

The last question got me thinking, which got me Googling…
It looks like if you allow for the use of irrational bases and use a base pi number system, pi could be represented as a rational number (10). Is that correct?

4. About the last question, there is a way: Base π, in which the value of π is, quite simply, 1. That works, but with the side effect that “our” integers and fractions become irrationals as a consequence.

Some systems of natural units use a trick similar to this to simplify equations where π appears: just define the result as “1” and continue from there. Evidently π ends up appearing somewhere else, but for the purposes of what’s being done at that point, it helps.

5. Idran says:

He’s refering to Bailey-Borwein-Plouffe-type formulas, which can accomplish this for transcendental numbers besides pi as well. The original BBP formula from Simon Plouffe does it for digits of pi in hexadecimal, as well as other transcendental numbers in various bases:

http://www.ams.org/journals/mcom/1997-66-218/S0025-5718-97-00856-9/home.html

In 1996 he improved it to an algorithm to calculate the nth digit of pi in any arbitrary base in O((n log n)^3) time without calculating the n-1 digits before it.

http://arxiv.org/pdf/0912.0303

However, Fabrice Bellard improved this further, coming up with an O(n^2)-time algorithm in 1997.

http://bellard.org/pi/pi_n2/pi_n2.html

6. Idran says:

Oh, whoops, I posted before I could add this:

On the second question: isn’t it still an open question whether or not pi is a normal number, and so suitable in general as a pseudorandom number source?

7. The Mathematician says:

Yes, it is not known whether Pi is normal. But a number of papers, such as this one have studied the first many digits of Pi empirically, and generally find that they pass important tests for randomness.

8. Sean says:

Idran, The Physicist: The BBP type formula was indeed what I was trying to find – this is the original article I was referring too (took me ages to find again!):

http://newscenter.lbl.gov/news-releases/2001/07/23/are-the-digits-of-pi-random-lab-researcher-may-hold-the-key/

Cheers!

9. Alex says:

How do we know the decimals of pi continue on forever? Is it possible with future computers that we eventually discover that the last digit ends at the one hundred trillionth decimal place?

10. The Physicist says:

If that were the case then pi’s digits would repeat forever (in this case, 000000…), and pi would necessarily be a rational number. There are several proofs that pi is not a rational number, but none of them are particularly simple.

11. aquino says:

If Pi’s not a rational number, then how can it be defined as the RATIO of circunference over diameter?

12. Idran says:

A rational number is a ratio of two integers. If the diameter of a circle is an integer then the circumference isn’t, and vice versa.

13. Ian says:

Division by zero interests me. For instance, 1/1=1, 0.1/0.1=1, 0.001/0.001 =1 and so on. The numerator and denominator are heading towards zero but no matter how close they get the result will , I assume, be equal to 1. At 0/0 the answer cannot be defined. Why is that?

14. Ruvian says:

Ian,
That’s simple. Because pi*0=0, right? So i do the whole thing back and I see that 0/0=pi
And I chose pi because I like it. You could choose any number you’d like to. So, that’s why 0/0 is not defined.

15. Ruvian says: