Continued fraction expansion of rational numbers


In this section we use continued fractions ([2]) for expansion of rational numbers. If \displaystyle x_0, \displaystyle x_1, \displaystyle \ldots, are integer nunbers with \displaystyle x_i>0 for every \displaystyle i>0 then \displaystyle [x_0;x_1,x_2,\ldots,x_n]\in\mathbb{Q},\quad\forall n\geq 0.

Conversly, we have the theorem

Theorem 1. Let \displaystyle r and \displaystyle s be coprime integers with \displaystyle s>0. Then there are non negative integer \displaystyle n and integers \displaystyle a_0, \displaystyle a_1, \displaystyle \ldots, \displaystyle a_n such that

(1) \displaystyle a_i>0 for every \displaystyle i=1,2,\ldots,n.

(2) \displaystyle r/s=[a_0;a_1,a_2,\ldots,a_n].

Proof. Let us proceed by induction on \displaystyle s. The case \displaystyle s=1 is trivial. Now suppose that the assertion is true for all positive integers up to \displaystyle s-1 (\displaystyle s>1). Because \displaystyle (r,s)=1 and \displaystyle s>1, we have \displaystyle s\nmid r. Hence by the Division Algorithm ([1]), there are integers \displaystyle a and \displaystyle b such that

\displaystyle r=sa+b,\quad 1\leq b<s.\quad\quad (1)

By the hypothesis of the induction, there are integers \displaystyle m>0, \displaystyle a_1, \displaystyle a_2>0, \displaystyle \ldots, \displaystyle a_m>0 such that

\displaystyle \frac{s}{b}=[a_1;a_2,a_3,\ldots,a_m].\quad\quad (2)

Because \displaystyle s>b, we have \displaystyle a_1>0. From (1) and (2) we have

\displaystyle \frac{r}{s}=a+\frac{1}{s/b}=a+\frac{1}{[a_1;a_2,a_3,\ldots,a_m]}=[a;a_1,a_2,\ldots,a_m], completing the induction step. \Box

The equality in the theorem is called an expansion of \displaystyle r/s into a finite continued fraction. In that expansion we will call \displaystyle [a_0;a_1,a_2,\ldots,a_i] is the i-th convergent of the continued fraction, or i-th convergent of \displaystyle r/s.

Example 1. Find an expansion of \displaystyle 43/5 into a finite continued fraction.

Solution. By the Division Algorithm, we have

\displaystyle 43=5\cdot 8+3\quad\quad\frac{43}{5}=8+\frac{3}{5}=8+\frac{1}{5/3}, and

\displaystyle 5= 3\cdot 1 +2\quad\quad\frac{5}{3}=1+\frac{2}{3}=1+\frac{1}{3/2}, and \displaystyle \frac{3}{2}=1+\frac{1}{2}. Therefore \displaystyle 43/5=[8;1,1,2]. \Box

The theorem says that for every rational number has an expansion into a finite continued fraction. But this expansion is not unique.

Example 2. \displaystyle 13/5=[2;1,1,2]=[2;1,1,1,1]. \Box

Theorem 2. Let \displaystyle \alpha be an integer number. Then \displaystyle \alpha has exactly two expansions into a finite continued fraction.

Proof. By the theorem 1, we can write

\displaystyle \alpha=[a_0;a_1,a_2,\ldots,a_n],

where a_0, a_1, \ldots, a_n are integers such that a_i>0 for every i=1,2,\ldots,n. If \displaystyle n=0 then \displaystyle \alpha=a_0 and \displaystyle \alpha=[\alpha] is an expansion of \displaystyle \alpha. If \displaystyle n=1 then \displaystyle \alpha=a_0+\frac{1}{a_1}, hence \displaystyle \frac{1}{a_1} is an integer, so \displaystyle a_1=1. Therefore \displaystyle \alpha=[\alpha-1;1] is an expansion of \displaystyle \alpha.

Now assume that \displaystyle n\geq 2. We have

\displaystyle \alpha-a_0=\frac{1}{[a_1;a_2,\ldots,a_n]}

is an integer number and \displaystyle [a_1;a_2,\ldots,a_n]>0 , hence \displaystyle [a_1;a_2,\ldots,a_n]\leq 1. This claim is false because \displaystyle n\geq 2 and \displaystyle a_i\geq 1 for every \displaystyle i=1,2,\ldots,n. \Box

Theorem 3. Let \displaystyle \alpha be a rational number but not an integer. Then \displaystyle \alpha has exactly two expansions into a finite continued fraction.

Proof. Assume that \displaystyle \alpha=\alpha=r/s, where \displaystyle r and \displaystyle s>1 are coprime integers. We prove by induction on \displaystyle s that \displaystyle \alpha has exactly two expansions into a finite continued fraction

\displaystyle \alpha=[a_0;a_1,\ldots,a_n]=[a_0;a_1,\ldots,a_n-1,1],

where \displaystyle a_n>1. If \displaystyle s=2, because \displaystyle (r,s)=1 there is an integer \displaystyle k such that \displaystyle r=2k+1. By the theorem 1, we can write

\displaystyle \alpha=k+\frac{1}{2}=[a_0;a_1,a_2,\ldots,a_n],

where a_0, a_1, \ldots, a_n are integers such that a_i>0 for every i=1,2,\ldots,n. We have n>0 and a_0=k, hence \displaystyle 2=[a_1;a_2,\ldots,a_n]. By the theorem 2, we have 2 has exactly two expansions into a finite continued fraction, those are 2=[2] and 2=[1;1], therefore \alpha has exactly two expansions \displaystyle \alpha=[k;2]=[k;1,1], hence the claim is true for \displaystyle s=2. Now suppose that the claim is true for \displaystyle 2, \displaystyle 3, \displaystyle \ldots, \displaystyle s-1 (\displaystyle s>2). By the theorem 1, we can write

\displaystyle \alpha=[a_0;a_1,a_2,\ldots,a_n],

where a_0, a_1, \ldots, a_n are integers such that a_i>0 for every i=1,2,\ldots,n. We have n>0 and a_0=[\alpha] (integer part of \alpha), hence \displaystyle \frac{1}{\alpha-[\alpha]}=[a_1;a_2,\ldots,a_n]. By the Division Algorithm, there is an integer \displaystyle a such that \displaystyle r=s[\alpha]+a and 1\leq a<s, then

\displaystyle \frac{s}{a}=[a_1;a_2,\ldots,a_n].

If a=1 then a_1>1 and by the theorem 2, we have s/a has exactly two expansions are s/a=[a_1] and \displaystyle s/a=[a_1-1;1]. If \displaystyle a>1 then by the hypothesis of the induction (note that \displaystyle s and \displaystyle a are coprime integers), \displaystyle s/a has exactly two expansions are

\displaystyle \frac{s}{a}=[a_1;b_2,\ldots,b_n]=[a_1;b_2,\ldots,b_n-1,1],

where \displaystyle b_n>1. Therefore \displaystyle \alpha has exactly two expansions, and the claim is true for \displaystyle s. \Box

References

[1] https://nttuan.org/2020/01/14/divisibility/

[2] https://nttuan.org/2008/11/14/continued-fraction-expansion-of-rational-numbers/

One thought on “Continued fraction expansion of rational numbers

Leave a comment