# How to show every rational number can be expressed as two different continued fractions?

I am being asked to verify that every rational number can be represented by two different continued fractions.

I have started by taking any rational number, say $\alpha \in \mathbb{Q}$, and what I need to show is that we can have it expressed as two continued fractions:

$$\alpha = [a_0; a_1, a_2, \ldots, a_n] = [b_0; b_1, b_2, \ldots, b_m]$$

(Where not all $a_i = b_i$ for all $i \in \mathbb{N}$).

I have verified the trivial case where if $\alpha = k \in \mathbb{Z}$, then we can always express it as:

$$\alpha = [k-1; 1] = [k]$$

If $\alpha =\frac{p}{q} \in \mathbb{Q}$ where $p$ and $q$ are coprime integers, my intuition is that we could say: $$\alpha = [a_0; a_1, a_2 \ldots]$$ using the usual continued fraction algorithm, and then: $$\alpha = [-1; [c_0; c_1, c_2, \ldots c_p]]$$ Where $[c_0; c_1, c_2, \ldots, c_p] = \frac{1}{\alpha +1}$. If anyone has any thoughts it would be greatly appreciated!

If you have a sequence $[a_0,a_1,\cdots,a_n]$

you can replace it with

$$[a_0,a_1,\cdots,a_n-1,1]$$ in the case $a_n>1$ and with $$[a_0,a_1,\cdots,a_{n-1}+1]$$ in the case $a_n=1$. So we always have two different representations. Note that the first entry need not be positive.

For irrational numbers, the expansion is always unique.

• Thanks! Much simpler, should have seen it really haha! Also I noticed on my original post that the first term using the CF algorithm may in fact be -1! (So the two expressions I had suggested could be the same.) – uk62116 Mar 27 '17 at 12:08
• I edited the post because $[1]$ also has another representation, namely $[0,1]$. Similar $[0]=[-1,1]$ and so on. – Peter Mar 27 '17 at 12:10
• Is it exactly two or at least 2? – samerivertwice Mar 28 '17 at 19:10
• @RobertFrost exactly two different representations – Peter Mar 28 '17 at 22:45

It's worse than you think.

A continued fraction $[\ldots ,~ a,~ b,~ c,~ d,~\cdots ]$ is equivalent to $[\ldots ,~ a,~ b-n,~ 0,~ n,~ c,~ \cdots ]$. With enough zeroes lying around (I don't have that many personally) you can get an infinite number of continued fractions.

If you allow negative numbers as entries you're asking for even more trouble since $[\ldots ,~ -a,~ -b,~ -c,~ -d,~ \ldots ]$ is equivalent to $[\ldots,~ -a-1,~ 1,~ b-1,~ c,~ d,~ \ldots ]$

To guarantee uniqueness of simple (all numerators are 1) continued fractions representation of numbers:

1. all terms are integers (homework: what about gaussian integers? Integers adjoined with an element like $\sqrt{N}$ for non-square $N$? Hint: can you define a unique quotient?)
2. only the first term may be 0
3. only the first non-zero term may be negative; or, all non-zero terms must be negative (but you should pick the former)
4. the last term, if there is one, cannot be 1