\(\frac{x^2+3xy+2y^2}{x^3+2x^2y-xy^2-2y^3}\)
\(=\frac{x^2+2xy+xy+2y^2}{x^2\left(x+2y\right)-y^2\left(x+2y\right)}\)
\(=\frac{x\left(x+2y\right)+y\left(x+2y\right)}{\left(x+2y\right)\left(x^2-y^2\right)}\)
\(=\frac{\left(x+2y\right)\left(x+y\right)}{\left(x+2y\right)\left(x-y\right)\left(x+y\right)}=\frac{1}{x-y}\)