Loading [MathJax]/jax/output/HTML-CSS/jax.js

Lecture 29: Euclidean division

Terminology/Definitions

Euclidean division

Claim (Euclidean division algorithm): For any a and b>0 there exist q and r such that a=qb+r and 0r<b. Moreover, q and r are unique: if a=qb+r=qb+r then q=q and r=r.

Notation: - q is called the quotient of a by b, and is written quot(a,b). Some programming languages write a/b to refer to q. Do not do this. a/b should have the property that b(a/b)=a; the quotient does not have this property.

Proof of existence: By induction on a. Fix b and let P(a) be the statement "q,rZ such that a=qb+r." We must prove P(0) and P(a+1) assuming P(a).

For P(0), let q=r=0. Since b>0, 0r<b. Moreover, 0=qb+r as required.

To prove P(a+1), assume P(a). Then there exist some q and r<b with a=qb+r. Since r<b, either r=b1 or r<b1. We want to show that in either case, there exist q and r with a+1=qb+r.

In the former case, we have a=qb+r=qb+b1. Therefore a+1=qb+b=(q+1)b+0. Let q=q+1 and r=0, and we see that a+1=qb+r as required.

In the latter case, we can let q=q and r=r+1. Since 0r<b1, we see that 0r<b. Moreover, since a=qb+r, we see that a+1=qb+r as required.

Proof of uniqueness: Assume there are two pairs of numbers q1,r1 and q2,r2 with a=q1b+r1=q2b+r2 and with 0ri<b. We want to show that q1=q2 and r1=r2.

Rearranging q1b+r1=q2b+r2, we see that (q1q2)b=r2r1. I claim that b<r2r1<b, and the only multiple of b between b and b is 0, so r2r1=0.

To see this more carefully, we know 0r2<b. The same equation holds for r1; negating it yields b<r10. Adding these equations together gives b<r2r1<b.

Therefore r2r1=0, so r2=r1. Since (q1q2)b=r2r1=0 and since b0, we have q1q2=0, or q1=q2.