12

How does one prove that the continued fraction representations of rational numbers are finite?

For every $x\in\mathbb{R}$, the (simple) continued fraction representation of $x$ is: $$ x = [a_0; a_1, a_2, ...] = a_0 + \frac{1}{a_1 + \frac{1}{a_2 + \frac{1}{...}}} $$ where $a_0\in\mathbb{Z}$ and $a_k\in\mathbb{N}$ for $k\geq 1$, which are themselves obtained as follows: $$ \begin{align} r_0 &= x \\ \forall k \geq 0,\quad a_k &= \lfloor r_k \rfloor \\ \forall k \geq 0,\quad r_{k+1} &= \begin{cases} 1 / (r_k-a_k) & \text{if } r_k > a_k \\ 0 & \text{otherwise} \end{cases} \end{align} $$ and if there exists $n$ for which $r_n > r_{n+1} = 0$, then we correct $a_n\mapsto a_n-1$.

Clearly if the sequence $a_k$ converges to 0, then $x$ is rational. But the converse does not seem trivial at all; why does this recursion necessarily terminate if $x = p/q$? Contraposition does not seem evident to me here either. Is there another way to think about this?

Jonathan H
  • 2,343
  • Isn't that true by definition for rationals? I don't know much about this, though. – Robbie Jun 02 '18 at 00:32
  • 4
    Just do a strong induction on the denominator. It gets smaller each time – Kenny Lau Jun 02 '18 at 00:36
  • 3
    The numerators of the fractions $1/[0;a_1,a_2,...]$, $1/[0,a_2,a_3,...]$,... are a strictly decreasing sequence of natural numbers. They are the remainders in the extended Euclid's algorithm applied to the numerator and denominator of the given rational number. –  Jun 02 '18 at 00:36
  • 1
    @RobbieVanDerzee I don't see why this would be true by definition; as far as I understand, the so-called "simple" continued fractions (with numerators all equal to 1, and with positive denominators) are just a particular "decomposition" of numbers, and it so happens that there are special properties of this decomposition for rational numbers. I might be wrong though, hence my question :) – Jonathan H Jun 02 '18 at 00:36
  • @Sheljohn I'm probably wrong, which is why I was interested in this question. I thought since they come from a finite number over another finite number, then any repeated fraction just has to do with the divisors of each part. However, I'm excited to see what the explanations are. – Robbie Jun 02 '18 at 00:51
  • @elmer I think your and Kenny Lau's comments are aligned with what I am looking for; would you be interested in writing a short answer? – Jonathan H Jun 02 '18 at 00:53
  • @Sheljohn It is already written in the link. $a/b$ is the rational number, the $q_i$ are your $a_i$ and the $r_i$ are the numerators I was talking about. The inequality $0\leq r_{i+1}<|r_i|$ ensures that the sequence of $r_i$ cannot go on forever because the natural numbers are well ordered. –  Jun 02 '18 at 00:59

2 Answers2

18

it is the Euclidean Algorithm, that is all. Lots of people use "back-substitution" to finish the Extended Algorithm and find the Bezout combination, I prefer to write this as a continued fraction.

$$ \gcd( 12345, 1601 ) = ??? $$

$$ \frac{ 12345 }{ 1601 } = 7 + \frac{ 1138 }{ 1601 } $$ $$ \frac{ 1601 }{ 1138 } = 1 + \frac{ 463 }{ 1138 } $$ $$ \frac{ 1138 }{ 463 } = 2 + \frac{ 212 }{ 463 } $$ $$ \frac{ 463 }{ 212 } = 2 + \frac{ 39 }{ 212 } $$ $$ \frac{ 212 }{ 39 } = 5 + \frac{ 17 }{ 39 } $$ $$ \frac{ 39 }{ 17 } = 2 + \frac{ 5 }{ 17 } $$ $$ \frac{ 17 }{ 5 } = 3 + \frac{ 2 }{ 5 } $$ $$ \frac{ 5 }{ 2 } = 2 + \frac{ 1 }{ 2 } $$ $$ \frac{ 2 }{ 1 } = 2 + \frac{ 0 }{ 1 } $$ Simple continued fraction tableau:
$$ \begin{array}{cccccccccccccccccccc} & & 7 & & 1 & & 2 & & 2 & & 5 & & 2 & & 3 & & 2 & & 2 & \\ \frac{ 0 }{ 1 } & \frac{ 1 }{ 0 } & & \frac{ 7 }{ 1 } & & \frac{ 8 }{ 1 } & & \frac{ 23 }{ 3 } & & \frac{ 54 }{ 7 } & & \frac{ 293 }{ 38 } & & \frac{ 640 }{ 83 } & & \frac{ 2213 }{ 287 } & & \frac{ 5066 }{ 657 } & & \frac{ 12345 }{ 1601 } \end{array} $$ $$ $$ $$ 12345 \cdot 657 - 1601 \cdot 5066 = -1 $$

