X^3+x^2-x-1 = x^2(x + 1) - (x + 1) = (x+1)*(x^2 - 1) = (x+1)*(x-1)*(x+1) = (x-1)*(x+1)^2
a^2-b^2-a-b = (a-b)(a+b)-(a+b) = (a+b)*(a-b-1)
m^5-m^3+m^2-1 =m^3(m^2-1) + (m^2 - 1) = (m^3 + 1)(m^2 - 1) = (m + 1)(m^2 - m + 1)(m - 1)(m + 1) = (m^2 - m + 1)*(m - 1)*(m+1)^2
x-y-x^2+y^2 = (x-y) - (x^2 - y^2) = (x-y) - (x-y)(x+y) = (x-y)(1 - x - y)
x^4 - x^3 + x - 1 = x^3(x-1)+(x-1) = (x^3 + 1)(x - 1) = (x + 1)(x^2 - x + 1)(x - 1)