Chapter

Modular Arithmetic I: Residues and Contradictions

The module teaches residues as a tool for proving impossibility: tables of squares and cubes, choosing a modulus, last digits, and first modular contradictions.
Log in to track solved progress and bookmarks.

Theory

Key Idea

Congruences replace infinitely many integers by a finite table of residues. To prove impossibility, it is often enough to find a modulus in which the two sides always belong to disjoint sets of residues.

The main skill in this module is not mechanical computation, but choosing the modulus: \(3,4,5,7,8,9,11,16\) often produce quick contradictions.

Basic Facts

  • \(a\equiv b\pmod m\) means that \(m\mid a-b\).
  • If \(a\equiv b\pmod m\), congruences may be added, subtracted, and multiplied.
  • Squares modulo \(4\) are only \(0,1\); squares modulo \(8\) are only \(0,1,4\).
  • Cubes modulo \(9\) are only \(0,1,8\), i.e. \(0,\pm1\).
  • The last digit is a residue modulo \(10\); the last two digits are a residue modulo \(100\).
  • A contradiction modulo one modulus proves that no integer solutions exist.

When to Use This Method

  • You need to prove that an equation has no integer solutions.
  • The expression contains squares, cubes, fourth powers, or last digits.
  • You need to find all \(n\) for which an expression is divisible by a small number.
  • Parity matters, but parity alone is not enough.
  • Large powers have repeating residues.

How to Recognise the Method

If the right side has the form \(4k+3\), \(8k+7\), or \(3k+2\), try square residue tables. If cubes appear, test modulo \(7\) or \(9\). If the problem asks about the last digit, look for a power cycle.

The right modulus is usually small and makes one side very restricted: for example, a square modulo \(8\) cannot be \(2,3,5,6,7\).

Typical Mistakes

  • Dividing a congruence by a number without checking whether that is allowed.
  • Checking only positive residues and forgetting that negative integers fall into the same residue classes.
  • Assuming that if one modulus gives no contradiction, then solutions must exist.
  • Confusing "a square may have residue \(1\)" with "every number of residue \(1\) is a square".
  • Using only modulo \(10\) in a problem about the last two digits.

Mini-Checklist

  • Which residues do squares or cubes give modulo the chosen modulus?
  • Which residues can the left side have?
  • Which residues can the right side have?
  • Do these sets intersect?
  • If there are no solutions modulo \(m\), is the contradiction written explicitly?

Examples

Example 1. Residues and Congruences

A congruence fixes the residue but lets us work without exact division.

Problem. Find the remainder of \(2026^2+2026\) upon division by \(5\).

Solution.

\(2026\equiv1\pmod5\). Hence \(2026^2+2026\equiv1^2+1=2\pmod5\). The remainder is \(2\).

Comment. First replace the number by its residue, then compute.

Example 2. Squares Modulo 8

Squares have very few possible residues.

Problem. Show that the square of an integer modulo \(8\) can only have residue \(0,1,4\).

Solution.

Check residues \(0,1,2,\ldots,7\). Their squares modulo \(8\) are \(0,1,4,1,0,1,4,1\). Thus only \(0,1,4\) are possible.

Comment. This table will be used many times.

Example 3. Impossibility of \(4z+3\)

A sum of two squares cannot be \(3\) modulo \(4\).

Problem. Prove that \(x^2+y^2=4z+3\) has no integer solutions.

Solution.

A square modulo \(4\) is \(0\) or \(1\). Therefore a sum of two squares modulo \(4\) can be \(0,1,2\), but not \(3\). The right side \(4z+3\equiv3\pmod4\). Contradiction.

Comment. The modulus \(4\) is suggested by the form of the right side.

Example 4. Impossibility of \(8z+7\)

Modulo \(8\) is stronger than ordinary parity.

Problem. Prove that \(x^2+y^2=8z+7\) has no integer solutions.

Solution.

Squares modulo \(8\) are \(0,1,4\). A sum of two such residues can be \(0,1,2,4,5\), but not \(7\). The right side is \(7\) modulo \(8\). Contradiction.

Comment. Here modulo \(4\) would be weaker, while modulo \(8\) solves the problem.

Example 5. Divisibility of \(n^2+n+1\) by 7

Sometimes it is easiest to check all residues modulo a small number.

Problem. Find all residues \(n\pmod7\) for which \(7\mid n^2+n+1\).

Solution.

Check \(n=0,1,2,3,4,5,6\). The values of \(n^2+n+1\) modulo \(7\) are \(1,3,0,6,0,3,1\). Thus \(n\equiv2\) and \(n\equiv4\pmod7\) work.

Comment. A seven-row table is acceptable when it gives the full answer.

Example 6. Cubes Modulo 9

Cubes modulo \(9\) have only three possible residues.

Problem. Show that the cube of an integer modulo \(9\) is \(0,1\), or \(8\).

Solution.

Check residues \(0,\ldots,8\): the cubes are \(0,1,8,0,1,8,0,1,8\). Hence only \(0,1,8\), i.e. \(0,\pm1\), are possible.

