Đặt \(x^2+x+1=t\)
\(\left(x^2+x+1\right)\left(x^2+x+2\right)-12=t\left(t+1\right)-12=t^2+t-12=\left(t^2+t+\dfrac{1}{4}\right)-\dfrac{49}{4}=\left(t+\dfrac{1}{2}\right)^2-\left(\dfrac{7}{2}\right)^2=\left(t+\dfrac{1}{2}-\dfrac{7}{2}\right)\left(t+\dfrac{1}{2}+\dfrac{7}{2}\right)=\left(t-3\right)\left(t+4\right)=\left(x^2+x-2\right)\left(x^2+x+5\right)\)
\(\left(x^2+x+1\right)\left(x^2+x+2\right)-12\)
= \(\left(x^2+x+1\right)\left[\left(x^2+x+1\right)+1\right]-12\)
= \(\left(x^2+x+1\right)^2\left(x^2+x+1\right)-12\)
= \(\left(x^2+x+1\right)\left(x^2+x+1\right)-3\left(x^2+x+1\right)+4\left(x^2+x+1\right)-4.3\)
= \(\left(x^2+x+1\right)\left(x^2+x-2\right)+4\left(x^2+x-2\right)\)
= \(\left(x^2+x+5\right)\left(x^2+x-2\right)\)