\(=\left(x-y\right)^2-9=\left(x-y-3\right)\left(x-y+3\right)\)
\(x^2-2xy-9+y^2=\left(x^2-2xy+y^2\right)-9=\left(x-y\right)^2-3^2=\left(x-y-3\right).\left(x-y+3\right)\)
\(x^2-2xy-9+y^2=x^2-2xy+y^2-9=\left(x^2-2xy+y^2\right)-9=\left(x-y\right)^2-9=\left(x-y-3\right).\left(x-y+3\right)\)