Comment. This table is useful for sums of cubes.

Example 7. Last Digit of a Power

The last digit is work modulo \(10\).

Problem. Find the last digit of \(7^{2026}\).

Solution.

The last digits of powers of \(7\) cycle as \(7,9,3,1\). The cycle length is \(4\). Since \(2026\equiv2\pmod4\), we take the second digit in the cycle: \(9\).

Comment. There is no need to compute the large power.

Example 8. Choosing the Right Modulus

Sometimes the modulus is suggested by a coefficient.

Problem. Prove that the equation \(x^2=3y^2+2\) has no integer solutions.

Solution.

Consider the equation modulo \(3\). The right side satisfies \(3y^2+2\equiv2\pmod3\). But a square modulo \(3\) can only be \(0\) or \(1\). Contradiction.

Comment. Modulo \(3\) is chosen because the right side is almost a multiple of \(3\).

Problems

Problems

#4.1
#4.1

Residue of a Large Number

Modular Arithmetic Grade 7 Grade 8 ★☆☆☆☆

Find the remainder of \(2026\) upon division by \(7\).

Details
Problem: NT-B1-M03-P001
Difficulty: Level 1 of 5
Tag: Modular Arithmetic
Grade: Grade 7, Grade 8
#4.2
#4.2

Squares Modulo 4

Quadratic Residues Grade 7 Grade 8 ★☆☆☆☆

Prove that the square of an integer modulo \(4\) can only have residue \(0\) or \(1\).

Details
Problem: NT-B1-M03-P002
Difficulty: Level 1 of 5
Tag: Quadratic Residues
Grade: Grade 7, Grade 8
#4.3
#4.3

Squares Modulo 8

Quadratic Residues Grade 7 Grade 8 ★☆☆☆☆

Make the table of square residues modulo \(8\).

Details
Problem: NT-B1-M03-P003
Difficulty: Level 1 of 5
Tag: Quadratic Residues
Grade: Grade 7, Grade 8
#4.4
#4.4

Last Digit

Last Digit Grade 7 Grade 8 ★☆☆☆☆

Find the last digit of \(3^{2025}\).

Details
Problem: NT-B1-M03-P004
Difficulty: Level 1 of 5
Tag: Last Digit
Grade: Grade 7, Grade 8
#4.5
#4.5

Square Equal to One

Modular Arithmetic Grade 7 Grade 8 ★☆☆☆☆

Find all residues \(n\pmod5\) for which \(n^2\equiv1\pmod5\).

Details
Problem: NT-B1-M03-P005
Difficulty: Level 1 of 5
Tag: Modular Arithmetic
Grade: Grade 7, Grade 8
#4.6
#4.6

Sum of Two Squares and \(4z+3\)

Modular Contradiction Grade 8 Grade 9 ★★☆☆☆

Prove that \(x^2+y^2=4z+3\) has no integer solutions.

Details
Problem: NT-B1-M03-P006
Difficulty: Level 2 of 5
Tag: Modular Contradiction
Grade: Grade 8, Grade 9
#4.7
#4.7

Sum of Two Squares and \(8z+7\)

Modular Contradiction Grade 8 Grade 9 ★★☆☆☆

Prove that \(x^2+y^2=8z+7\) has no integer solutions.

Details
Problem: NT-B1-M03-P007
Difficulty: Level 2 of 5
Tag: Modular Contradiction
Grade: Grade 8, Grade 9
#4.8
#4.8

Divisibility of \(n^2+n+1\) by 7

Modular Arithmetic Grade 8 Grade 9 ★★☆☆☆

Find all integers \(n\) for which \(7\mid n^2+n+1\).

Details
Problem: NT-B1-M03-P008
Difficulty: Level 2 of 5
Tag: Modular Arithmetic
Grade: Grade 8, Grade 9
#4.9
#4.9

A Square Cannot Have Residue 2 or 3

Modular Contradiction Grade 8 Grade 9 ★★☆☆☆

Prove that no square of an integer has remainder \(2\) or \(3\) upon division by \(4\).

Details
Problem: NT-B1-M03-P009
Difficulty: Level 2 of 5
Tag: Modular Contradiction
Grade: Grade 8, Grade 9
#4.10
#4.10

Last Digit of \(7^{2026}\)

Last Digit Grade 8 Grade 9 ★★☆☆☆

Find the last digit of \(7^{2026}\).

Details
Problem: NT-B1-M03-P010
Difficulty: Level 2 of 5
Tag: Last Digit
Grade: Grade 8, Grade 9
#4.11
#4.11

Product of Consecutive Numbers

Modular Arithmetic Grade 8 Grade 9 ★★☆☆☆

Use congruences to prove that \(n^2+n\) is even for every integer \(n\).

Details
Problem: NT-B1-M03-P011
Difficulty: Level 2 of 5
Tag: Modular Arithmetic
Grade: Grade 8, Grade 9
#4.12
#4.12

