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