Sub topic 10
Division with remainder: n = dq + r
This chapter assumes you can do long division, work with negative integers, and read the factor and multiple vocabulary from the earlier chapters. Here you will turn "divide and look at what is left over" into one equation. That equation is the base for the remainder arithmetic, consecutive-integer, and units-digit chapters that follow.
The statement
Let n be any integer and d a positive integer. Then there are exactly one integer q (the quotient) and exactly one integer r (the remainder) such that:
n = dq + r, with 0 ≤ r < d
The condition 0 ≤ r < d is what makes q and r unique. Without it, 47 = 5(8) + 7 would be a valid-looking equation, but 7 is not a remainder because it is at least as large as the divisor 5.
The GRE uses this convention: the remainder is never negative and always smaller than the divisor. The remainder is 0 exactly when d divides n.
| n | d | q | r | Equation |
|---|---|---|---|---|
| 47 | 5 | 9 | 2 | 47 = 5(9) + 2 |
| 100 | 7 | 14 | 2 | 100 = 7(14) + 2 |
| 23 | 23 | 1 | 0 | 23 = 23(1) + 0 |
| 3 | 8 | 0 | 3 | 3 = 8(0) + 3 |
| -7 | 5 | -2 | 3 | -7 = 5(-2) + 3 |
| -20 | 6 | -4 | 4 | -20 = 6(-4) + 4 |
How to find q and r
Find the largest multiple of d that does not exceed n. That multiple is dq. The remainder is what is left, r = n - dq.
Two cases deserve attention.
- Small positive n (n < d). The largest multiple of d not exceeding n is 0, so q = 0 and r = n. For example, 3 divided by 8 has quotient 0 and remainder 3.
- Negative n. "Largest multiple not exceeding n" means stepping down, not toward zero. For -7 and d = 5, the multiples of 5 are ..., -10, -5, 0, .... The largest one at most -7 is -10 = 5(-2). So q = -2 and r = -7 - (-10) = 3.
Python's divmod follows this convention when d is positive, so you can use it to check your work.
def divide(n, d):
q, r = divmod(n, d)
assert n == d * q + r and 0 <= r < d
return q, r
for n, d in [(47, 5), (-7, 5), (3, 8), (100, 7), (-20, 6)]:
print(n, d, divide(n, d))
# 47 5 (9, 2)
# -7 5 (-2, 3)
# 3 8 (0, 3)
# 100 7 (14, 2)
# -20 6 (-4, 4)Reading remainder statements
The GRE rarely says "n = dq + r". It says "when n is divided by 5, the remainder is 2." Translate it immediately:
n = 5q + 2, where q is an integer.
Because q can be any integer, this describes a whole family of numbers. With d = 5 and r = 2 it contains ..., -8, -3, 2, 7, 12, 17, .... Consecutive members differ by exactly d. This family view is more useful than any single example.
The translation also tells you what the problem is hiding:
- The divisor is larger than the remainder. If the remainder is 4, then d ≥ 5. If a problem says "remainder 6 when divided by d," you know d > 6.
- q is an integer, but it might be 0 or negative. Unless the problem says n is positive, do not assume q ≥ 1.
- Subtracting the remainder gives a multiple. If n = 5q + 2, then n - 2 is a multiple of 5. This is often the fastest route to a conclusion.
The remainder as a fraction
Divide both sides of n = dq + r by d:
n / d = q + r / d
Since 0 ≤ r / d < 1, the quotient q is the whole-number part of n/d, and r/d is the fractional part, when n/d is positive. For 47/5 = 9.4, the whole part is 9 and the fractional part is 0.4. Multiplying the fractional part by the divisor recovers the remainder: 0.4 × 5 = 2.
This is useful when a problem gives a decimal. If n/d = 7.25 and d = 12, then r = 0.25 × 12 = 3. Note that this only works when n is positive. For negative n, the decimal part is not r/d. For -7/5 = -1.4, the whole part is -1, not the -2 that the division algorithm uses.
Changing the divisor
Suppose n leaves remainder 5 when divided by 12. Then n = 12k + 5. What is the remainder when n is divided by 4?
Since 12k is a multiple of 4, only the 5 matters. Write 5 = 4(1) + 1, so n = 4(3k + 1) + 1. The remainder is 1.
This works because 4 divides 12. The new divisor must be a factor of the old one. If you tried to divide by 5, you would learn nothing definite: n = 12k + 5 gives n = 5, 17, 29, 41, ..., with remainders 0, 2, 4, 1 when divided by 5.
The reverse direction also fails. Knowing the remainder on division by 4 does not determine the remainder on division by 12.
Combining two remainder conditions
A common numeric-entry task gives two conditions: n leaves remainder 2 on division by 5 and remainder 3 on division by 7. Find the smallest positive n.
List numbers of the form 5q + 2: 2, 7, 12, 17, 22, .... Check each for remainder 3 on division by 7. The number 17 works, because 17 = 7(2) + 3. Once you have one solution, the others are spaced by lcm(5, 7) = 35: adding 35 to n keeps both remainders. You can confirm this by brute force.
solutions = [n for n in range(1, 100) if n % 5 == 2 and n % 7 == 3]
print(solutions) # [17, 52, 87]The spacing of 35 matches the gaps 17 → 52 → 87. For small divisors, listing is faster than algebra. Start with the larger divisor's family, because it has fewer members to check.
Common errors
- Allowing r ≥ d. Writing 47 = 5(8) + 7 is a sign of an unfinished division. Keep subtracting multiples of d until r < d.
- Treating remainder 0 as "no remainder." Zero is a legitimate remainder. It means d divides n. A statement like "the remainder is 0 when n is divided by 6" is the same as "n is a multiple of 6."
- Giving a negative remainder. For -7 ÷ 5, "quotient -1, remainder -2" is not the GRE's answer. Use q = -2 and r = 3.
- Forgetting n < d. If n is smaller than d, the quotient is 0 and the remainder is n itself. The remainder of 4 divided by 9 is 4, not 0.
- Testing one number. The statement "n leaves remainder 2 on division by 5" describes a family. A conclusion that holds for n = 7 may fail for n = 12.
Why this matters on the GRE
In a quantitative comparison, the remainder form lets you test the extremes of a family without guessing. If n = 5q + 2 and the question asks whether n is even, try q = 0 (n = 2, even) and q = 1 (n = 7, odd). Different answers settle it: the relationship cannot be determined. The next chapters build on this form to find remainders of sums and products without computing the full numbers.
Exercise
When the positive integer n is divided by 9, the quotient is 6 and the remainder is 4. What is n?
Show answer
n = 9(6) + 4 = 58.
Exercise
Write -17 in the form 6q + r with 0 ≤ r < 6, and give q and r.
Show answer
The multiples of 6 at or below -17 are ..., -24, -18, -12, .... The largest one not exceeding -17 is -18 = 6(-3). So q = -3 and r = -17 - (-18) = 1. Check: 6(-3) + 1 = -17.
Exercise
The integer n leaves remainder 7 when divided by 15. What is the remainder when n is divided by 5? Why does the method work?
Show answer
The remainder is 2. Write n = 15k + 7. Since 15k is a multiple of 5 and 7 = 5(1) + 2, we get n = 5(3k + 1) + 2. The method works because 5 is a factor of 15.
Exercise
A positive integer n leaves remainder 1 when divided by 4 and remainder 2 when divided by 5. Find the smallest such n and describe all others.
Show answer
The numbers 4q + 1 are 1, 5, 9, 13, 17, .... Checking remainder 2 on division by 5, the first is 17 = 5(3) + 2. All solutions are 17 + 20k, because lcm(4, 5) = 20. The next solutions are 37, 57, 77.