\(x^3+2x^2y+xy^2\)
\(=x\left(x^2+2xy+y^2\right)\)
\(=x\left(x+y\right)^2\)
\(x^3+2x^2y+xy^2\\ =\left(x^3+x^2y\right)+\left(x^2y+xy^2\right)\\ =x^2\left(x+y\right)+xy\left(x+y\right)\\ =\left(x^2+xy\right)\left(x+y\right)\)
\(x^3+2x^2y+xy^2=x\left(x^2+2xy+y^2\right)=x\left(x+y\right)^2\)