\(=\left(x^2+y^2-x^2y^2-1\right)+\left(xy-x-y+1\right)\)
\(=\left(x^2-1\right)-y^2\left(x^2-1\right)+x\left(y-1\right)-\left(y-1\right)\)
\(=\left(x^2-1\right)\left(1-y^2\right)+\left(x-1\right)\left(y-1\right)\)
\(=\left(x-1\right)\left(x+1\right)\left(1-y\right)\left(1+y\right)-\left(x-1\right)\left(1-y\right)\)
\(=\left(x-1\right)\left(1-y\right)\left[\left(x+1\right)\left(y+1\right)-1\right]\)
\(=\left(x-1\right)\left(1-y\right)\left(xy+x+y\right)\)