a) \(...=\dfrac{x^3+2x+2x^2+2x+x^2-x+1}{\left(x+1\right)\left(x^2-x+1\right)}\)
\(=\dfrac{x^3+3x^2+3x+x^2+1}{\left(x+1\right)\left(x^2-x+1\right)}\)
\(=\dfrac{\left(x+1\right)^2}{x^2-x+1}\)
\(=\dfrac{x^2+2x+1}{x^2-x+1}=1+\dfrac{3x}{x^2-x+1}\)
b) \(...=\dfrac{3\left(x^2+2x+1\right)+\left(x-1\right)^2-3\left(x^2+x+1\right)}{\left(x-1\right)\left(x^2+x+1\right)}\)
\(=\dfrac{3x^2+6x+3+x^2-2x+1-3x^2-3x-3}{\left(x-1\right)\left(x^2+x+1\right)}\)
\(=\dfrac{x^2+x+1}{\left(x-1\right)\left(x^2+x+1\right)}=\dfrac{1}{x-1}\)