\(\left(x+1\right)^3+\left(x-1\right)^3+x^3-3x\left(x+1\right)\left(x-1\right)\)
\(=x^3+3x^2+3x+1+x^3-3x^2+3x-1+x^3-3x\left(x^2-1\right)\)
\(=3x^3+6x-3x^4+3x\)
\(=-3x^4+3x^3+9x\)
\(x^3+3x^2y+3xy^2+y^3\) \(+x^3-3x^2y+3xy^2-y^3\)\(+x^3-3x\left(x^2-1\right)\)
\(=3x^3+6xy^2-3x^3+3x\)
\(=3x\left(1+2y^2\right)\)