Will Jagy
  • 146,052
  • Wonderful formatting :) I think I get it, but now I'll have to read the proof that the Euclidean algorithm works again to convince myself... I guess it would help me to have a less "proof-by-example" approach. – Jonathan H Jun 02 '18 at 00:44
  • Also, what is this $1/0$ there in the last line? Does this have to do with the initial values of the numerator / denominator sequences defining the convergents? – Jonathan H Jun 02 '18 at 00:47
  • @Sheljohn actually, continued fractions are enough of an alphabet soup that your best bet is just to do a few of these by hand, perhaps beginning with smaller numbers. A mess to write out with subscripts, really not bad with actual numbers – Will Jagy Jun 02 '18 at 00:47
  • @Sheljohn that is how the sequence of numerators and sequence of denominators start off. Those are fake fractions. See how the "digit" 7 gives you the first genuine fraction 7/1 – Will Jagy Jun 02 '18 at 00:49
  • I upvoted your answer, and I like it, but I think I will write my own answer tomorrow, following Kenny Lau's suggestion (induction on decreasing denominator sequence); it gives a very simple and direct proof. I hope this will not offend you :) – Jonathan H Jun 02 '18 at 01:25
  • @Sheljohn all fine, but I hope you really do a few examples of this by hand. – Will Jagy Jun 02 '18 at 01:28
0

The only way for this recursion to terminate, is for the sequence of $a_k$ to converge to $0$, and this only happens when one of the $r_k$ becomes an integer.

If this is unclear to you, consider that $\forall x\in\mathbb{R},\ x-\lfloor x\rfloor\in[0,1)$; therefore the only way that the $a_k$ converges to zero is if at some point $r_k = \lfloor r_k\rfloor$, i.e. $r_k$ is an integer. It is easy to see that once this happens, all further $r_k$ and $a_k$ are zero. (Note also that $a_0$ can be zero without implying convergence, which is not the case for any subsequent $a_k$.)

The main thing that changes if $x$ is a rational, is that the $r_k$ are all rational as well (subtraction with integer and reciprocal of a non-zero are both inverse of elementary operations in $\mathbb{Q}$).

For all $k>0$, $r_k$ is either integral or a rational greater than 1.

Proof:

If any $r_{k\geq 0}$ is integral, then all successors are zero.

If $r_0$ is a rational less than 1, then $0 < r_0 - \lfloor r_0 \rfloor < 1$ and therefore $r_1 > 1$. Similarly if $r_k = p/q$ with $p > q > 0$ for some $k > 0$, then: $$ \exists n\in\mathbb{N},\quad 0 < n < \frac{p}{q} < n+1 \quad\implies\quad a_k = n \quad\text{and}\quad r_{k+1} = \frac{q}{p-nq} $$ with $p - nq < q$ (because $n$ is such that $p < (n+1)q$).


Incidentally, this also shows that the sequence of denominators of $r_k$ for $k > 0$ is strictly decreasing, as long as the sequence consists of rationals. Since these denominators are bounded below by zero, and that the previous induction applies for values greater than one, we will necessarily find a term $r_K = p/q$ for which either $q|p$ (integer case) or $p \equiv 1 \mod q$ (in which case $r_{K+1}$ is an integer).

Jonathan H
  • 2,343