## Thursday, October 8, 2015

### The last digit of pi is 1

One of the most interesting Chuck Norris facts states that he knows the last digit of pi. The other day I was thinking that maybe I could join team Norris and find it too.

Now, finding what is the last digit in the decimal expansion of a number is actually something that is not well defined. Even thought that we can say that the last digit of $1/2=0.5$ is 5 and we could argue that the last digit of $1/3=0.\bar{3}$ is 3, for example, for $13/99=0.\overline{13}$ the digits are periodic and hence 1 and 3 will keep repeating without reaching a limit. We of course could say that the last digit for this is the last digit appearing on the period, which gives 3 in base 10.

Likewise, if we define the sequence $d_n$ to be the $n$th digit of the decimal expansion of $\pi$, we have that

$$\lim_{n\to\infty}d_n$$

does not exist. So maybe we can twist the question a little in order to make it more sound.

A very nice approach is to use continued fraction representation of numbers,

$$x=a_0+\cfrac{1}{a_1+\cfrac{1}{a_2+\cfrac{1}{a_3+\ddots}}}\,.$$

Here the $a_i$ are integers. Usually this is abbreviated as

$$x=[a_0;a_1,a_2,a_3,\dots]\,.$$

With this notation we get rid of the problem about the base expansion, as it is independent from the base in which the numbers are written. Here the problem about finding the last digit of rational numbers is straight forward, as rationals have a finite continued fraction expansion. For example $13/99=[0; 7, 1, 1, 1, 1, 2]$, that is

$$\frac{13}{99}=0+\cfrac{1}{7+\cfrac{1}{1+\cfrac{1}{1+\cfrac{1}{1+\cfrac{1}{1+\cfrac{1}{2}}}}}}\,.$$

Then we can say that the last number on the expansion of $13/99$ is $2$. This even works for irrational numbers. For example $\sqrt{2}$ has an expansion as continued fraction $\sqrt{2}=[1;\bar{2}]$, that is

$$\sqrt{2}=1+\cfrac{1}{1+\cfrac{1}{2+\cfrac{1}{2+\ddots}}}\,.$$

Hence we can say that the last number of $\sqrt(2)$ is $2$. Still, not all irrationals have nice continued fraction representations. For instance

$$\frac{1+\sqrt{3}}{2}=[1;\overline{2,1}]\,,$$

which throw us back to the original problem of periodic expansions. This time though, we have a nice ace under the sleeve. It is due to Galois and it establishes an outstanding result about quadratic surds.

It states that given a reduced surd $\alpha=[\overline{a_0;a_1,a_2,\dots,a_n}]$, its conjugate $\phi(\alpha)$ has a relation with the number obtained by reversing the order of the continued fraction expansion for $\alpha$.  This relation is given by

$$-\frac{1}{\phi(\alpha)}=[\overline{a_n;a_{n-1},a_{n-2},\dots, a_1,a_0}]\,.$$

The conjugate $\phi$ is pretty much like the more familiar complex conjugate, but in a more general setting. The conjugate of a quadratic surd simply changes the sign of the radical,

$$\frac{P+\sqrt(D)}{Q}\mapsto\frac{P-\sqrt(D)}{Q}\,.$$

Thus in the case of

$$\alpha=\frac{1+\sqrt{3}}{2}$$, we have that the inverse negative of its conjugate should have a reversed continued fraction expansion,

$$\frac{2}{\sqrt{3}-1}=[\overline{2,1}]\,.$$

Thus, is we follow the original idea as for periodic rationals, the last number of $(1+\sqrt{3})/2$ is  $2$, which is the first number of $2/(\sqrt{3}-1)$.

In order to understand how to use this in the general case,  the role of the discriminant is important. For example, for complex numbers we have that $D=-1$. This is called the discriminant and it is related to the quadratic equation that the number satisfy. That is, if $\alpha$ is a quadratic surd, it is the zero of a quadratic polynomial

$$p(\alpha)=a\alpha^2+b\alpha+c=0\,,$$

and $D=b^2-4ac$. The beauty of the conjugate function $\phi$ is that it permutes the roots of the polynomial $p(x)$. In the case of the complex numbers, $D=-1$ and the polynomial is

$$p(x)=x^2+1\,.$$

We have then that the conjugation takes one root of this polynomial into the other $\bar{i}=-i$. In general, this can be done for any polynomial $p(x)$ of higher degrees. When we go to higher degrees, there is more than one involution that permutes the roots of $p$.  This is the area of study of Galois Theory (no wonder why is connected to the original thing!)

Galois reversing result works only for reduced quadratic numbers, but taking this idea, we can extend it for more general situations,

Let $\alpha$ be the zero of a function $f(x)$ and let $\phi$ be a function that
permutes the roots of $f(x)$. If $-1<\phi(\alpha)<0$ then define the last
number for $\alpha$ to be the first number on the continued fraction of
$$-\frac{1}{\phi(\alpha))}\,.$$

In the case of $\pi$, we have that $f(x)=\sin(4x)$ is a possibility. Now we need an involution on the roots of $f$. Let $\phi$ be such that $\phi(\pi)=-\pi/4$. Then we can say that the last number of $\pi$ is the same as the first number of

$$\frac{4}{\pi}=[1; 3, 1, 1, 1, 15, 2, 72, 1, 9, 1, 17, 1, 2, ...]$$

which is 1.

A naive way of thinking about this is that we can regard $\pi$ as a number with an infinite period and thus the scheme could give something meaningful. But of course, this definition is not well defined as there are infinite possible involutions for the set or roots of $f(x)$. These involutions form a group known as the infinite dihedral group, $D_\infty$.

If there is anything like Galois theory for analytic functions maybe we could find the last number in $\pi$.