Prove that $x^3 \equiv x \bmod 6$ for all integers $x$

Prove that $x^3 \equiv x \bmod 6$ for all integers $x$

I think I got it, but is this proof correct?

We can write any integer x in the form: $x = 6k, x = 6k + 1, x = 6k + 2, x = 6k + 3, x = 6k + 4$, and $x = 6k + 5$.

If $x = 6k$, then $x^3 = 216k^3$. Then $x^3 - x = 216k^3 - 6k = 6(36k^3 - k)$. Thus, $6 | (x^3 - x)$. Thus, $x^3 \equiv x \pmod 6$.

If $x = 6k + 1$. Then $x^3 - x = (216k^3 + 108k^2 + 18k + 1) - (6k + 1) = 6(36k^3 + 18k^2 + 2k)$ and so $6 | (x^3 - x)$ and $x^3 \equiv x \pmod 6$.

If $x = 6k + 2$, then $x^3 - x = (216k^3 + 216k^2 + 72k + 8) - (6k + 2) = 6(36k^3 + 36k^2 + 11k + 1)$ and so $6 | (x^3 - x)$ and $x^3 \equiv x \pmod 6$

If $x = 6k + 3$, then $x^3 - x = (216k^3 + 324k^2 + 162k + 27) - (6k + 3) = 6(36k^3 + 54k^2 + 26 + 4)$ and so $6 | (x^3 - x)$ and $x^3 \equiv x \pmod 6 $

If $x = 6k + 4$, then $x^3 - x = (216k^3 + 432k^2 + 288k + 64) - (6k + 4) = 6(36k^3 + 72k + 47k + 10)$ and so $6 | (x^3 - x)$ and $x^3 \equiv x \pmod 6$.

If $x = 6k + 5$, then $x^3 - x = (216k^3 + 540k^2 + 450k + 125) - (6k + 5) = 6(36k^3 + 90k + 74k + 20)$ and so $6 | (x^3 - x)$ and $x^3 \equiv x \pmod 6$.

In all cases, we have shown that $x^3 \equiv x \pmod 6$. QED.


Solution 1:

Yes, that works just fine.

Another way is to observe that if $$x^3\equiv x\pmod 6$$ then also $$x^3-x\equiv 0\pmod 6$$

and so the original statement is equivalent to the assertion that $x^3-x$ is always a multiple of 6.

Since $x^3-x$ factors as $(x-1)\cdot x\cdot (x+1)$ it is a product of three consecutive numbers; one of these must be a multiple of 3 and at least one must be even, so the product is certainly a multiple of 6.


You can also use your method, with much less trouble, by dealing with the general case of $x=6k+i$, where $i\in\{0,1,2,3,4,5\}$, rather than dealing with the six values of $i$ one by one. Then you are asking if $x^3\equiv x\pmod 6$ when $x=6k+i$, and by following exactly the same steps that you did in your solution, but once instead of six times, you get

$$\begin{align} (6k+i)^3 & \stackrel?{\equiv} 6k+i \pmod 6 \\ 216k^3 + 72k^2i + 18ki^2 + i^3 & \stackrel?{\equiv} 6k + i \pmod6\\ 6(36k^3 + 12k^2i + 3ki^2) + i^3 & \stackrel?{\equiv} 6(k) + i \pmod6\\ i^3 & \stackrel?{\equiv} i \pmod6\\ \end{align} $$

and now you only have to check whether the claim $i^3\equiv i\pmod 6$ is true for the six possible values of $i$, namely $\{0,1,2,3,4,5\}$. This eliminates five-sixths of the algebra, and so five-sixths of the opportunities to make a silly mistake.

Solution 2:

One has $$x^3-x=x(x+1)(x-1)\qquad\forall x\ .$$ When $x$ is an integer then at least one factor on the right is even, and exactly one factor on the right is divisible by $3$. It follows that for any $x\in{\mathbb Z}$ the right hand side is divisible by $6$, and so is the left hand side. That is to say: $x^3=x$ mod $6$ for all integers $x$.