Chapter

Quadratic Residues and Modular Obstructions

This module teaches how to choose a modulus for impossibility proofs, use tables of square residues, and handle prime divisors of sums of squares.
Log in to track solved progress and bookmarks.

Theory

Key Idea

Quadratic residues help prove impossibility. Instead of checking all integers, we examine which residues squares can have modulo a small number, then choose a modulus where the two sides land in incompatible residue sets.

Basic Facts

Squares modulo \(4\) are only \(0,1\); modulo \(8\), only \(0,1,4\); modulo \(3\), only \(0,1\); modulo \(5\), only \(0,1,4\). If an odd prime \(p\) divides \(a^2+1\), then \(p=2\) or \(p\equiv1\pmod4\). If \(p\equiv3\pmod4\) and \(p\mid x^2+y^2\), then \(p\mid x\) and \(p\mid y\).

When to Use This Method

Use this method when an equation contains squares, sums of squares, expressions \(a^2+1\), \(a^2+b^2\), \(a^2+ab+b^2\), or when the goal is to prove that no solution exists. It is especially useful before harder Diophantine equations.

How to Recognise the Method

If the right-hand side has the form \(4k+3\), try modulo \(4\). If \(8k+7\) appears, try modulo \(8\). If \(a^2+1\) appears, think of \(-1\) being a square. If \(a^2+ab+b^2\) appears, multiplying by an inverse often produces an element of order \(3\).

Typical Mistakes

Do not conclude from one modulus before the full residue set has been checked. Do not divide by \(b\) modulo \(p\) until \(p\nmid b\) is proved. In descent problems, one must show that the smaller triple is still integral.

Mini-checklist

1. What residues can squares take? 2. Which modulus reveals the contradiction? 3. Can a prime divisor be considered? 4. Is division by a variable modulo a prime allowed? 5. If a common divisor forces all variables to be divisible, does it create infinite descent?

Examples

Example 1. Squares Modulo \(8\)

Basic technique: build the residue table for squares.

Problem. Prove that the square of an integer modulo \(8\) is \(0\), \(1\), or \(4\).

Solution.

It is enough to check residues \(0,1,\ldots,7\). Their squares give \(0,1,4,1,0,1,4,1\). Hence the set of square residues modulo \(8\) is \(\{0,1,4\}\).

Comment. This table will be used in problems on sums of squares.

Example 2. Impossibility Modulo \(4\)

This shows the most common obstruction for a sum of two squares.

