\(x^3-4x^2-12x+27=\left(x^3+27\right)-\left(4x^2+12x\right)\)\(=\left(x+3\right)\left(x^2-3x+9\right)-4x\left(x+3\right)\\ =\left(x+3\right)\left(x^2-3x+9-4x\right)=\left(x+3\right)\left(x^2-7x+9\right)\)
\(x^3-4x^2-12x+27\)
\(=x^3+3x^2-7x^2-21x+9x+27\)
\(=x^2\left(x+3\right)-7x\left(x+3\right)+9\left(x+3\right)\)
\(=\left(x+3\right)\left(x^2-7x+9\right)\)
\(x^3-4x^2-12x+27\)
\(=x^3-3x^2-9x+27-3x-x^2\)
\(=x^2\left(x-3\right)-9\left(x-3\right)-x\left(x-3\right)\)
\(=\left(x^2-9-x\right)\left(x-3\right)\)