Sub topic 11
Remainders of Sums, Differences, and Products
Prerequisites and the division algorithm
Assume you can work with integers, negatives, zero, exponents, and basic long division.
When an integer \(n\) is divided by a positive integer \(d\), the result can always be written as
\[ n=dq+r \]
where \(q\) is the quotient and \(r\) is the remainder. The remainder must satisfy
\[ 0\le r<d. \]
For example,
\[ 47=5(9)+2, \]
so 47 has remainder 2 when divided by 5.
The remainder is always chosen from \(0\) through \(d-1\). Therefore, although \(-7=5(-1)-2\) is true, it does not use the standard remainder. The standard form is
\[ -7=5(-2)+3. \]
Thus, \(-7\) has remainder 3 when divided by 5.
Remainders and congruence
If two integers have the same remainder after division by \(d\), they are congruent modulo \(d\). The notation
\[ a\equiv b\pmod d \]
means that \(a\) and \(b\) leave the same remainder when divided by \(d\). Equivalently, \(d\) divides \(a-b\).
For example,
\[ 17\equiv 2\pmod 5 \]
because both 17 and 2 leave remainder 2 when divided by 5. Also,
\[ 17\equiv 7\pmod 5 \]
because 17 and 7 differ by 10, a multiple of 5.
You can replace a number with any simpler congruent number before adding or multiplying.
Sums, differences, and products
If
\[ a\equiv r1\pmod d \quad\text{and}\quad b\equiv r2\pmod d, \]
then
\[ a+b\equiv r1+r2\pmod d, \]
\[ a-b\equiv r1-r2\pmod d, \]
and
\[ ab\equiv r1r2\pmod d. \]
After calculating, reduce the result to a remainder from 0 through \(d-1\).
| Operation | Remainder calculation modulo \(d\) |
|---|---|
| Sum | Add the remainders, then reduce |
| Difference | Subtract the remainders, then reduce |
| Product | Multiply the remainders, then reduce |
For example, modulo 5,
\[ 17\equiv 2,\qquad 23\equiv 3. \]
Therefore,
\[ 17+23\equiv 2+3\equiv 0\pmod 5, \]
and
\[ 17\cdot23\equiv 2\cdot3\equiv 6\equiv 1\pmod 5. \]
For a difference, suppose \(a\equiv 2\pmod 5\) and \(b\equiv 4\pmod 5\). Then
\[ a-b\equiv 2-4\equiv -2\equiv 3\pmod 5. \]
The answer is 3, because 3 is the standard remainder equivalent to \(-2\) modulo 5.
print((17 * 23) % 5) # 1
print(((17 % 5) * (23 % 5)) % 5) # 1
print((-2) % 5) # 3A visual model
GRE strategy
Reduce large numbers early. This prevents unnecessary arithmetic and makes patterns visible. In quantitative comparison questions, look for whether an expression is always divisible by the modulus or whether different choices produce different remainders.
Be careful with negative differences. A negative intermediate result is acceptable, but the final remainder must be nonnegative and less than the divisor.
Exercise
What is the remainder when \(38\cdot47+19\) is divided by 5?
Show answer
\(38\equiv3\), \(47\equiv2\), and \(19\equiv4\pmod5\). Thus \(3\cdot2+4=10\), so the remainder is \(0\).