(N/A) The integrand is a proper rational function. We decompose it into partial fractions as follows:
| Form of the rational function | Form of the partial fraction |
| $\frac{px^{2}+qx+r}{(x-a)(x^{2}+bx+c)}$ | $\frac{A}{x-a}+\frac{Bx+C}{x^{2}+bx+c}$ |
$\frac{x^{2}+x+1}{(x+2)(x^{2}+1)} = \frac{A}{x+2} + \frac{Bx+C}{x^{2}+1}$
Multiplying both sides by $(x+2)(x^{2}+1)$,we get:
$x^{2}+x+1 = A(x^{2}+1) + (Bx+C)(x+2)$
$x^{2}+x+1 = A(x^{2}+1) + Bx^{2} + 2Bx + Cx + 2C$
$x^{2}+x+1 = (A+B)x^{2} + (2B+C)x + (A+2C)$
Equating the coefficients of $x^{2}, x$ and the constant term,we get:
$A+B = 1$
$2B+C = 1$
$A+2C = 1$
Solving these equations:
From $A+B=1$,$B=1-A$.
From $A+2C=1$,$C=\frac{1-A}{2}$.
Substituting into $2B+C=1$:
$2(1-A) + \frac{1-A}{2} = 1$
$4-4A+1-A = 2$
$5-5A = 2 \implies 5A = 3 \implies A = \frac{3}{5}$.
Then $B = 1 - \frac{3}{5} = \frac{2}{5}$ and $C = \frac{1 - 3/5}{2} = \frac{2/5}{2} = \frac{1}{5}$.
Thus,$\int \frac{x^{2}+x+1}{(x+2)(x^{2}+1)} dx = \int \left( \frac{3/5}{x+2} + \frac{2/5x + 1/5}{x^{2}+1} \right) dx$
$= \frac{3}{5} \int \frac{1}{x+2} dx + \frac{1}{5} \int \frac{2x}{x^{2}+1} dx + \frac{1}{5} \int \frac{1}{x^{2}+1} dx$
$= \frac{3}{5} \ln|x+2| + \frac{1}{5} \ln(x^{2}+1) + \frac{1}{5} \tan^{-1}(x) + C$.