Ta có: \(x^2y-xy^2+y^2z-yz^2+xz^2-x^2z=xy\left(x-y\right)-z\left(x^2-y^2\right)+z^2\left(x-y\right)\)
\(=xy\left(x-y\right)-z\left(x-y\right)\left(x+y\right)+z^2\left(x-y\right)=\left(x-y\right)\left(xy-zx-zy+z^2\right)\)
\(=\left(x-y\right)\left(x\left(y-z\right)-z\left(y-z\right)\right)=\left(x-y\right)\left(y-z\right)\left(x-z\right)\)