Problem. Prove that the equation \(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 only be \(0,1,2\). The right-hand side is \(3\pmod4\), impossible.

Comment. Modulo \(4\) is chosen because the right-hand side visibly has residue \(3\).

Example 3. A Quadratic Congruence with a Parameter

This teaches solving a small congruence by a table.

Problem. Find all \(n\) such that \(7\mid n^2+n+1\).

Solution.

Checking residues \(n\pmod7\), the values of \(n^2+n+1\) are \(1,3,0,6,0,3,1\). Hence \(n\equiv2\) or \(n\equiv4\pmod7\).

Comment. A table is acceptable when the modulus is small.

Example 4. Why \(-1\) Is Not Always a Square

This connects quadratic residues with prime divisors.

Problem. Let an odd prime \(p\mid a^2+1\). Prove that \(p\equiv1\pmod4\).

Solution.

If \(p\mid a\), then \(p\mid1\), impossible. Thus \(a\not\equiv0\pmod p\). From \(a^2\equiv-1\pmod p\), we get \(a^4\equiv1\), but \(a^2\not\equiv1\). Therefore the order of \(a\) modulo \(p\) is \(4\). The order divides \(p-1\), so \(4\mid p-1\).

Comment. This is a first look at the connection between residues and modular order.

Example 5. A Sum of Three Squares

This shows that sums of allowed residues also have restrictions.

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

Solution.

Modulo \(8\), each square is \(0,1\), or \(4\). A sum of three residues from \(\{0,1,4\}\) cannot be \(7\). The right-hand side is \(7\pmod8\), contradiction.

Comment. This is not the full three-square theorem, only the useful olympiad obstruction.

Example 6. Primes \(3\pmod4\)

A key technique for sums of two squares.

Problem. Let \(p\equiv3\pmod4\) be prime and \(p\mid x^2+y^2\). Prove that \(p\mid x\) and \(p\mid y\).

Solution.

If \(p\nmid y\), then \(xy^{-1}\) exists modulo \(p\), and \(x^2+y^2\equiv0\) gives \((xy^{-1})^2\equiv-1\pmod p\). Thus \(-1\) is a square modulo \(p\), which is possible only for \(p\equiv1\pmod4\), a contradiction. Hence \(p\mid y\), and then the original divisibility gives \(p\mid x\).

Comment. Important template: first show division is allowed; otherwise part of the conclusion is already true.

Example 7. The Form \(a^2+ab+b^2\)

This shows the order \(3\) analogue.

Problem. Let \(p\ne3\) be prime, \( \gcd(a,b)=1 \), and \(p\mid a^2+ab+b^2\). Prove that \(p\equiv1\pmod3\).

Solution.

Since \(p\nmid b\), put \(t\equiv ab^{-1}\pmod p\). Then \(t^2+t+1\equiv0\). Multiplying by \(t-1\), we obtain \(t^3-1\equiv0\). Also \(t\not\equiv1\), otherwise \(3\equiv0\pmod p\), impossible for \(p\ne3\). Thus the order of \(t\) is \(3\), so \(3\mid p-1\).

Comment. This is an important bridge to cubic residues and orders.

Example 8. Infinite Descent

An olympiad consequence of a modular obstruction.

Problem. Prove that the equation \(x^2+y^2=3z^2\) has only the solution \(x=y=z=0\) in integers.

Solution.

Modulo \(3\), squares are \(0\) or \(1\). If \(x^2+y^2\) is divisible by \(3\), both squares must be divisible by \(3\), hence \(3\mid x\) and \(3\mid y\). Then \(9\mid x^2+y^2=3z^2\), so \(3\mid z\). Dividing \(x,y,z\) by \(3\), we get a smaller solution. A nonzero solution would create infinite descent, impossible. Thus no nonzero solution exists.

Comment. It is important to prove divisibility of all three variables, not only two.

Problems

Problems

#2.1
#2.1

Table of Squares

Modular Arithmetic Grade 8 Grade 9 Grade 10 ★★☆☆☆

Find all possible residues of a square modulo \(16\).

Details
Problem: NT-B2-M02-P001
Difficulty: Level 2 of 5
Tag: Modular Arithmetic
Grade: Grade 8, Grade 9, Grade 10
#2.2
#2.2

A Sum of Two Squares

Quadratic Residues Grade 8 Grade 9 Grade 10 ★★☆☆☆

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

Details
Problem: NT-B2-M02-P002
Difficulty: Level 2 of 5
Tag: Quadratic Residues
Grade: Grade 8, Grade 9, Grade 10
#2.3
#2.3

Divisibility by Seven

Modular Arithmetic Grade 8 Grade 9 Grade 10 ★★☆☆☆

Find all \(n\) such that \(7\mid n^2+n+1\).

Details
Problem: NT-B2-M02-P003
Difficulty: Level 2 of 5
Tag: Modular Arithmetic
Grade: Grade 8, Grade 9, Grade 10
#2.4
#2.4

A Square Plus One

Modular Arithmetic Grade 8 Grade 9 Grade 10 ★★☆☆☆

Find all residues \(n\pmod5\) such that \(5\mid n^2+1\).

Details
Problem: NT-B2-M02-P004
Difficulty: Level 2 of 5
Tag: Modular Arithmetic
Grade: Grade 8, Grade 9, Grade 10
#2.5
#2.5

Last Digit of a Square

Quadratic Residues Grade 8 Grade 9 Grade 10 ★★☆☆☆

Prove that a square of an integer cannot end in \(2\), \(3\), \(7\), or \(8\).

Details
Problem: NT-B2-M02-P005
Difficulty: Level 2 of 5
Tag: Quadratic Residues
Grade: Grade 8, Grade 9, Grade 10
#2.6
#2.6

Square Roots of Minus One

Modular Arithmetic Grade 8 Grade 9 Grade 10 ★★★☆☆

Solve the congruence \(x^2\equiv-1\pmod{13}\).

Details
Problem: NT-B2-M02-P006
Difficulty: Level 3 of 5
Tag: Modular Arithmetic
Grade: Grade 8, Grade 9, Grade 10
#2.7
#2.7

Residue Seven

Quadratic Residues Grade 8 Grade 9 Grade 10 ★★★☆☆

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

Details
Problem: NT-B2-M02-P007
Difficulty: Level 3 of 5
Tag: Quadratic Residues
Grade: Grade 8, Grade 9, Grade 10
#2.8
#2.8

Three Squares

Quadratic Residues Grade 8 Grade 9 Grade 10 ★★★☆☆

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

Details
Problem: NT-B2-M02-P008
Difficulty: Level 3 of 5
Tag: Quadratic Residues
Grade: Grade 8, Grade 9, Grade 10
#2.9
#2.9

One Class Modulo \(11\)

Modular Arithmetic Grade 8 Grade 9 Grade 10 ★★★☆☆

Find all \(n\) such that \(11\mid n^2+3n+5\).

Details
Problem: NT-B2-M02-P009
Difficulty: Level 3 of 5
Tag: Modular Arithmetic
Grade: Grade 8, Grade 9, Grade 10
#2.10
#2.10

A Prime Divisor of \(a^2+1\)

Quadratic Residues Grade 8 Grade 9 Grade 10 ★★★☆☆

Let an odd prime \(p\mid a^2+1\). Prove that \(p\equiv1\pmod4\).

Details
Problem: NT-B2-M02-P010
Difficulty: Level 3 of 5
Tag: Quadratic Residues
Grade: Grade 8, Grade 9, Grade 10
#2.11
#2.11

A Prime \(3\pmod4\)

Prime Factorisation Grade 8 Grade 9 Grade 10 ★★★☆☆

Let \(p\equiv3\pmod4\) be prime and \(p\mid x^2+y^2\). Prove that \(p\mid x\) and \(p\mid y\).

Details
Problem: NT-B2-M02-P011
Difficulty: Level 3 of 5
Tag: Prime Factorisation
Grade: Grade 8, Grade 9, Grade 10
#2.12
#2.12

A Congruence Modulo a Composite Number

Chinese Remainder Theorem Grade 8 Grade 9 Grade 10 ★★★★☆

Solve the congruence \(x^2\equiv4\pmod{15}\).

Details
Problem: NT-B2-M02-P012
Difficulty: Level 4 of 5
Tag: Chinese Remainder Theorem
Grade: Grade 8, Grade 9, Grade 10
#2.13
#2.13

Squares Equal to One

Chinese Remainder Theorem Grade 8 Grade 9 Grade 10 ★★★★☆

Find all residues \(x\pmod{24}\) such that \(x^2\equiv1\pmod{24}\).

Details
Problem: NT-B2-M02-P013
Difficulty: Level 4 of 5
Tag: Chinese Remainder Theorem
Grade: Grade 8, Grade 9, Grade 10
#2.14
#2.14

Minus One Modulo \(65\)

Chinese Remainder Theorem Grade 8 Grade 9 Grade 10 ★★★★☆

Solve the congruence \(x^2\equiv-1\pmod{65}\).

Details
Problem: NT-B2-M02-P014
Difficulty: Level 4 of 5
Tag: Chinese Remainder Theorem
Grade: Grade 8, Grade 9, Grade 10
#2.15
#2.15

Equal Squares

Quadratic Residues Grade 8 Grade 9 Grade 10 ★★★★☆

Let \(p\) be prime. Prove that if \(x^2\equiv y^2\pmod p\), then \(x\equiv y\pmod p\) or \(x\equiv -y\pmod p\).

Details
Problem: NT-B2-M02-P015
Difficulty: Level 4 of 5
Tag: Quadratic Residues
Grade: Grade 8, Grade 9, Grade 10
#2.16
#2.16

Descent for the Number \(3\)

Descent Grade 8 Grade 9 Grade 10 ★★★★☆

Prove that the equation \(x^2+y^2=3z^2\) has only the zero solution in integers.

Details
Problem: NT-B2-M02-P016
Difficulty: Level 4 of 5
Tag: Descent
Grade: Grade 8, Grade 9, Grade 10
#2.17
#2.17

A Form of Order \(3\)

Quadratic Residues Grade 8 Grade 9 Grade 10 ★★★★★

Let \(p\ne3\) be prime, \( \gcd(a,b)=1 \), and \(p\mid a^2+ab+b^2\). Prove that \(p\equiv1\pmod3\).

Details
Problem: NT-B2-M02-P017
Difficulty: Level 5 of 5
Tag: Quadratic Residues
Grade: Grade 8, Grade 9, Grade 10
#2.18
#2.18

Primes \(2\pmod3\)

Prime Factorisation Grade 8 Grade 9 Grade 10 ★★★★★

Let \(p\equiv2\pmod3\) be prime and \(p\mid a^2+ab+b^2\). Prove that \(p\mid a\) and \(p\mid b\).

Details
Problem: NT-B2-M02-P018
Difficulty: Level 5 of 5
Tag: Prime Factorisation
Grade: Grade 8, Grade 9, Grade 10
#2.19
#2.19

Parity of an Exponent

Prime Factorisation Grade 8 Grade 9 Grade 10 ★★★★★

Prove that if \(N=x^2+y^2\), then every prime divisor \(p\equiv3\pmod4\) occurs in the prime factorisation of \(N\) with even exponent.

Details
Problem: NT-B2-M02-P019
Difficulty: Level 5 of 5
Tag: Prime Factorisation
Grade: Grade 8, Grade 9, Grade 10
#2.20
#2.20

General Descent for \(p\equiv3\pmod4\)

Descent Grade 8 Grade 9 Grade 10 ★★★★★

Let \(p\equiv3\pmod4\) be prime. Prove that the equation \(x^2+y^2=pz^2\) has only the zero solution in integers.

Details
Problem: NT-B2-M02-P020
Difficulty: Level 5 of 5
Tag: Descent
Grade: Grade 8, Grade 9, Grade 10

Ladders

No published ladders were found.
Previous Chapter
Next Chapter