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