\(a,x^2-2xy+y^2-z^2=\left(x-y\right)^2-z^2=\left(x-y-z\right).\left(x-y+z\right)\)
\(b,x^3+y^3+2x^2-2xy+2y^2=\left(x^3+y^3\right)+2\left(x^2-xy+y^2\right)=\left(x+y\right).\left(x^2-2xy+y^2\right)+2.\left(x^2-xy+y^2\right)=\left(x^2-xy+y^2\right).\left(x+y+2\right)\)