Sum of Three Cubes Modulo 9

Modular Contradiction Grade 8 Grade 9 ★★☆☆☆

Prove that a sum of three integer cubes cannot have residue \(4\) or \(5\) modulo \(9\).

Details
Problem: NT-B1-M03-P012
Difficulty: Level 2 of 5
Tag: Modular Contradiction
Grade: Grade 8, Grade 9
#4.13
#4.13

Three Squares and \(8t+7\)

Modular Contradiction Grade 8 Grade 9 ★★★☆☆

Prove that a number of the form \(8t+7\) cannot be represented as a sum of three integer squares.

Details
Problem: NT-B1-M03-P013
Difficulty: Level 3 of 5
Tag: Modular Contradiction
Grade: Grade 8, Grade 9
#4.14
#4.14

The Equation \(x^2=3y^2+2\)

Modular Contradiction Grade 8 Grade 9 ★★★☆☆

Prove that \(x^2=3y^2+2\) has no integer solutions.

Details
Problem: NT-B1-M03-P014
Difficulty: Level 3 of 5
Tag: Modular Contradiction
Grade: Grade 8, Grade 9
#4.15
#4.15

Sum of Two Squares Divisible by 3

Modular Arithmetic Grade 8 Grade 9 ★★★☆☆

Prove: if \(3\mid x^2+y^2\), then \(3\mid x\) and \(3\mid y\).

Details
Problem: NT-B1-M03-P015
Difficulty: Level 3 of 5
Tag: Modular Arithmetic
Grade: Grade 8, Grade 9
#4.16
#4.16

Divisibility by 13

Modular Arithmetic Grade 8 Grade 9 ★★★☆☆

Find all integers \(n\) for which \(13\mid n^2+n+1\).

Details
Problem: NT-B1-M03-P016
Difficulty: Level 3 of 5
Tag: Modular Arithmetic
Grade: Grade 8, Grade 9
#4.17
#4.17

Impossibility Modulo 11

Modular Contradiction Grade 8 Grade 9 ★★★☆☆

Prove that \(n^2+n+1\) is not divisible by \(11\) for any integer \(n\).

Details
Problem: NT-B1-M03-P017
Difficulty: Level 3 of 5
Tag: Modular Contradiction
Grade: Grade 8, Grade 9
#4.18
#4.18

Fourth Powers Modulo 16

Modular Contradiction Grade 9 Grade 10 ★★★☆☆

Prove that \(x^4+y^4=16z+15\) has no integer solutions.

Details
Problem: NT-B1-M03-P018
Difficulty: Level 3 of 5
Tag: Modular Contradiction
Grade: Grade 9, Grade 10
#4.19
#4.19

A Cube Is Not 2 Modulo 7

Modular Contradiction Grade 9 Grade 10 ★★★☆☆

Prove that the congruence \(x^3\equiv2\pmod7\) has no solutions.

Details
Problem: NT-B1-M03-P019
Difficulty: Level 3 of 5
Tag: Modular Contradiction
Grade: Grade 9, Grade 10
#4.20
#4.20

Last Two Digits

Powers Grade 9 Grade 10 ★★★☆☆

Find the last two digits of \(3^{20}\).

Details
Problem: NT-B1-M03-P020
Difficulty: Level 3 of 5
Tag: Powers
Grade: Grade 9, Grade 10
#4.21
#4.21

The Equation \(x^2+y^2=3z^2\)

Modular Contradiction Grade 9 Grade 10 ★★★★☆

Prove that the only integer solution of \(x^2+y^2=3z^2\) is \(x=y=z=0\).

Details
Problem: NT-B1-M03-P021
Difficulty: Level 4 of 5
Tag: Modular Contradiction
Grade: Grade 9, Grade 10
#4.22
#4.22

The Equation \(x^2-5y^2=2\)

Modular Contradiction Grade 9 Grade 10 ★★★★☆

Prove that \(x^2-5y^2=2\) has no integer solutions.

Details
Problem: NT-B1-M03-P022
Difficulty: Level 4 of 5
Tag: Modular Contradiction
Grade: Grade 9, Grade 10
#4.23
#4.23

Two Squares Divisible by 7

Modular Arithmetic Grade 9 Grade 10 ★★★★☆

Prove: if \(7\mid x^2+y^2\), then \(7\mid x\) and \(7\mid y\).

Details
Problem: NT-B1-M03-P023
Difficulty: Level 4 of 5
Tag: Modular Arithmetic
Grade: Grade 9, Grade 10
#4.24
#4.24

Infinitely Many Numbers Are Not Sums of Three Squares

Modular Contradiction Grade 9 Grade 10 ★★★★★

Prove that infinitely many positive integers cannot be represented as a sum of three integer squares.

Details
Problem: NT-B1-M03-P024
Difficulty: Level 5 of 5
Tag: Modular Contradiction
Grade: Grade 9, Grade 10

Ladders

No published ladders were found.
Previous Chapter
Next Chapter