How to factor $ 1 - 3x + x^2 + x^3$? By inspection, I can see that one of the roots is $1$.
So we can write
$$
1 - 3x + x^2 + x^3 = (x - 1)f_2(x)
$$
where $f_n(x)$ is an n-th order polynomial. I haven't used long division for polynomials in ages, but I feel like that might be overcomplicating things and there might be an easier way to determine $f_2(x)$. Is there an obvious approach to getting $f_2(x)$ here?
I tried some guess and checking to obtain it. I know that the quadratic term in $f_2(x)$ must have a coefficient of $1$, since the coefficient of $x^3$ is $1$. So $f_2(x) = x^2 + f_{1}(x)$. Now $f_{1}(x)$ is some affine equation. I know that $f_{1}(x)$ must have the constant $-1$ since we have a constant $1$ in the cubic and $(x-1)$, so we know that $f_2(x) = x^2 - 1 + f_a(n-1)$, where $f_a(x)$ is some linear equation that goes through the origin.
Now I checked $(x-1)(x^2 - 1) = x^3 - x^2 - x + 1$. When we compare this with the original cubic, we see that we're off by $2x^2 - 2x$. So this prompted me to use $f_a(x) = 2x$. So we have
$f_2(x) = x^2 + 2x - 1$ and this checks out.
This procedure that I used was just kind of just guess and checking.

One method to factor it is to check whether it can be separated into several parts that have a common factor. In this case, we can separate $x^3+x^2-3x+1$ into $x^3-x$ and $x^2-2x+1$. Since $x^3-x=x(x^2-1)=x(x-1)(x+1)$ and $x^2-2x+1=(x-1)^2$, the 2 parts have a common factor of $(x-1)$ and can be factored out. Thus, $x^3+x^2-3x+1=x^3-x+x^2-2x+1=x(x-1)(x+1)+(x-1)^2=(x-1)(x(x+1)+(x-1))=(x-1)(x^2+2x-1)$.
