See How Things Work

The division algorithm: dividend, divisor, quotient and remainder

Unit
Division
Part
1. Division
Lesson
1.5

Every whole number a divided by a nonzero whole number b gives exactly one quotient q and one remainder r, with a = q × b + r and 0 ≤ r < b. This lesson states this theorem, the division algorithm, names its four numbers, shows how to check any claimed division with it, works through its special cases, and finds every remainder that division by b can leave.

The theorem and its name

The lesson “Division with remainder” put 17 counters into groups of 5 and found 3 groups with 2 counters left over: 17 = 3 × 5 + 2. It then proved that this always works, for every dividend and every nonzero divisor, and that the result is always the same. That result has a name.

Theorem (the division algorithm).

Let a be a whole number and b a whole number with b ≠ 0. There is exactly one pair of whole numbers q and r such that

a = q × b + r and 0 ≤ r < b.⁠[1][2]

Proof.

This is the Theorem of the lesson “Division with remainder”, proved there in two parts. Existence: among the multiples 0 × b, 1 × b, 2 × b, … of b, take the largest one, q × b, that is not more than a; then r = a − q × b is a whole number, and r < b because the next multiple, q × b + b, is already more than a. Uniqueness: if a = q × b + r = s × b + t with r and t both less than b, then q and s cannot differ, since one more group of b would add at least b, which is more than the whole remainder; so q = s, and then r = t.

Two remarks on the statement. First, for whole numbers the condition 0 ≤ r holds automatically, since no whole number is less than 0. It is written anyway, because this is the standard form of the theorem, the one that stays correct when the unit Integers allows negative numbers.⁠[1][2] Second, the books write the product in either order: one writes a = dq + r with the divisor first,⁠[1] another a = qb + r with the quotient first.⁠[2] By the commutative property of multiplication the two say the same thing. This unit writes a = q × b + r: q groups of b, and r more.

Convention.

Despite its name, the division algorithm is not an algorithm, that is, not a list of steps to carry out: it is a theorem that says the quotient and remainder exist and are unique. The name is traditional, and it is kept.⁠[3] Methods that actually compute q and r are algorithms in the proper sense. The simplest is repeated subtraction: subtract b from a as many times as possible, so that what is left is less than b; the number of subtractions is q and what is left is r.⁠[4] The lesson “Long division” gives a much faster one.

The theorem is short, but much of arithmetic rests on it. A standard textbook of number theory calls it the foundation stone of its whole development.⁠[5] Later units of this course build on it: divisibility, even and odd numbers, common divisors, and writing numbers in other bases.

Dividend, divisor, quotient, remainder

Definition (The four numbers of a division).

In the equation a = q × b + r of the division algorithm, a is the dividend, b is the divisor, q is the quotient and r is the remainder.⁠[6]

These are the names already used in this unit. The dividend is the number being divided and the divisor is the number it is divided by.⁠[7] The quotient is the result of the division;⁠[8] when the division does not come out exactly, the remainder records what is left over. In the shorthand of lesson 1.4, a ÷ b = q R r.

100dividend=7quotient×13divisor+9remainderand 0 ≤ 9 < 13
Figure. The four numbers of a division and their names.⁠[6] The remainder must be less than the divisor: here 9 is less than 13, so this equation is the division of 100 by 13.
Convention.

Books on computing and number theory also write the quotient and remainder as q = a div b and r = a mod b, so that 100 div 13 = 7 and 100 mod 13 = 9.⁠[9] This site keeps the words quotient and remainder, and the shorthand q R r.

Example (Naming the parts).

Divide 100 by 13 and name the four numbers.

  1. Multiples of 13: 7 × 13 = 91 and 8 × 13 = 104.
  2. 91 is not more than 100 and 104 is more, so 7 × 13 = 91 is the largest multiple of 13 not more than 100. So q = 7.
  3. r = 100 − 91 = 9.
  4. Check: 7 × 13 + 9 = 91 + 9 = 100, and 0 ≤ 9 < 13.

Answer: 100 = 7 × 13 + 9. The dividend is 100, the divisor 13, the quotient 7 and the remainder 9: 100 ÷ 13 = 7 R 9.

An equation of the form a = q × b + r does not say by itself which division it describes. The divisor is part of the question, and the condition on the remainder refers to it.

