\(9-\left(x-y\right)^2\)
\(=3^2-\left(x-y\right)^2\)
\(=\left(3-x+y\right)\left(3+x-y\right)\)
____
\(\left(x-y\right)^2-4\)
\(=\left(x-y\right)^2-2^2\)
\(=\left(x-y-2\right)\left(x-y+2\right)\)
____
\(\left(x+2\right)^2-y^2\)
\(=\left[\left(x+2\right)-y\right]\left[\left(x+2\right)+y\right]\)
\(=\left(x-y+2\right)\left(x+y+2\right)\)
____
\(\left(3x+1\right)^2-\left(x+1\right)^2\)
\(=\left(3x+1+x+1\right)\left(3x+1-x-1\right)\)
\(=2x\left(4x+2\right)\)
\(=4x\left(2x+1\right)\)
____
\(\left(x+y\right)^2-\left(x-y\right)^2\)
\(=\left(x+y+x-y\right)\left(x+y-x+y\right)\)
\(=2x\cdot2y\)
\(=4xy\)
____
\(\left(2xy+1\right)^2-\left(2x+y\right)^2\)
\(=\left(2xy+1-2x-y\right)\left(2xy+1+2x+y\right)\)
\(=\left[2x\left(y-1\right)-\left(y-1\right)\right]\left[2x\left(y+1\right)+\left(y+1\right)\right]\)
\(=\left(y-1\right)\left(2x-1\right)\left(2x+1\right)\left(y+1\right)\)