Sub topic 8
Using \(a^n \pm b^n\) Factors and the Remainder Theorem
Prerequisites and the main idea
Assume you can factor expressions, use exponent rules, and work with congruences such as \(x \equiv r \pmod m\).
A remainder problem often becomes easy when the expression contains a power. Instead of calculating the whole power, look for:
- a factor such as \(a-b\) or \(a+b\);
- a base close to \(0\) or \(\pm1\) modulo the divisor;
- a polynomial whose value can be found directly.
The key principle is:
\[ x \equiv a \pmod m \quad\Longrightarrow\quad f(x)\equiv f(a)\pmod m \]
for any polynomial \(f\) with integer coefficients.
Factoring powers
The standard identities are:
| Expression | Factorisation | Divisible by |
|---|---|---|
| \(a^n-b^n\) | \((a-b)(a^{n-1}+a^{n-2}b+\cdots+b^{n-1})\) | \(a-b\) |
| \(a^n+b^n\), \(n\) odd | \((a+b)(a^{n-1}-a^{n-2}b+\cdots-ab^{n-2}+b^{n-1})\) | \(a+b\) |
Therefore, \(a^n-b^n\) has remainder \(0\) when divided by \(a-b\). If \(n\) is odd, \(a^n+b^n\) has remainder \(0\) when divided by \(a+b\).
For example,
\[ 7^5+3^5 \]
is divisible by \(7+3=10\), because the exponent \(5\) is odd. Thus its remainder on division by \(10\) is \(0\).
For a difference,
\[ 11^4-5^4 \]
is divisible by \(11-5=6\), so its remainder on division by \(6\) is \(0\).
The condition on the exponent matters. \(a^2+b^2\) generally is not divisible by \(a+b\).
Using congruences with powers
Suppose you need the remainder of \(98^5\) when divided by \(9\). Since
\[ 98\equiv -1\pmod 9, \]
we get
\[ 98^5\equiv(-1)^5=-1\equiv8\pmod9. \]
There is no need to calculate \(98^5\).
A useful pattern is to rewrite a number as a nearby multiple of the divisor:
\[ 101\equiv1\pmod {10},\qquad 49\equiv-1\pmod {10},\qquad 26\equiv1\pmod5. \]
Then powers of these numbers remain simple.
def remainder_of_power(base, exponent, divisor):
return pow(base, exponent, divisor)
print(remainder_of_power(98, 5, 9)) # 8
print(remainder_of_power(7, 5, 10)) # 7The polynomial remainder theorem
The polynomial remainder theorem says that when a polynomial \(f(x)\) is divided by \(x-a\), the remainder is \(f(a)\).
For example, let
\[ f(x)=x^3+2x^2-5x+7. \]
The remainder when \(f(x)\) is divided by \(x-2\) is
\[ f(2)=2^3+2(2^2)-5(2)+7=13. \]
If the divisor is \(x+2\), write it as \(x-(-2)\). The remainder is \(f(-2)\).
Exercise
Find the remainder when \(6^5+4^5\) is divided by \(10\). Explain why factoring is enough.
Show answer
The exponent is odd, so \(6^5+4^5\) is divisible by \(6+4=10\). The remainder is \(0\).