The answer is (x^2-1)(x+1)+2

There is no number that can be pulled out (factored out) automatically so you must find factors of each term individually. The factors of x^3 (which are x^2*x); factors of x^2 (which are x*x) and factors of -x (which are -1*x) When you FOIL (x^2-1)(x+1) you get x^3+x^2-x-1.Because there is a -1 you must add 2 to the end. By adding 2 you end up with your original x^3+x^2+1-x.

x^3+x^2+1-x

group:

(x^3+x^2) (1-x)

factor:

x^2(x + 1) -1 (x -1)

(x^2 -1)(x-1) (x+1)

x^3+x^2+1-x

just group:

(x^3+x^2) (1-x)

now find the highest things the numbers in the first parentheses have in common

which would be x^2 so factor out x^2

x^2(x + 1) do the same for the second -1 (x -1)

so you end up with:

(x^2 -1)(x-1) (x+1)

By error you might have given this cubic equation. But having given the equation it has a solution. Since the question is possed by a high school student this may be beyond the syllabus.

In the theory of equations relating to the cubic equations, you can find how to arrive at the roots of a third degree equations.For any third degree equation , f(x) = x^3+ax^2+bx+c=0 , if alpha is a root of it, then f(alpha) = 0. So, (x-alpha) is a factor of f(x) rremainder theorem.

A 3rd degree equation always has 3 roots, alpha, beta gamma, say. Then f(x) = x^3+ax^2+bx+c = (x-alpha)(x-beta)(x-gamma). So, the right side here,you see the factors which you wanted. But for this,you need to find the roots.

For the given expression, x^2+x^2-x+1 , a=1, b=1,c=-1 and d=1, could be expressed like (x-alpha)(x-beta)(x-gamma), if you find the roots, alpha,beta and gamma of the cubic equation, x^2+x^2-x+1=0. Futher if you are interested you can feed a =1, b=1 c=-1 and d= 2 to any cubic solving calculator and arrive at the alpha ,beta and gamma as below:

Alpha = -1.8392867552141612,

Beta = 0.41964337760708065 + i* 0.6062907292071992 and

Gamma = 0.41964337760708065 - i* 0.6062907292071992,

where i = (-1)^-(1/2) or square root of minus 1.

By calulator