<s>[INST] Help understanding how to factor completely $x^3-x^2-x+1$ I need someone to help explain the steps to completely factor the problem $x^3-x^2-x+1$.
Here is what I have done so far:

$x^3-x^2-x+1$ 
to 
$x^3-x^2+-1(x+1)$
Since there is a negative I changed $-x+1$ to $-1(x+1)$ 
to 
$x^2(x-1)+-1(x+1)$ 
to
$(x^2-1)(x-1)(x+1)$.

Is this correct? If not please explain what I did wrong and what I should do. If it is then thank you for saying so, if not, thank you for helping me to understand.
 [/INST] Let $f(x)=x^3-x^2-x+1$. By Rational Root Theorem, any rational root $\frac{p}{q}$ of $g(x)=a_nx^n+a_{n-1}x^{n-1}+\cdots+a_1x+a_0$ has $p\mid a_0$ and $q\mid a_n$ (i.e. $q$ divides $a_n$). Proof is simple: substitute $x=\frac{p}{q}$, multiply both sides by $q^n$, observe divisibility.     
Since $f(1)=0$, we know $x^3-x^2-x+1=(x-1)P(x)$ for some $P(x)$, which of course must be quadratic, so $P(x)=x^2+ax+b$.   
$$(x-1)(x^2+ax+b)=x^3+(a-1) x^2+(b-a)x-b=x^3-x^2-x+1$$    
So $a-1=-1, b-a=-1, -b=1$, so $b=-1, a=0$.     
$$x^3-x^2-x+1=(x-1)(x^2-1)$$
</s>