<s>[INST] How to factor $x^3-1$ with mod $3$ when I factor $x^3-1$ with $\mod 3$ on maple I get the answer $(x+2)^3$ and I was just wondering what the steps were to get to this solution.
 [/INST] \begin{align*}
x^3 - 1 &= (x - 1)(x^2 + x + 1)\\[6pt]
&\equiv (x + 2)(x^2 + 4x + 4) \pmod{3}\\[6pt]
&\equiv (x + 2)(x + 2)^2 \pmod{3}\\[6pt]
&\equiv (x + 2)^3 \pmod{3}
\end{align*}
</s>