\(A=x^7-4x^3+x^2+2=x^3\left(x^4-4\right)+x^2+2\)
\(=x^3\left(x^2-2\right)\left(x^2+2\right)+x^2+2\)
\(=\left(x^2+2\right)\left(x^3\left(x^2-2\right)+1\right)\)
\(=\left(x^2+2\right)\left(x^5-2x^3+1\right)\)
\(=\left(x^2+2\right)\left(x^5-x^4+x^4-x^3-x^3+x^2-x^2+x-x+1\right)\)
\(=\left(x^2+2\right)\left[x^4\left(x-1\right)+x^3\left(x-1\right)-x^2\left(x-1\right)-x\left(x-1\right)-\left(x-1\right)\right]\)
\(=\left(x^2+2\right)\left(x-1\right)\left(x^4+x^3-x^2-x-1\right)\)