a: \(10x\left(x-y\right)-5y\left(y-x\right)\)
\(=10x\left(x-y\right)+5y\left(x-y\right)\)
\(=5\left(x-y\right)\left(2x+y\right)\)
b: \(\left(x-1\right)^2-\left(x+2\right)\left(x-1\right)\)
\(=\left(x-1\right)\left(x-1-x-2\right)\)
\(=-3\left(x-1\right)\)