\(3x^2\left(x-1\right)+5x\left(1-x\right)^2\\ =-3x^2\left(1-x\right)+5x\left(1-x\right)\left(1-x\right)\\ =\left(1-x\right)\left(-3x^2+5x-5x^2\right)\\ =x\left(1-x\right)\left(-3x+5-5x\right)\\ =x\left(1-x\right)\left(5-8x\right)\)
\(3\left(x-y\right)^2+9y\left(y-x\right)^2\\ =3\left(x-y\right)\left(x-y\right)+9y\left(y-x\right)\left(y-x\right)\\ =-3\left(x-y\right)\left(y-x\right)+9y\left(y-x\right)\left(y-x\right)\\ =\left(y-x\right)\left(-3x+3y+9y^2-9xy\right)\\ =\left(y-x\right)\left[-3\left(x-y\right)+9y\left(y-x\right)\right]\\ =\left(y-x\right)\left[-3\left(x-y\right)-9y\left(x-y\right)\right]\\ =\left(y-x\right)\left(-3-9y\right)\left(x-y\right)\\ =-3\left(y-x\right)\left(1+3y\right)\left(x-y\right)\)
\(3\left(x-y\right)^2+9y\left(y-x\right)\\ =3\left(x-y\right)\left(x-y\right)-9y\left(x-y\right)\\ =\left(x-y\right)\left(3x-3y-9y\right)\\ =\left(x-y\right)\left(3x-12y\right)\\ =3\left(x-y\right)\left(x-4y\right)\)