\(a,\left(x-2\right)\left(x^2+2x+4\right)-\left(x-1\right)^3+7\)
\(=x^3-8-x^3+3x^2-3x+1+7\)
\(=3x\left(x-1\right)\)
\(b,x\left(x+2\right)\left(2-x\right)+\left(x+3\right)\left(x^2-3x+9\right)\)
\(=x\left(4-x^2\right)+x^3+27\)
\(=4x-x^3+x^3+27=4x-27\)