note at all, I want get from the first one to the second one, say I was given to2x^3-3x+1, how do I get to (x-1)(2x^2+2x-1). I dont see how what you did applies

there is an alternative way:\[\begin{align}
2x^3-3x+1&=x(2x^2-3)+1\\
&=x(2x^2-3)-(2x^2-3)+(2x^2-3)+1\\
&=(x-1)(2x^2-3)+2x^2-3+1\\
&=(x-1)(2x^2-3)+2x^2-2\\
&=(x-1)(2x^2-3)+2(x^2-1)\\
&=(x-1)(2x^2-3)+2(x-1)(x+1)\\
&=(x-1)(2x^2-3+2(x+1))\\
&=(x-1)(2x^2-3+2x+2)\\
&=(x-1)(2x^2+2x-1)
\end{align}\]