# Proof for modulus via direct or contrapositive

I have to prove the following via direct proof or via contra positive.

For $a,b\in \mathbb{Z}$ it follows that $(a+b)^3 \equiv a^3 + b^3 \mod 3$

I'm unsure of the best way to approach this question, so any help would be greatly appreciated.

-
Here's a tip: for $\in$, type "\in" in your LaTeX code (not \epsilon) and for $a \mod b$, type "a \mod b". – Cameron Williams Jun 20 '14 at 0:56
Thank you @CameronWilliams. I'm new to LaTeX :) – Wilson Jun 20 '14 at 0:58
Here's another LaTeX tip: use "\pmod" to get parentheses around the modulus. Thus, "a \equiv b \pmod 3" gives $a \equiv b \pmod 3$. – Théophile Jun 20 '14 at 1:01

Consider $$(a+b)^3-(a^3+b^3).$$ Expanding we obtain $$a^3+3a^2b+3ab^2+b^3-(a^3+b^3).$$ Thus we have $$3a^2b+3ab^2=3(a^2b+ab^2)$$ and it follows that $$(a+b)^3 \equiv a^3 + b^3 \mod 3.$$

-

Hint: try expanding $(a+b)^3$. You should notice a very nice pattern with the coefficients.. cf Pascal's triangle.

-
Hi, I have $3(a^2b+ab^2)+a^3+b^3$. In the past, when I've done proofs involving modulus, we generally do something like $3 | (a+b)^3 ≡ a^3 + b^3$ Do I want to head that direction here too? – Wilson Jun 20 '14 at 1:02
Sort of. You're on the right track. We say that $a \equiv b \mod c$ if $c\mid (a-b)$. Do you see how to proceed here? – Cameron Williams Jun 20 '14 at 1:04

You can use Euler's theorem. $3$ is prime, so: \begin{align} a^3 &\equiv a \mod 3 \\ b^3 &\equiv b \mod 3 \\ (a+b)^3 &\equiv a+b \mod 3 \end{align} By transitivity, we get $(a+b)^3 \equiv a + b \mod 3$, hence $(a+b)^3 \equiv a^3 + b^3 \mod 3$.

-