\(x^3+y^3+z^3-3xyz\)
\(=\left(x+y\right)^3+z^3-3x^2y-3xy^2-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)^3-3z\left(x+y\right)\left(x+y+z\right)-3xy\left(x-y-z\right)\)
\(=\left(x+y+z\right)\left[\left(x+y+z\right)^2-3z\left(x+y\right)-3xy\right]\)
\(=\left(x+y+z\right)\left(x^2+y^2+z^2+2xy+2xz+2yz-3xz-3yz-3xy\right)\)
\(=\left(x+y+z\right)\left(x^2+y^2+z^2-xy-xz-yz\right)\)