\(=xy^2-xz^2+yz^2-x^2y+x^2z-y^2z\)
\(=\left(xy^2-x^2y\right)-\left(xz^2-yz^2\right)+\left(x^2z-y^2z\right)\)
\(=-xy\left(x-y\right)-z^2\left(x-y\right)+z\left(x^2-y^2\right)\)
\(=-xy\left(x-y\right)-z^2\left(x-y\right)+z\left(x-y\right)\left(x+y\right)\)
\(=\left(x-y\right)\left[-xy-z^2+z\left(x+y\right)\right]\)
\(=\left(x-y\right)\left(-xy-z^2+xz+yz\right)\)
\(=\left(x-y\right)\left[-\left(xy-yz\right)-\left(z^2-xz\right)\right]\)
\(=\left(x-y\right)\left[-y\left(x-z\right)-z\left(z-x\right)\right]\)
\(=\left(x-y\right)\left[y\left(z-x\right)-z\left(z-x\right)\right]\)
\(=\left(x-y\right)\left(z-x\right)\left(y-z\right)\)