Work modulo a small number

To show an equation has no whole-number solutions, look only at remainders. Squares, for instance, leave remainder 0 or 1 on division by 4.

Level: STEP 2. Uses A-level Mathematics only.

The idea

Questions about whole numbers often ask you to show that something is impossible: an equation has no integer solutions, or a number is never divisible by 7. Checking cases cannot prove that, because there are infinitely many. Remainders can. If you divide by a small number mm, there are only mm possible remainders, so you can check every case.

Write a≡b(modm)a\equiv b\pmod m when aa and bb leave the same remainder on division by mm. Remainders behave well under addition and multiplication: to find the remainder of a sum or product, you may replace each number by its remainder first.

Squares have few remainders

Every integer is even or odd. If x=2kx=2k then x2=4k2x^2=4k^2, and if x=2k+1x=2k+1 then

x2=4(k2+k)+1.x^2=4(k^2+k)+1 .

So every square leaves remainder 0 or 1 on division by 4. In the same way, every square leaves remainder 0 or 1 on division by 3. These two facts settle a surprising number of STEP questions.

Example 1: a sum of two squares

Show that there are no integers xx and yy with

x2+y2=2027.x^2+y^2=2027 .

Each of x2x^2 and y2y^2 leaves remainder 0 or 1 on division by 4, so their sum leaves remainder 0, 1 or 2. But 2027=4×506+32027=4\times506+3 leaves remainder 3. So no such integers exist. The same argument shows that no number of the form 4k+34k+3 is a sum of two squares.

Example 2: a remainder that never appears

Show that 2n+12^n+1 is never divisible by 7, for any positive integer nn.

Since 23=8≡1(mod7)2^3=8\equiv1\pmod 7, the remainders of the powers of 2 repeat with period 3:

21≡2,22≡4,23≡1,24≡2,25≡4,26≡1, …(mod7).\begin{gathered}2^1\equiv2,\quad 2^2\equiv4,\quad 2^3\equiv1,\\ 2^4\equiv2,\quad 2^5\equiv4,\quad 2^6\equiv1,\ \dots\pmod 7 .\end{gathered}

So 2n+12^n+1 leaves remainder 3, 5 or 2, and never 0. The key step was finding a power congruent to 1, after which everything repeats.

Example 3: divisibility for every n

Show that n3−nn^3-n is divisible by 6 for every integer nn.

Factorise: n3−n=(n−1)n(n+1)n^3-n=(n-1)n(n+1), a product of three consecutive integers. One of any two consecutive integers is even, and one of any three consecutive integers is a multiple of 3. So the product is divisible by 2 and by 3, and since 2 and 3 have no common factor, by 6.

When to reach for it

  • "Show that there are no integers ..." Choose a modulus where one side has few possible remainders: 4 or 8 for squares, 9 for cubes.
  • Divisibility statements that must hold for every nn: check each remainder of nn, or find a power that is congruent to 1.
  • If one modulus fails to give a contradiction, try another. Part of the skill is choosing the right one.

Try this

Suppose that xx, yy and zz are positive integers with

x2+y2=z2.x^2+y^2=z^2 .

Show that at least one of xx and yy is divisible by 3.

Hint

What are the possible remainders of a square on division by 3? What happens to x2+y2x^2+y^2 if neither xx nor yy is a multiple of 3?

Solution

If xx is not a multiple of 3, then x≡1x\equiv1 or x≡2(mod3)x\equiv2\pmod 3, and in both cases x2≡1(mod3)x^2\equiv1\pmod 3 (since 22=4≡12^2=4\equiv1). So if neither xx nor yy were a multiple of 3, we would have

x2+y2≡1+1=2(mod3).x^2+y^2\equiv1+1=2\pmod 3 .

But every square leaves remainder 0 or 1 on division by 3, so z2z^2 cannot leave remainder 2. This contradiction shows that at least one of xx and yy is divisible by 3. (For example, in 32+42=523^2+4^2=5^2 it is x=3x=3.)

Want more like this? STEP 2 Pure: Practice Paper 1 teaches ideas of this kind in depth, with exercises and a full STEP question. The STEP Starter Pack has all four modules and three practice papers. Or start free with the STEP sample question.