Đặt \(x^2-3x-1=a\), ta có:
\(a^2-12a+27=a^2-9a-3a+27=a\left(a-9\right)-3\left(a-9\right)=\left(a-9\right)\left(a-3\right)\)
\(=\left(x^2-3x-1-9\right)\left(x^2-3x-1-3\right)=\left(x^2-3x-10\right)\left(x^2-3x-4\right)\)
Mà \(x^2-3x-10=x^2-5x+2x-10=x\left(x-5\right)+2\left(x-5\right)=\left(x-5\right)\left(x+1\right)\)
và \(x^2-3x-4=x^2+x-4x-4=x\left(x+1\right)-4\left(x+1\right)=\left(x+1\right)\left(x-4\right)\)
\(\Rightarrow\left(x^2-3x-1\right)^2-12\left(x^2-3x-1\right)+27=\left(x-5\right)\left(x-4\right)\left(x+1\right)\left(x+2\right)\)