Homepage Solution manuals Terence Tao Analysis I Exercise 2.3.5 (Euclidean algorithm)

Exercise 2.3.5 (Euclidean algorithm)

Prove Proposition 2.3.9. (Hint: fix q and induct on n.)

Proposition 2.3.9 (Euclidean algorithm) Let n be a natural number, and let q be a positive number. Then there exist natural numbers m,r such that 0 r < q and n = mq + r.

Answers

How to think about the exercise. Terminological note: Tao calls this result "Euclidean algorithm", but Euclidean algorithm is most commonly used for a different algorithm. The common term used for the topic of this exercise seems to be Euclidean division.

For this exercise, the only slightly tricky part is proving the inductive step. Here, what turns out to work is to split into cases. But which cases? I think the easiest way to see is to look at some examples. Let’s take the following, where we fix q = 5 and increment n by one each time:

10 divided by 5 = 2 with remainder 0
11 divided by 5 = 2 with remainder 1
12 divided by 5 = 2 with remainder 2
13 divided by 5 = 2 with remainder 3
14 divided by 5 = 2 with remainder 4
15 divided by 5 = 3 with remainder 0

I hope you can see the pattern. At each increment of n, either the remainder goes up by 1 (in which case m stays the same) or the remainder resets to 0 (in which case m goes up by 1). What distinguishes the two cases? Well, the reset only happens when the remainder on the previous step is one less than the number we are dividing by, i.e. when r + 1 = q. For example, suppose we are at "14 divided by 5 = 2 with remainder 4". Then the remainder, 4, is one less than the number we are dividing by, which is 5.

Model solution. Let us fix q and induct on n. For the case n = 0, we must show that there are natural numbers m,r such that 0 r < q and 0 = mq + r. We can take m = 0 and r = 0. Indeed, we have 0 0 < q (since q is positive) and 0 = 0 × q + 0.

Now suppose inductively that there are natural numbers m,r such that 0 r < q and n = mq + r. We must show that there are natural numbers m,r such that 0 r < q and n + 1 = mq + r.

We have two cases, r + 1 = q and r + 1q. If r + 1 = q, we can take m := m + 1 and r := 0. Then 0 r = 0 < q and we have mq + r equal to (m + 1)q + 0 by definition of m,r, which equals mq + q by the distributive law, which equals mq + r + 1 by using q = r + 1, which equals n + 1 by the inductive hypothesis n = mq + r. Thus mq + r = n + 1 as required.

Now suppose r + 1q. In this case, r < q from the inductive hypothesis gives r + 1 q, so r + 1 < q. So we can take r := r + 1 and m := m. Now 0 r < q by what we just showed, and mq + r = mq + r + 1 = n + 1 by definition of m,r and the inductive hypothesis n = mq + r.

Source: Issa Rice’s blog.

User profile picture
2020-04-05 00:00
Comments

Proof. We induct on n (keeping q fixed).

1.
We first verify the base case n = 0, which is There exist natural numbers m and r such that 0 = qm + r.

Since 0 = q × 0 + 0, the base case follows.

2.
We now suppose inductively that there exist natural numbers m and r such that n = qm + r and 0 r < q for some natural number n.
3.
We now prove P(n + +), which is: There exist natural numbers m and r such that n + + = qm + r and 0 r < q.

Notice that by incrementing n by 1, either n + 1 becomes so big that a new q now fits inside it (i.e, m := m + 1) or it is still small enough and the rest of the division just gets incremented by one (i.e, r := r + 1).
We formulate this idea more formally. By Proposition 2.2.12, r < qr + 1 q; thus, we have two cases:

  • (r + 1 < q) Let m := m and r = r + 1. Then, we still have 0 r < q. Furthermore, by induction hypothesis,

    n + + = qm + (r + 1) = qm + r + 1 = qm + r.

  • (r + 1 = q) Let now m := m + 1 and r := 0. Then, we still have 0 r < q. Furthermore,

    n + + = qm + r + 1 = qm + q = qm + q + 0 = q(m + 1) + 0 = qm + r.

Therefore m and r are exactly those numbers we were looking for. This closes the induction.

User profile picture
2022-07-20 10:17
Comments