Example (One equation, two possible divisors).

The equation 100 = 7 × 13 + 9 is true. Is it also the division of 100 by 7?

  1. Read with divisor 7, the equation is 100 = 13 × 7 + 9: quotient 13, remainder 9.
  2. The remainder must be less than the divisor. But 9 is not less than 7: the 9 left over still contain a group of 7.
  3. Move that group into the quotient: 100 = 14 × 7 + 2.
  4. Check: 14 × 7 + 2 = 98 + 2 = 100, and 0 ≤ 2 < 7.

Answer: no. The same equation is the division of 100 by 13, but the division of 100 by 7 is 100 = 14 × 7 + 2, that is, 100 ÷ 7 = 14 R 2. The condition r < b decides which reading is a division.

Checking a division

A division with no remainder is checked by multiplying the quotient by the divisor and comparing the product with the dividend.⁠[10] A division with a remainder needs one more step and one more condition. By the definition, a claimed result “a ÷ b = q R r” is correct exactly when both of these hold:

  1. The equation holds: q × b + r = a.
  2. The remainder is small enough: r < b.
Proposition .

Let b ≠ 0. If whole numbers q and r pass both checks for a and b, then q is the quotient and r the remainder of a divided by b. If either check fails, they are not.

Proof.

If both checks pass, q and r satisfy a = q × b + r and 0 ≤ r < b. By the uniqueness part of the division algorithm, only one pair does, the quotient and the remainder; so q and r are that pair. If a check fails, q and r do not satisfy the conditions that define the quotient and remainder, so they are not them.

So the two checks together are a complete proof that an answer is right, however it was found. Each failure also points to its cause:

  • q × b is more than a. The quotient is too large: no whole number r can then make q × b + r equal to a.
  • q × b is not more than a, but q × b + r is not a. The remainder is wrong, through an error of arithmetic in the multiplication or the subtraction: for this q it would have to be a − q × b.
  • The equation holds but r ≥ b. The quotient is too small: the leftover still contains at least one more group of b.
Example (A check that passes).

Check the claim 1,000 ÷ 7 = 142 R 6.

  1. 142 × 7 = 994 (100 × 7 = 700, 40 × 7 = 280, 2 × 7 = 14, and 700 + 280 + 14 = 994).
  2. 994 + 6 = 1,000, the dividend. The first check passes.
  3. 6 < 7. The second check passes.

Answer: the claim is correct: 1,000 = 142 × 7 + 6. By the Proposition, no other quotient and remainder are possible.

Example (A mistake: the quotient is too small).

Someone divides 85 by 6 and writes 13 R 7. Check it and correct it.

  1. 13 × 6 = 78, and 78 + 7 = 85. The equation holds.
  2. But 7 is not less than 6: the remainder fails the second check. The 7 left over contain another group of 6.
  3. Move one group of 6 into the quotient: 14 × 6 = 84, and 85 − 84 = 1.
  4. Check again: 14 × 6 + 1 = 85, and 1 < 6.

Answer: 85 ÷ 6 = 14 R 1, not 13 R 7.

Example (A mistake: the quotient is too large).

Someone divides 85 by 6 and gives the quotient 15. What remainder would that need?

  1. 15 × 6 = 90, which is more than 85.
  2. A remainder r would have to satisfy 90 + r = 85. No whole number does: adding a whole number to 90 never gives less than 90.
  3. So 15 groups of 6 do not fit into 85. The largest number of groups that fits is 14, as in the previous example.

Answer: no remainder works; the quotient 15 is too large, and the division is 85 = 14 × 6 + 1.

Game

Which equation is the division?

Round
1
Score
0
Streak
0

Which equation gives the quotient and the remainder of 27 ÷ 5? The line shows the multiples of 5.

05101520253027

Special cases

