a) \(\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)^2+4\left(x^2+x+1\right)-3\left(x^2+x+1\right)-12\)
\(=\left[\left(x^2+x+1\right)^2+4\left(x^2+x+1\right)\right]-\left[3\left(x^2+x+1\right)+12\right]\)
\(=\left(x^2+x+1\right)\left[\left(x^2+x+1\right)+4\right]-3\left[\left(x^2+x+1\right)+4\right]\)
\(=\left(x^2+x+1\right)\left(x^2+x+5\right)-3\left(x^2+x+5\right)\)
\(=\left(x^2+x+5\right)\left[\left(x^2+x+1\right)-3\right]\)
\(=\left(x^2+x+5\right)\left(x^2+x-2\right)\)
\(=\left(x^2+x+5\right)\left(x^2-x+2x-2\right)\)
\(=\left(x^2+x+5\right)\left[\left(x^2-x\right)+\left(2x-2\right)\right]\)
\(=\left(x^2+x+5\right)\left[x\left(x-1\right)+2\left(x-1\right)\right]\)
\(=\left(x^2+x+5\right)\left(x-1\right)\left(x+2\right)\)
c) \(\left(x^2+2x\right)^2+9x^2+18x+20\)
\(=\left(x^2+2x\right)^2+9\left(x^2+2x\right)+20\)
\(=\left(x^2+2x\right)^2+4\left(x^2+2x\right)+5\left(x^2+2x\right)+20\)
\(=\left[\left(x^2+2x\right)^2+4\left(x^2+2x\right)\right]+\left[5\left(x^2+2x\right)+20\right]\)
\(=\left(x^2+2x\right)\left[\left(x^2+2x\right)+4\right]+5\left[\left(x^2+2x\right)+4\right]\)
\(=\left[\left(x^2+2x\right)+4\right]\left[\left(x^2+2x\right)+5\right]\)
\(=\left(x^2+2x+4\right)\left(x^2+2x+5\right)\)
\(=\left(x^2+2x+4\right)\left(x^2+2x+5\right)\)
d) \(\left(x^2+3x+1\right)\left(x^2+3x+2\right)-6\)
\(=\left(x^2+3x+1\right)\left[\left(x^2+3x+1\right)+1\right]-6\)
\(=\left(x^2+3x+1\right)^2+\left(x^2+3x+1\right)-6\)
\(=\left(x^2+3x+1\right)^2-2\left(x^2+3x+1\right)+3\left(x^2+3x+1\right)-6\)
\(=\left[\left(x^2+3x+1\right)^2-2\left(x^2+3x+1\right)\right]+\left[3\left(x^2+3x+1\right)-6\right]\)
\(=\left(x^2+3x+1\right)\left[\left(x^2+3x+1\right)-2\right]+3\left[\left(x^2+3x+1\right)-2\right]\)
\(=\left(x^2+3x+1\right)\left(x^2+3x-1\right)+3\left(x^2+3x-1\right)\)
\(=\left(x^2+3x-1\right)\left[\left(x^2+3x+1\right)+3\right]\)
\(=\left(x^2+3x-1\right)\left(x^2+3x+4\right)\)