a: \(=\left(x^2+x\right)^2+4\left(x^2+x\right)-12\)
\(=\left(x^2+x+6\right)\left(x^2+x-2\right)\)
\(=\left(x^2+x+6\right)\left(x+2\right)\left(x-1\right)\)
b: \(\left(x^2+4x+8\right)^2+3x^3+14x^2+24x\)
\(=\left(x^2+4x+8\right)^2+3x^3+12x^2+24x+2x^2\)
\(=\left(x^2+4x+8\right)^2+3x\left(x^2+4x+8\right)+2x^2\)
\(=\left(x^2+5x+8\right)\left(x^2+6x+8\right)\)
\(=\left(x^2+5x+8\right)\left(x+2\right)\left(x+4\right)\)