The theorem allows every whole number a and every nonzero divisor b. Its special cases follow directly from the two conditions, and each can be checked like any other division.

  • r = 0. Then a = q × b: the division comes out exactly, a ÷ b = q in the sense of the lesson “Division as the inverse of multiplication”. Conversely, if b goes into a exactly, the remainder is 0. A whole number whose remainder on division by b is 0 is said to be divisible by b.⁠[11] (Divisibility is studied in the unit Factors, Multiples & Primes.)
  • a < b. Then a = 0 × b + a with 0 ≤ a < b, so q = 0 and r = a: not even one group of b fits.
  • a = 0. Then 0 = 0 × b + 0, so q = 0 and r = 0, whatever the divisor.
  • b = 1. The remainder must be less than 1, so r = 0 and q = a: a = a × 1 + 0.
  • b = a, with a ≠ 0. a = 1 × a + 0, so q = 1 and r = 0.
  • b = 0. Excluded: the remainder would have to be a whole number less than 0, and there is none. This is the lesson “Why division by zero is undefined” seen from the division algorithm.
Example (Edge cases).

Find the quotient and remainder of 5 ÷ 12, 0 ÷ 12, 48 ÷ 12 and 47 ÷ 1.

  1. 5 ÷ 12: 5 < 12, so q = 0 and r = 5. Check: 0 × 12 + 5 = 5, and 5 < 12.
  2. 0 ÷ 12: q = 0 and r = 0. Check: 0 × 12 + 0 = 0, and 0 < 12.
  3. 48 ÷ 12: 4 × 12 = 48, so q = 4 and r = 0. Check: 4 × 12 + 0 = 48, and 0 < 12.
  4. 47 ÷ 1: q = 47 and r = 0. Check: 47 × 1 + 0 = 47, and 0 < 1.

Answer: 0 R 5, 0 R 0, 4 R 0 (exactly 4) and 47 R 0 (exactly 47).

The possible remainders

The condition 0 ≤ r < b allows exactly the remainders 0, 1, 2, …, b − 1: there are b of them. Every one of them occurs, since the number r itself, for r from 0 to b − 1, has quotient 0 and remainder r. For b = 2, for example, the possible remainders are only 0 and 1.⁠[12]

Proposition .

Let b ≠ 0, and let a have quotient q and remainder r on division by b. Then a + 1 has the remainder r + 1 and the same quotient q if r + 1 < b; if r + 1 = b, then a + 1 has remainder 0 and quotient q + 1.

Proof.

From a = q × b + r we get a + 1 = q × b + (r + 1). If r + 1 < b, this equation already passes both checks, so q and r + 1 are the quotient and remainder of a + 1. If r + 1 = b, then a + 1 = q × b + b = (q + 1) × b + 0, by the distributive property; this passes both checks with quotient q + 1 and remainder 0.

So as a runs through 0, 1, 2, 3, …, its remainder on division by b runs through 0, 1, …, b − 1 and then starts again at 0, forever, and the quotient goes up by one each time the remainder starts again. Written in rows of b, the whole numbers fall into b columns, one for each remainder. For b = 4, every whole number has exactly one of the four forms 4 × q, 4 × q + 1, 4 × q + 2 and 4 × q + 3.⁠[13]

04 × q14 × q + 124 × q + 234 × q + 3remainderformq = 00123q = 14567q = 2891011q = 312131415q = 416171819q = 520212223
Figure. The numbers 0 to 23 written in rows of four. The row of a number is its quotient q on division by 4 and its column is the remainder, so every whole number has exactly one of the four forms 4 × q, 4 × q + 1, 4 × q + 2, 4 × q + 3.⁠[13] Going on to the next number moves one column to the right, and after remainder 3 the next row starts again at remainder 0.

This is why the division algorithm is so useful: a statement about all whole numbers can often be proved by checking only the b possible remainders, a finite number of cases.⁠[14]

Looking ahead.

For b = 2 the two forms are 2 × q and 2 × q + 1. The numbers with remainder 0 are called even and those with remainder 1 odd.⁠[12] They are the subject of the lesson Even and odd numbers in the unit Factors, Multiples & Primes.

Example (A repeating pattern).

A string of beads repeats four colors: bead 1 is red, bead 2 yellow, bead 3 blue, bead 4 green, bead 5 red again, and so on. What color is bead 100? And bead 103?

  1. The colors repeat every 4 beads, so the color of bead n depends only on the remainder of n ÷ 4.
  2. Read the first four beads: remainder 1 is red, remainder 2 yellow, remainder 3 blue, and remainder 0 (bead 4) green.
  3. 100 = 25 × 4 + 0, so bead 100 has remainder 0: green.
  4. 103 = 25 × 4 + 3, so bead 103 has remainder 3: blue.

