\(\left(x+1\right)\left(x^2-x+1\right)-\left(x+2\right)\left(x^2-2x+4\right)\)
\(=x^3-x^2+x+x^2-x+1-\left(x^3-2x^2+4x+2x^2-4x+8\right)\)
\(=x^3+\left(x^2-x^2\right)+\left(x-x\right)+1-\left(x^3+8\right)\)
\(=x^3+0+0+1-x^3-8\)
\(=x^3-x^3+1-8\)
\(=-7\)