a: \(x^8+x^4+1\)
\(=x^8+2x^4+1-x^4\)
\(=\left(x^4+1\right)^2-x^4\)
\(=\left(x^4+1+x^2\right)\left(x^4+1-x^2\right)\)
\(=\left(x^4+2x^2+1-x^2\right)\left(x^4-x^2+1\right)\)
\(=\left(x^4-x^2+1\right)\cdot\left[\left(x^2+1\right)^2-x^2\right]\)
\(=\left(x^4-x^2+1\right)\left(x^2+1-x\right)\left(x^2+1+x\right)\)
b: \(\left(x^2+1\right)^2+3x\left(x^2+1\right)+2x^2\)
\(=\left(x^2+1\right)^2+x\left(x^2+1\right)+2x\left(x^2+1\right)+2x^2\)
\(=\left(x^2+1\right)\left(x^2+x+1\right)+2x\left(x^2+1+x\right)\)
\(=\left(x^2+x+1\right)\left(x^2+2x+1\right)\)
\(=\left(x^2+x+1\right)\left(x+1\right)^2\)