a, \(x^3+5x^2+8x+4=x^3+x^2+4x^2+4x+4x+4\)
\(=x^2\left(x+1\right)+4\left(x^2+2x+1\right)=x^2\left(x+1\right)+4\left(x+1\right)^2=\left(x^2+4\right)\left(x+1\right)\)
b, \(x^3-6x^2-x+30=x^3+2x^2-8x^2-16x+15x+30\)
\(=x^2\left(x+2\right)-8x\left(x+2\right)+15\left(x+2\right)\)
\(=\left(x+2\right)\left(x^2-8x+15\right)=\left(x+2\right)\left(x^2-8x+16-1\right)\)
\(=\left(x+2\right)\left[\left(x-4\right)^2-1\right]=\left(x+2\right)\left(x-3\right)\left(x-5\right)\)