\(2x^2+2y^2-x^2z+z-y^2z-2\)
\(=\left(2x^2-x^2z\right)+\left(2y^2-y^2z\right)-\left(2-z\right)\)
\(=x^2\left(2-z\right)+y^2\left(2-z\right)-\left(2-z\right)\)
\(=\left(2-z\right)\left(x^2+y^2-1\right)\)
\(2x^2+2y^2-x^2z-y^2z-2=x^2\left(2-z\right)+y^2\left(2-z\right)-\left(2-z\right)=\left(2-z\right)\left(x^2+y^2-1\right)\)