Processing math: 100%
Skip to main content
Library homepage
 

Text Color

Text Size

 

Margin Size

 

Font Type

Enable Dyslexic Font
Mathematics LibreTexts

1.5: The Division Algorithm

( \newcommand{\kernel}{\mathrm{null}\,}\)

The goal of this chapter is to introduce and prove the following important result.

Theorem 1.5.1: The Division Algorithm

If a and b are integers and b>0 then there exist unique integers q and r satisfying the two conditions: a=bq+rand0r<b.

In this situation q is called the quotient and r is called the remainder when a is divided by b. We sometimes refer to a as the dividend and b as the divisor.

(Some care must be taken with this last term, in light of how the divisor of an integer was defined in Section 1.4. It is correct both to say that 2 is not a divisor of 7, since 27, though 2 is the divisor when 7 is divided by 2, yielding 7=23+1. Context should make it clear which meaning is intended.)

Note that there are two parts to the Division Algorithm’s statement. One part is the existence of integers q and r satisfying (???), and the second part is the uniqueness of the integers q and r satisfying (???).

Proof

We first prove the existence of q and r.

If b divides a then a=kb for some integer k, and we may write q=k and r=0.

Suppose instead that b does not divide a, and consider the collection ,a3b,a2b,ab,a,a+b,a+2b,a+3b, of integers. Let S be the set of all these numbers that are non-negative. In symbols, S={akbkZ and akb0}.

The set S is non-empty, since by the Archimedean Property there exists a natural number n such that n>a and so nbn>a and hence a(n)b>0. Now by the Well-Ordering Principle S contains a smallest element; call it r. By our definition of S, this means that for some particular integer q we have r=aqb. Thus a=bq+r, and it only remains to show that 0r<b.

All the elements of S are positive, so it is clear that 0r. If it is not true that r<b, then abqb and so rb=a(q+1)b0; thus either rb is an element of S or rb=0. Since r was defined as the smallest element of S, it cannot be true that rb is in S. However, if rb=0, then a=bq+b=(q+1)b, which contradicts our assumption that b does not divide a. We are forced to conclude that 0r<b.

We still have to prove that q and r are uniquely determined. To do this we suppose that a=bq1+r1and0r1<b, and a=bq2+r2and0r2<b for integers q1,q2,r1,r2. We must show that r1=r2 and q1=q2. If r1r2 without loss of generality we can assume that r2>r1. Subtracting these two equations we obtain 0=aa=(bq1+r1)(bq2+r2)=b(q1q2)+(r1r2). This implies that r2r1=b(q1q2). This implies that br2r1. By Theorem 1.4.1(10) this implies that br2r1. But since 0r1<r2<b we have r2r1<b. This contradicts br2r1. So we must conclude that r1=r2. Now from (???) we have 0=b(q1q2). Since b>0 this tells us that q1q2=0, that is, q1=q2. This completes the proof of the uniqueness of r and q in (???).

In number theory we usually prefer to work with integers, but if we are willing to consider division of real numbers, it can be shown that when a is divided by b, the quotient and remainder satisfy q=abandr=abq=abab (see Exercise 1.5.2).

We now turn to some familiar concepts.

Definition 1.5.1

An integer n is even if n=2k for some k, and is odd if n=2k+1 for some k.

Definition 1.5.2

By the parity of an integer we mean whether it is even or odd.

Sometimes a problem in number theory can be solved by dividing the integers into various classes depending on their remainders when divided by some number b. For example, this is helpful in solving Exercises 1.5.5 and 1.5.6 at the end of this chapter.

Definition 1.5.3

For b>0 define amodb as the value of r in the pair q,r satisfying the expressions a=bq+r and 0r<b.

In other words, amodb is the remainder given by the Division Algorithm when a is divided by b.

For example 23mod7=2 since 23=73+2 and 4mod5=1 since 4=5(1)+1.

Note that some calculators and most programming languages have a function often denoted by MOD(a,b) or mod(a,b) whose value is what we have just defined as amodb. When this is the case the values r and q in the Division Algorithm for given a and b>0 are given by r=amodbq=a(amodb)b If also the floor function is available we have r=amodbq=a/b

Exercises

Exercise 1.5.1

Find the values of q and r in the Division Algorithm for the following values of a and b:

  1. Let b=3 and a=0,1,1,10,10.
  2. Let b=345 and a=0,1,1,344,7863,7863.
Exercise 1.5.2

Given integers b>0 and a, let q and r be the quotient and remainder when b is divided by a, so a=bq+r. Carefully prove that q=ab.

Exercise 1.5.3

Using the Division Algorithm, prove that every integer is either even or odd, but never both.

Exercise 1.5.4

Prove n and n2 always have the same parity. That is, n is even if and only if n2 is even.

Exercise 1.5.5

Show that for all integers n the number n3n always has 3 as a factor.

(Hint: by the Division Algorithm, every integer n falls into one of three cases: n=3k, n=3k+1, n=3k+2. Prove that n3n is divisible by 3 for each of these cases separately.)

Exercise 1.5.6

Show that the product of any three consecutive integers has 6 as a factor. (How many cases should you use here?)

Exercise 1.5.7

Prove the following:

  1. If b>0 and ba, then amodb=0.
  2. If b>0 and amodb=0, then ba.
Exercise 1.5.8

Calculate the following:

  1. 0mod10
  2. 123mod10
  3. 10mod123
  4. 457mod33
  5. (7)mod3
  6. (3)mod7
  7. (5)mod5
Exercise 1.5.9
  1. Use the Division Algorithm to prove the following similar theorem: If b>0 then for any a there exists unique integers p and s such that a=bp+sandb/2<sb/2.
  2. Find integers p and s such that a=bp+s and b/2<sb/2 for
    1. a=36,b=13
    2. a=75,b=50
    3. a=75,b=49.

This page titled 1.5: The Division Algorithm is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by Mike Barrus & W. Edwin Clark.

Support Center

How can we help?