<s>[INST] Factorization of polynomial I was just asked to factor $x^3+1$. I came to $(x^2-x+1)(x+1)$ after a while, and I was wondering, whether there is a good method to quicky factor such of polynomials.
 [/INST] You are usually asked to remember $x^3-a^3=(x-a)(x^2+ax+a^2)$ and $x^3+a^3=(x+a)(x^2-ax+a^2)$.  In general,
$$x^n-a^n=(x-a)(x^{n-1}+ax^{n-2}+...+a^{n-2}x+a^{n-1})$$
If $$y=x^{n-1}+ax^{n-2}+...+a^{n-2}x+a^{n-1}$$
$$xy=x^n+ax^{n-1}+...+a^{n-2}x^2+a^{n-1}x$$
$$-ay=-ax^{n-1}-a^2x^{n-2}-...-a^{n-1}x-a^n$$
Add $xy$ and $-ay$ and all the terms will cancel out except for $x^n-a^n$, showing
$$xy-ay=(x-a)y=x^n-a^n$$
For your equation, $n=3$ and $a=-1$.
</s>