Maths WorkshopMaths problems with full solutions
Exercise 502Logic, sets and proofs › Proof techniquesHigh schoolAdded 3 Nov 2026

A parity case analysis

#cases#parity#square

Statement

Prove that the square of any integer has the form 3k3k or 3k+13k+1, but never 3k+23k+2.

Hint

Consider n≡0,1,2(mod3)n\equiv0,1,2\pmod3.

Show solutionHide solution

Solution

Cases.
- n≡0(mod3)n\equiv0\pmod3: n2≡0(mod3)n^2\equiv0\pmod3, so n2=3kn^2=3k.
- n≡1(mod3)n\equiv1\pmod3: n2≡1(mod3)n^2\equiv1\pmod3, so n2=3k+1n^2=3k+1.
- n≡2(mod3)n\equiv2\pmod3: n2≡4≡1(mod3)n^2\equiv4\equiv1\pmod3, so n2=3k+1n^2=3k+1.

Conclusion. The square of any integer is ≡0\equiv0 or 1(mod3)1\pmod3, never 22.