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