\(\left(\frac{1}{x}+1-\frac{3}{x^3+1}-\frac{3}{x^2-x+1}\right)\cdot\frac{3x^2-3x+3}{\left(x+1\right).\left(x+2\right)}-\frac{2x-2}{x^2+2x}\)
\(=\left(\frac{x+1}{x}-\frac{3}{\left(x+1\right).\left(x^2-x+1\right)}+\frac{3.\left(x+1\right)}{\left(x+1\right).\left(x^2-x+1\right)}\right)\cdot\frac{3.\left(x^2-x+1\right)}{\left(x+1\right).\left(x+2\right)}-\frac{2.\left(x-1\right)}{x.\left(x+2\right)}\)
\(=\left[\frac{\left(x+1\right)^2.\left(x^2-x+1\right)-3x+3x^2+3x}{x.\left(x+1\right).\left(x^2-x+1\right)}\right]\cdot\frac{3.\left(x^2-x+1\right)}{\left(x+1\right).\left(x+2\right)}-\frac{2.\left(x-1\right)}{x.\left(x+2\right)}\)
\(=\left[\frac{x^4+x^3+x+1+3x^2}{x.\left(x+1\right).\left(x^2-x+1\right)}\right]\cdot\frac{3.\left(x^2-x+1\right)}{\left(x+1\right).\left(x+2\right)}-\frac{2.\left(x-1\right)}{x.\left(x+2\right)}\)
\(=\frac{3x^4+3x^3+3x+3+9x^2}{x.\left(x+1\right)^2.\left(x+2\right)}-\frac{2.\left(x-1\right)}{x.\left(x+2\right)}=\frac{3x^4+3x^3+3x+3+9x^2}{x.\left(x+1\right)^2.\left(x+2\right)}-\frac{2x^3+2x^2-2x-2}{x.\left(x+1\right)^2.\left(x+2\right)}\)
\(=\frac{3x^4+x^3+7x^2+5x+5}{x.\left(x+1\right)^2.\left(x+2\right)}\)