\(=x\left(y^2-4\right)+xz\left(y+2\right)\)
\(=x\left(y+2\right)\left(y-2\right)+x\left(y+2\right)z\)
\(=x\left(y+2\right)\left(y-2+z\right)\)
\(xy^2-4x+xyz+2xz\)
\(=x\left(y-2\right)\left(y+2\right)+zx\left(y+2\right)\)
\(=x\left(y+2\right)\left(y-2+z\right)\)