a) \(7x^3y-14x^2y+7xy\)
\(=7xy\left(x^2-2x+1\right)\)
\(=7xy\left(x-1\right)^2\)
b) \(x^2-9+\left(x-3\right)^2\)
\(=\left(x-3\right)\left(x+3\right)+\left(x-3\right)^2\)
\(=\left(x-3\right)\left(x+3+x-3\right)\)
\(=2x\left(x-3\right)\)
c) \(x^3-4x^2-12x+27\)
\(=x^3+3x^2-7x^2-21x+9x+27\)
\(=x^2\left(x+3\right)-7x\left(x+3\right)+9\left(x+3\right)\)
\(=\left(x+3\right)\left(x^2-7x+9\right)\)
d) \(x^3+y^3+z^3-3xyz\)
\(=\left(x+y\right)^3-3xy\left(x+y\right)+z^3-3xyz\)
\(=\left[\left(x+y\right)^3+z^3\right]-3xy\left(x+y+z\right)\)
\(=\left(x+y+z\right)\left[\left(x+y\right)^2-\left(x+y\right)z+z^2\right]-3xy\left(x+y+z\right)\)
\(=\left(x+y+z\right)\left(x^2+2xy+y^2-xz-yz+z^2\right)-3xy\left(x+y+z\right)\)
\(=\left(x+y+z\right)\left(x^2+y^2+z^2-xz-yz+2xy-3xy\right)\)
\(=\left(x+y+z\right)\left(x^2+y^2+z^2-xz-yz-xy\right)\)