Answer: bead 100 is green and bead 103 is blue. A common mistake is to take remainder 0 as the first color, red. Remainder 0 belongs with bead 4, the last of each block of four, not the first.

Exercises

Exercise .

Write the division of 58 by 9 in the form a = q × b + r, and name the four numbers.

▸ Show solution

6 × 9 = 54 and 7 × 9 = 63, so the largest multiple of 9 not more than 58 is 54: q = 6 and r = 58 − 54 = 4. So 58 = 6 × 9 + 4. The dividend is 58, the divisor 9, the quotient 6 and the remainder 4. Check: 54 + 4 = 58, and 4 < 9.

Exercise .

Check each claim, and correct it if it is wrong: (a) 99 ÷ 8 = 12 R 3; (b) 97 ÷ 8 = 11 R 9; (c) 100 ÷ 8 = 13 R 0.

▸ Show solution

(a) 12 × 8 + 3 = 96 + 3 = 99, and 3 < 8: correct.

(b) 11 × 8 + 9 = 88 + 9 = 97, so the equation holds, but 9 is not less than 8: incorrect. The correct result is 12 R 1.

(c) 13 × 8 = 104 is more than 100: the quotient is too large. 100 = 12 × 8 + 4, so 100 ÷ 8 = 12 R 4.

Exercise .

The equation 109 = 9 × 11 + 10 is true. Is it the division of 109 by 11? By 9? Give both divisions.

▸ Show solution

The equation is true: 9 × 11 = 99 and 99 + 10 = 109. Divided by 11, the remainder 10 is less than 11, so 109 ÷ 11 = 9 R 10. Divided by 9 (reading 109 = 11 × 9 + 10), the remainder 10 is not less than 9, so this is not the division by 9; in fact 109 = 12 × 9 + 1, so 109 ÷ 9 = 12 R 1.

Exercise .

A list of days is numbered 1, 2, 3, …, and the names repeat in the cycle Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday, starting with day 1 on a Monday. What is day 50? Day 70?

▸ Show solution

The days repeat every 7, so day n of the sequence has the weekday of the remainder of n ÷ 7, with remainder 1 for the first day, a Monday. 50 = 7 × 7 + 1, so day 50 has remainder 1: Monday. 70 = 10 × 7 + 0, and remainder 0 belongs with day 7, a Sunday: day 70 is a Sunday.

Exercise .

List the possible remainders on division by 5 and the corresponding forms of a whole number. Find the remainders of 20, 21, …, 25, and the form of 43.

▸ Show solution

The remainders on division by 5 are 0, 1, 2, 3 and 4, so every whole number has one of the forms 5 × q, 5 × q + 1, 5 × q + 2, 5 × q + 3, 5 × q + 4. From 20 to 24 the remainders are 0, 1, 2, 3, 4; 25 = 5 × 5 + 0 starts the cycle again. 43 = 8 × 5 + 3 has the form 5 × q + 3.

Exercise .

Suppose a divided by b (b ≠ 0) has quotient q and remainder r. Find the quotient and remainder of 2 × a divided by b. (Two cases.) Test your answer on 10 and 12 divided by 7.

▸ Show solution

Write a = q × b + r with 0 ≤ r < b. Multiplying both sides by 2 and using the distributive property: 2 × a = (2 × q) × b + 2 × r.

If 2 × r < b, this passes both checks, so 2 × a has quotient 2 × q and remainder 2 × r. If 2 × r ≥ b, then 2 × r − b is a whole number, and it is less than b because r < b gives 2 × r < 2 × b. Then 2 × a = (2 × q + 1) × b + (2 × r − b), so the quotient is 2 × q + 1 and the remainder 2 × r − b. Example with b = 7: 10 = 1 × 7 + 3 and 20 = 2 × 7 + 6 (6 < 7); 12 = 1 × 7 + 5 and 24 = 3 × 7 + 3 (since 10 ≥ 7, the remainder is 10 − 7 = 3).

