\(a,=\left(x-1\right)^4-2\left(x-1\right)^2+1\\ =\left[\left(x-1\right)^2-1\right]^2\\ =\left(x^2-2x-2\right)^2\\ b,=\left[\left(x+1\right)\left(x+5\right)\right]\left[\left(x+2\right)\left(x+4\right)\right]-4\\ =\left(x^2+6x+5\right)\left(x^2+6x+8\right)-4\\ =\left(x^2+6x\right)^2+13\left(x^2+6x\right)+36\\ =\left(x^2+6x+4\right)\left(x^2+6x+9\right)\\ =\left(x+3\right)^2\left(x^2+6x+4\right)\)