\(a,x\left(x-y\right)+5\left(y-x\right)\)
\(=x\left(x-y\right)-5\left(x-y\right)\)
\(=\left(x-y\right)\left(x-5\right)\)
\(b,x^2-2xy-16+y^2\)
\(=\left(x^2-2xy+y^2\right)-16\)
\(=\left(x-y\right)^2-4^2\)
\(=\left(x-y-4\right)\left(x-y+4\right)\)