Summary

  1. The division algorithm: for every whole number a and every whole number b ≠ 0 there is exactly one pair of whole numbers q, r with a = q × b + r and 0 ≤ r < b.
  2. In a = q × b + r, a is the dividend, b the divisor, q the quotient and r the remainder. Despite its name, the division algorithm is a theorem; repeated subtraction and long division are algorithms that compute q and r.
  3. A claimed division a ÷ b = q R r is correct exactly when q × b + r = a and r < b. By uniqueness, passing both checks proves the answer.
  4. The remainder is 0 exactly when b goes into a exactly; if a < b, the quotient is 0 and the remainder a; b = 0 is excluded.
  5. Division by b has exactly the b remainders 0, 1, …, b − 1; as a increases by 1, they repeat in a cycle, so every whole number has one of b forms such as 4 × q + 3.

Sources

  1. 1.
    Kenneth H. Rosen, Discrete Mathematics and Its Applications (8th ed., McGraw-Hill, 2019).
    Chapter 4, “Number Theory and Cryptography”, section 4.1, “Divisibility and Modular Arithmetic” (4.1.3, “The Division Algorithm”), Theorem 2, p. 253 (the whole topic: pp. 253–254).
    “Let a be an integer and d a positive integer. Then there are unique integers q and r, with 0 ≤ r < d, such that a = dq + r.”
    Used for: the statement of the division algorithm (a = q × b + r with 0 ≤ r < b, q and r unique), stated in the source for all integers a and written there with the divisor first, a = dq + r; the condition 0 ≤ r is part of its standard form.
  2. 2.
    David M. Burton, Elementary Number Theory (7th ed., McGraw-Hill, 2011).
    Chapter 2, “Divisibility Theory in the Integers”, section 2.2, “The Division Algorithm”, Theorem 2.1, p. 17 (the whole topic: pp. 17–19).
    “Division Algorithm. Given integers a and b, with b > 0, there exist unique integers q and r satisfying”
    Used for: the statement of the division algorithm; the source's displayed conditions are a = qb + r and 0 ≤ r < b, with the quotient written first.
  3. 3.
    Kenneth H. Rosen, Discrete Mathematics and Its Applications (8th ed., McGraw-Hill, 2019).
    Chapter 4, “Number Theory and Cryptography”, section 4.1, “Divisibility and Modular Arithmetic” (4.1.3, “The Division Algorithm”), p. 253 (the whole topic: pp. 253–254).
    “Remark: Theorem 2 is not really an algorithm. (Why not?) Nevertheless, we use its traditional name.”
    Used for: the division algorithm is not an algorithm but a theorem; its name is traditional and is kept.
  4. 4.
    Kenneth H. Rosen, Discrete Mathematics and Its Applications (8th ed., McGraw-Hill, 2019).
    Chapter 4, “Number Theory and Cryptography”, section 4.2, “Integer Representations and Algorithms” (4.2.3, “Algorithms for Integer Operations”), p. 267 (the whole topic: pp. 267).
    “we subtract d from a as many times as necessary until what is left is less than d. The number of times we perform this subtraction is the quotient and what is left over after all these subtractions is the remainder.”
    Used for: repeated subtraction is an algorithm that computes q and r: the number of subtractions is q and what is left is r.
  5. 5.
    David M. Burton, Elementary Number Theory (7th ed., McGraw-Hill, 2011).
    Chapter 2, “Divisibility Theory in the Integers”, section 2.2, “The Division Algorithm”, p. 17 (the whole topic: pp. 17–19).
    “One theorem, the Division Algorithm, acts as the foundation stone upon which our whole development rests.”
    Used for: a standard textbook of number theory calls the division algorithm the foundation stone of its whole development.
  6. 6.
    Kenneth H. Rosen, Discrete Mathematics and Its Applications (8th ed., McGraw-Hill, 2019).
    Chapter 4, “Number Theory and Cryptography”, section 4.1, “Divisibility and Modular Arithmetic” (4.1.3, “The Division Algorithm”), Definition 2, p. 253 (the whole topic: pp. 253–254).
    “In the equality given in the division algorithm, d is called the divisor, a is called the dividend, q is called the quotient, and r is called the remainder.”
    Used for: the names dividend, divisor, quotient and remainder of the four numbers in a = q × b + r.
  7. 7.
    Lynn Marecek, MaryAnne Anthony-Smith and Andrea Honeycutt Mathis, Prealgebra (2nd ed., OpenStax, Rice University, 2020).
    Chapter 1, “Whole Numbers”, section 1.5, “Divide Whole Numbers”: “Use Division Notation”, p. 69 (the whole topic: pp. 68–70).
    “We call the number being divided the dividend and the number dividing it the divisor.”
    Used for: the dividend is the number being divided and the divisor the number it is divided by.
  8. 8.
    Lynn Marecek, MaryAnne Anthony-Smith and Andrea Honeycutt Mathis, Prealgebra (2nd ed., OpenStax, Rice University, 2020).
    Chapter 1, “Whole Numbers”, section Key Terms (glossary of chapter 1), p. 85 (the whole topic: pp. 85).
    “The quotient is the result of dividing two numbers.”
    Used for: the quotient is the result of the division.
  9. 9.
    Kenneth H. Rosen, Discrete Mathematics and Its Applications (8th ed., McGraw-Hill, 2019).
    Chapter 4, “Number Theory and Cryptography”, section 4.1, “Divisibility and Modular Arithmetic” (4.1.3, “The Division Algorithm”), Definition 2, p. 253 (the whole topic: pp. 253–254).
    “This notation is used to express the quotient and remainder: q = a div d, r = a mod d.”
    Used for: the notation q = a div b and r = a mod b for the quotient and the remainder (the source names the divisor d).
  10. 10.
    Lynn Marecek, MaryAnne Anthony-Smith and Andrea Honeycutt Mathis, Prealgebra (2nd ed., OpenStax, Rice University, 2020).
    Chapter 1, “Whole Numbers”, section 1.5, “Divide Whole Numbers”: “Divide Whole Numbers”, p. 70 (the whole topic: pp. 70–80).
    “We check our answer to division by multiplying the quotient by the divisor to determine if it equals the dividend.”
    Used for: a division with no remainder is checked by multiplying the quotient by the divisor and comparing the product with the dividend.
  11. 11.
    Kenneth H. Rosen, Discrete Mathematics and Its Applications (8th ed., McGraw-Hill, 2019).
    Chapter 4, “Number Theory and Cryptography”, section 4.1, “Divisibility and Modular Arithmetic” (4.1.3, “The Division Algorithm”), p. 254 (the whole topic: pp. 253–254).
    “Note that the integer a is divisible by the integer d if and only if the remainder is zero when a is divided by d.”
    Used for: a whole number is divisible by b exactly when its remainder on division by b is 0.
  12. 12.
    David M. Burton, Elementary Number Theory (7th ed., McGraw-Hill, 2011).
    Chapter 2, “Divisibility Theory in the Integers”, section 2.2, “The Division Algorithm”, p. 18 (the whole topic: pp. 17–19).
    “As a first illustration, note that with b = 2 the possible remainders are r = 0 and r = 1. When r = 0, the integer a has the form a = 2q and is called even; when r = 1, the integer a has the form a = 2q + 1 and is called odd.”
    Used for: for b = 2 the possible remainders are 0 and 1; the numbers with remainder 0 are called even, those with remainder 1 odd.
  13. 13.
    David M. Burton, Elementary Number Theory (7th ed., McGraw-Hill, 2011).
    Chapter 2, “Divisibility Theory in the Integers”, section 2.2, “The Division Algorithm”, p. 18 (the whole topic: pp. 17–19).
    “For, by the Division Algorithm, any integer is representable as one of the four forms: 4q, 4q + 1, 4q + 2, 4q + 3.”
    Used for: every whole number has exactly one of the forms 4 × q, 4 × q + 1, 4 × q + 2, 4 × q + 3 (the figure of the numbers in rows of four).
  14. 14.
    David M. Burton, Elementary Number Theory (7th ed., McGraw-Hill, 2011).
    Chapter 2, “Divisibility Theory in the Integers”, section 2.2, “The Division Algorithm”, p. 18 (the whole topic: pp. 17–19).
    “As these remarks indicate, the advantage of the Division Algorithm is that it allows us to prove assertions about all the integers by considering only a finite number of cases.”
    Used for: a statement about all whole numbers can often be proved by checking only the possible remainders, a finite number of cases.