Ma · Mathematics

Why Is Every Cube 0, 1, or 8 Modulo 9?

Published By the 9to5Science editorial team

At a glance

  1. 1. Divide by three

    Write any integer n as 3q, 3q + 1, or 3q + 2.

  2. 2. Cube each form

    Expand the three cases and collect the terms divisible by 9.

  3. 3. Read the remainders

    The cube is 9k, 9k + 1, or 9k + 8, with k an integer.

To prove that an integer cube has the form 9k9k, 9k+19k+1, or 9k+89k+8, split the integers into their three possible remainders upon division by 3. Cubing each of those forms shows that the result differs from one of these three numbers by a multiple of 9.

Here kk must be an integer, and the claim applies to negative integers as well as positive ones.

Proof by cases modulo 3

By the division algorithm, every integer nn can be written in exactly one of these ways for some integer qq:

n=3q,n=3q+1,orn=3q+2.n=3q, \qquad n=3q+1, \qquad \text{or} \qquad n=3q+2.

These are the only cases because the possible remainders after division by 3 are 0, 1, and 2.

Case 1: n=3qn=3q

Cubing gives

n3=(3q)3=27q3=9(3q3).n^3=(3q)^3=27q^3=9(3q^3).

Since 3q33q^3 is an integer, this has the form 9k9k.

Case 2: n=3q+1n=3q+1

Expand the cube:

n3=(3q+1)3=27q3+27q2+9q+1=9(3q3+3q2+q)+1.\begin{aligned} n^3&=(3q+1)^3\\ &=27q^3+27q^2+9q+1\\ &=9(3q^3+3q^2+q)+1. \end{aligned}

The quantity in parentheses is an integer, so this has the form 9k+19k+1.

Case 3: n=3q+2n=3q+2

Similarly,

n3=(3q+2)3=27q3+54q2+36q+8=9(3q3+6q2+4q)+8.\begin{aligned} n^3&=(3q+2)^3\\ &=27q^3+54q^2+36q+8\\ &=9(3q^3+6q^2+4q)+8. \end{aligned}

Again, the quantity in parentheses is an integer. This has the form 9k+89k+8.

In all three cases, kk is an integer. Therefore every integer cube is congruent to 00, 11, or 88 modulo 9:

n3≡0, 1, or 8(mod9).n^3\equiv 0,\ 1,\ \text{or }8\pmod 9.

Worked examples

Take n=6n=6. It is divisible by 3, so the first case applies:

63=216=9⋅24.6^3=216=9\cdot24.

For n=4n=4, write 4=3(1)+14=3(1)+1. The second case predicts a remainder of 1, and indeed

43=64=9⋅7+1.4^3=64=9\cdot7+1.

For n=5n=5, write 5=3(1)+25=3(1)+2. The third case predicts a remainder of 8:

53=125=9⋅13+8.5^3=125=9\cdot13+8.

The same reasoning handles negative inputs. For example, −4=3(−2)+2-4=3(-2)+2, so its cube must have remainder 8 modulo 9. In fact,

(−4)3=−64=9(−8)+8.(-4)^3=-64=9(-8)+8.

Why checking remainders modulo 3 is enough

The proof works because the three possible remainders modulo 3 cover every integer, and cubing each representative gives the corresponding remainder modulo 9:

Remainder of nn modulo 3Remainder of n3n^3 modulo 9
00
11
28

For the last row, 23=82^3=8. More generally, replacing nn by another integer with the same remainder modulo 3 does not change which of the three cube forms applies; the expansions above show the difference is a multiple of 9.

Common mistakes

  • Checking only positive numbers: The division algorithm and the proof hold for every integer, including negative values.
  • Using kk as if it had to be positive: The statement only requires kk to be an integer. For instance, (−4)3=9(−8)+8(-4)^3=9(-8)+8 uses negative kk.
  • Writing the last form as 9k−19k-1 without explaining it: This is equivalent to 9k+89k+8, since 9k+8=9(k+1)−19k+8=9(k+1)-1. Both notations describe the same remainder class modulo 9.
  • Claiming every number of these forms is a cube: The proof shows that cubes must have one of these remainders. It does not say that every integer congruent to 0, 1, or 8 modulo 9 is itself a cube.

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.