\(x^2y+xy^2+x^2z+xz^2+y^2z+yz^2+2xyz\\ =x^2y+xy^2+x^2z+xz^2+y^2z+yz^2+xyz+xyz\\ =\left(x^2y+x^2z+xyz+xz^2\right)+\left(xy^2+y^2z+xyz+yz^2\right)\\ =x\left(xy+xz+yz+z^2\right)+y\left(xy+yz+xz+z^2\right)\\ =\left(x+y\right)\left(xy+yz+xz+z^2\right)\\=\left(x+y\right)\left[\left(xy+yz\right)+\left(xz+z^2\right)\right]\\=\left(x+y\right)\left[y\left(x+z\right)+z\left(x+z\right)\right]\\ =\left(x+y\right)\left(y+z\right)\left(x+z\right) \)
\(x^2y+xy^2+x^2z+xz^2+yz^2+2xyz\)
\(=x^2\left(y+z\right)+x\left(y^2+z^2+2yz\right)+yz\left(y+z\right)\)
\(=x^2\left(y+z\right)+x\left(y+z\right)^2+yz\left(y+z\right)\)
\(=\left(y+z\right)\left[x\left(x+y\right)+z\left(x+y\right)\right]\)
\(=\left(y+z\right)\left(x+y\right)\left(z+z\right)\)