When an integer is divided by a second integer, the quotient may or may not be an integer.
Def: If a and b are integers, a divides b if there exists an integer c such that b=ac. This makes a a factor of b.
If a divides b, we write a∣b. Otherwise, a∤b.
Proposition 1: If a,b,c are integers with a∣b and b∣c, then a∣c.
Proof: Since a∣b and b∣c, there exist integers e,f with ae=b and bf=c. Hence, bf=(ae)f=a(ef)=c, and a∣c.
Proposition 2: If a,b,m,n are integers, and if c∣a and c∣b, then c∣(ma+nb).
Proof: Since c∣a and c∣b, there are integers e,f such that a=ce and b=cf. Hence, ma+nb=mce+ncf=c(me+nf). Consequently, c∣(ma+nb).
Ex: Since 3∣21 and 3∣33, Proposition 2 asserts that:
3∣(5∗21−3∗33)=105−99=6
The division theorem
If a,b are integers such that b>0, then there are unique integers q,r such that a=bq+r, with 0<=r<b.
To prove this, let's define a new function.
Def: Let x be a real number. The greatest integer in x, denoted by [x], is the largest integer less than or equal to x.
Ex: [2.2]=2,[3]=3,[−1.5]=−2
Proposition 3: If x is a real number, then x−1<[x]<=x.
We can now prove the division algorithm. We give explicit formulae for the quotient and remainder in terms of the greatest integer function.
Proof: Let q=[a/b] and r=a−b[a/b]. Clearly, a=bq+r. To show that the remainder r satisfies the appropriate inequality, note Proposition 3:
(a/b)−1<[a/b]<=a/b
Multiply all sides by b.
a−b<b[a/b]<=a
Multiply all sides by −1.
−a+b>−b[a/b]>=−a
Add a.
b>−b[a/b]+a>=0
To show that q and r are relatively unique, assume that we have two equations: a=bq1+r1 and a=bq2+r2, with 0<=r1,r2<b. By subtracting the second of these from the first, we find:
0=b(q1−q2)+(r1−r2)
Hence:
r2−r1=b(q1−q2)
This tells us that b divides r2−r1. Since 0<=r1,r2<b, −b<r2−r1<b. This shows that b can divide r2−r1 only if r2−r1=0, so if r1=r2. bq1+r1=bq2+r2∴q1=q2. This shows that q and r are unique.
Ex: Let a=1028,b=34. Then a=bq+r with 0<=r<b, where q=[1028/34]=30 and r=1028−[1028/34]∗34=1028−30∗34=8.