# Defining Irrational Numbers

## Irrational numbers and their rational approximations

In mathematics, we have many kinds of numbers. The most familiar, and most used numbers, are the natural numbers $\mathbb N$ (the numbers used for counting), the integers $\mathbb Z$ (the whole numbers, positive and negative) and the rational numbers $\mathbb Q$ (the positive and the negative fractions). There are also other kinds of number that are frequently used by scientists. One example is the complex numbers $\mathbb C$, which include, among other exciting things, $\sqrt{-1}$.

If you’re familiar with math, you may be thinking: “Hang on, what about the reals?”. Well, the real numbers $\mathbb R$ (the number that can be represented by any finite or infinite series of desimals) are not very commonly used. This is not entirely true, since all natural numbers are integers, all integers are rationals, and all rationals are reals, we are of course using real numbers all the time, but not the real numbers that are not also rational.

Numbers that are real, but not rational, are known as the irrational numbers. Notable examples are $\pi$ and $\sqrt{2}$. Irrational numbers are numbers that cannot be written as a fraction. Since there are no fractions representing the irrationals, their decimal representations will always be infinite and non-repeating.

When we use irrational numbers in numeric calculations, we only use a finite part. For example, the area of a circle is given by

$A= \pi r^2.$

Given a circle with radius 1.52 meters, we calculate the area $A = 3.14 \cdot (1.52\, m)^2 = 7.25\,m^2$. Because of the limited precision with which we know $r$, we only need the first 3 digits of $\pi$. The number 3.14 is of course rational, since it can be written as the fraction $157/50$. With any finite precision, the irrational numbers we use in numeric calculations are really rational approximations to irrational numbers. It is, however, possible to do calculations with arbitrary precision. Calculations where we cannot beforehand know how many digits we will need from, for example, $\pi$ or $\sqrt{2}$.

## Finite representations of infinite objects

In theoretical sciences, we frequently find the need to describe the properties of infinite objects. An example from this text is the set of natural numbers. While this set is infinite, it is obvious how to build an arbitrarily large version of it. The first natural number is 1, the second is 2, and so on. In general, the $n$-th natural number is $n$. We can use the function $f_{\text{EVEN}}(n) = 2n$ to define the set of even numbers. The first even number is $f_{\text{EVEN}}(1) = 2$, the second is $f_{\text{EVEN}}(2) = 4$, and the 109-th is $f_{\text{EVEN}}(109) = 218$. Since $f_{\text{EVEN}}$ is easy to represent on a computer, we can easily represent the set of even numbers on a computer.

We can use the above technique to represent numbers as well. Let us take another look at $\pi$. The decimal representation of $\pi$ is $3.141592\ldots$, where the sequence goes on indefinitely. It is easy to represent the whole number-part of $\pi$, since that is an integer. The hard part is the decimal representation. One way to store this representation through the function $f_\pi$, where $f_\pi(1) = 1$$f_\pi(2) = 4$$f_\pi(3) = 1$, $f_\pi(4) = 5$, and so on. The problem is that there is no guarantee that we can represent the function $f_\pi$. We certainly cannot store the value for each digit. Without a pattern or an algorithm to calculate the $n$-th digit of $\pi$, we are no close the representing $\pi$.

## Trace functions

A trace function is an elegant way of computing approximations to an irrational number. Let $\alpha$ be an irrational number, then $T_\alpha$ is a trace function for $\alpha$ if

$|T_\alpha(x)-\alpha| < |x-\alpha|.$

That is, $T_\alpha(x)$ is closer to $\alpha$ than $x$ was. As an example, we provide a trace function for $\sqrt{2}$:

To see that $T_{\sqrt 2}$ is actually a trace function for $\sqrt 2$, we test the three cases in it’s definition separately. For $x<1$, we see that $T_{\sqrt 2}(x) = 1$. Since $\sqrt 2>1$, the trace function condition is satisfied. A similar observation holds for $x>2$. For $1\leq x\leq 2$, we use a graph to show the correctless of the function. For $x$ between 1 and 2, we need $T_{\sqrt 2}(x)$ to be close to $\sqrt 2$ than $x$. That means the graph of $T_{\sqrt 2}(x)$ must lie between the line that intersect the point $(\sqrt 2,\sqrt 2)$ and have slope $1$ and $-1$. This is because these two lines are the limits where

$|T_\alpha(x)-\alpha| = |x-\alpha|.$

The argument for the middle case of $T_{\sqrt 2}$ can take som thinking to understand. following graph proves the correctness of $T_{\sqrt 2}$.

Graph of T(x) between 1 and 2. For every point (x,y) on the red curve, y is closer to the square root of 2 than x is.

Given any point $(x,y) = (x,T_{\sqrt 2}(x))$ on the red curve (the graph of $T_{\sqrt 2}$), the value of $y$ is closer to $\sqrt 2$ than $x$ is.

We can now use $T_{\sqrt 2}$ to approximate $\sqrt 2$ with arbitraty precision. Let us say we need to know the value of $\sqrt{2}$ to 8 decimal places. We start with the value $1.4$, and calculate $T_{\sqrt 2}(1.4) = 1.4066225166$. We square this number to get $(T_{\sqrt 2}(1.4))^2 = 1.9785869041$, which is correct to the first decimal place (since it is 2.0 when rounded to that precision). We keep using $T_{\sqrt 2}$ to calculate new values, and after 25 iterations, we get $T_{\sqrt 2}(1.4142135621) = 1.4142135622$. When we square this number, we get $1.9999999996$, which rounds to $2.000000000$ (9 decimal places). Thus, $\sqrt 2 = 1.41421356$ to eight decimal places (which is correct).

In this argument we have used that $(a+c\cdot 10^{-n})^2 = a^2 + 2c\cdot 10^{-n} + c^2\cdot 10^{-2n}$. For our example, this means an error in the 10th digit of the square is caused by an error in the 9th or 10th digit of the original number (10th if $2c<10$). Since the first error is in the 10th digit, we know that our result must be correct to the 8th digit. (Here, we only consider the digits after the decimal point.)

The trace function $T_{\sqrt 2}(x)$ can easily be stored on a computer, and is therefore an example of the kind of representation we are looking for. It allows us to specify an infinite amount of information with a few lines of code.

## Other representations

Using trace function is only one of many ways of representing irrational numbers, and although the trace functions are quite easy to understand, they are not the most useful representations. A Cauchy sequence is a different kind of function representing irrational numbers, and, as opposed to trace functions, Cauchy sequences directly yield an answer to within the desired precision. The downside is that Cauchy sequences are harder to find. Other approaches include continued fractions, Dedekind cuts, and sum approximations.