x^2y-y^2z+xz^2-x^2z+xy^2+yz^2-2xyz
=(x² y-x² z)+(xz²+xy²-2xyz)-(y² z-yz²)
=x²(y-z)+x(y²-2yz+z²)-yz(y-z)
=x²(y-z)+x(y-z)²-yz(y-z)
=(y-z)[x²+x(y-z)-yz]
=(y-z)(x+y)(x-z)
x^2y-y^2z+xz^2-x^2z+xy^2+yz^2-2xyz
=(x² y-x² z)+(xz²+xy²-2xyz)-(y² z-yz²)
=x²(y-z)+x(y²-2yz+z²)-yz(y-z)
=x²(y-z)+x(y-z)²-yz(y-z)
=(y-z)[x²+x(y-z)-yz]
=(y-z)(x+y)(x-z)