x3+x+2
=x^3+x^2-x^2+x+2
=x^2(x+1)-(x-2)(x+1)
=(x+1)(x^2-x+2)
x3-4x2-4x-5
=x^3-5x^2+x^2-4x-5
=x^2(x-5)+(x-5)(x+1)
=(x-5)(x^2+x+1)
x3+x+2
=x^3+x^2-x^2+x+2
=x^2(x+1)-(x-2)(x+1)
=(x+1)(x^2-x+2)
x3-4x2-4x-5
=x^3-5x^2+x^2-4x-5
=x^2(x-5)+(x-5)(x+1)
=(x-5)(x^2+x+1)