Continued fractions of rational vs irrational numbers

1.2k Views Asked by At

I was wondering, if it were possible if you were given a continued fraction expansion for a number, to be able to determine if the number was rational or irrational? I know that if it is never repeating the number is irrational but not quadratic, but if it is periodic can you tell whether it’s rational?

1

There are 1 best solutions below

2
On BEST ANSWER

The (simple) continued fraction expansion of any rational number terminates. The (simple) continued fraction expansion of any irrational number has infinitely many terms. If the expansion is periodic, then it does not terminate, and the number represented is irrational.

This is a basic result on continued fractions that you should be able to find in any elementary treatment of the topic. It's also fairly straightforward to show:

If the expansion terminates, then it is really just a fraction, and all we have to do is simplify it. Conversely, suppose the number $x$ is rational. Then, when we write $x=a_0+\frac{1}{x_1}$, we obtain a rational number $x_1$ with a smaller denominator than $x$. The denominator is a positive integer, and these can't keep getting smaller forever. Eventually, the denominator reaches $1$, and we're done.

If you desire, you could formalize the above argument using Strong Induction.


Edit: Per the comment below, I will mention something about non-simple continued fractions. As noted above, any periodic expansion involving integers only represents a quadratic irrational number. However, if we allow entries in the continued fraction that are not positive integers, then a periodic expansion could represent a rational number. In order to tell, we can write down the quadratic equation that is implied by the periodic expansion.

For example, the representation $x=[1;a,b,a,b,\ldots]$ implies the equation: $$x=1+\frac{1}{a+\frac{1}{x+b-1}}$$

We simplify this: $$x=1+\frac{x+b-1}{ax+ab-a+1}$$ $$x(ax+ab-a+1) = ax + ab - a + 1 + x+b-1$$ $$ax^2 + (ab-2a)x + (a-b-ab)=0$$

I chose an example with a 2-term period to illustrate that extending the period does not increase the degree of the resulting polynomial; it will always be quadratic. Depending on the values of the terms $a,b$, a solution to this equation might, in fact, be rational. However, when the terms are positive integers, we will have $x$ irrational, as shown above.

Indeed, applying the quadratic formula, we see that our solutions are $$x=\frac{2-b}{2}\pm\frac{\sqrt{(ab+2)^2-4}}{2a}$$

With $a,b$ integral and positive, the value under the radical cannot be a perfect square.