a, \(3x^2\left(y-x\right)+6x^2\left(x-y\right)^2\)
\(=3x^2\left(y-x\right)\left[1+2\left(y-x\right)\right]\)
\(=3x^2\left(y-x\right)\left(1+2y-2x\right)\)
b, \(x^4-3x^3+3x-1\)
\(=\left(x^4-1\right)+\left(-3x^3+3x\right)\)
\(=\left(x^2-1\right)\left(x^2+1\right)-3x\left(x^2-1\right)\)
\(=\left(x^2-1\right)\left(x^2+1-3x\right)\)
\(=\left(x-1\right)\left(x+1\right)\left(x^2-3x+1\right)\)