Here are some definitions of continued fractions we'll be using.
To find a contined fraction of a rational number, we find the largest integer from whatever is remaining, and then reduce it to a similar problem, except smaller. For example, to find the continued fraction of 1329, we know that the largest integer less than 1329 is 2. So, we know
1329=2+x1
for some x. We solve the equation for x, to get
313=x.
Then, we continue similarly to get
x=4+31.
So, when we plug this back in to our first equation, we have
1329=2+4+311=[2,4,3].
Right! In the division algorithm, we find the largest multiple less than some integer and then the remainder. Let's try to see if these two processes are related.
Let's use our previous example so that we don't need to do as much work. We use the Euclidean algorithm, which is the division algorithm iterated repeatedly to divide 29 by 13:
29=13(2)+3
13=3(4)+1
3=1(3)+0
Wow! Isn't that a surprise? The quotients we get are exactly the numbers in the continued fraction! Let's try to figure out why this works.
Where would 1329 come from in the first place? Well, the only equation that has both 29 and 13 is the first one, so let's try to get a 1329.
29=13(2)+3⟹1329=2+133.
This is exactly what we needed! Now we proceed in a similar fashion to find 133.
13=3(4)+1⟹133=3131=4+311.
We substitute this and we get
1329=2+4+311.
Great! Now it's time to try to formulate a proof.
Suppose we have the following equations:
a=bq1+r1
b=r1q2+r2
r1=r2q3+r3
⋮
rn−2=rn−1qn+rn
Then, we can rearrange each of them so that we have what we want:
a=bq1+r1⟹ba=q1+br1
b=r1q2+r2⟹r1b=q2+r1r2
r1=r2q3+r3⟹r2r1=q3+r2r3
⋮⋮
rn−2=rn−1qn+rn⟹rn−1rn−2=qn+rn−1rn.
Now, it's time to substitute repeatedly.
ba=q1+q2+r1r21=q1+q2+q3+r2r311⋮=q1+q2+⋱+qn111=[q1,q2,⋯,qn].
This is exactly what we wanted to prove.