<s>[INST] Integration through partial fractions with complex roots In integrating the following: $\frac{1}{(x^2+2x+3)^2}$ I am trying to use partial fraction decomposition as follows:
$\frac{1}{(x^2+2x+3)^2} = \frac{Ax + B}{x^2+2x+3} + \frac{Cx + D}{(x^2+2x+3)^2}$
Which gives me:
$1 = (Ax + B)(x^2 +2x +3) + (Bx + C)$
And that gets me back to where I started.
$\frac{1}{(x^2+2x+3)^2}$
What am I doing wrong?
 [/INST] You don't need he partial fractions decomposition: as already observed, the substitution $u=x+1$ results in having to compute the integral $\;\int\frac{\mathrm du}{(u^2+2)^2}$.
Now this integral pertains to a well-known type:
$$I_n=\int\frac{\mathrm d x}{(x^2+a^2)^n},$$
which is easily computed though a recursion formula. Indeed


*

*$I_1=\dfrac1a\,\arctan \dfrac xa$.

*To establish the recursion formula, use integration by parts for $I_n$:


Setting $u=\dfrac1{(x^2+a^2)^n},\;\mathrm dv=\mathrm dx$, whence $\;\mathrm du=\dfrac{-2n x}{(x^2+a^2)^{n+1}}\,\mathrm dx,\;v= x$, so
$$I_n=\frac x{(x^2+a^2)^n}+2n\int\frac {x^2}{(x^2+a^2)^{n+1}}=\frac x{(x^2+a^2)^n}+2n(I_n-a^2I_{n+1}),$$
whence the relation
$$I_{n+1}=\frac1{2na^2}\frac x{(x^2+a^2)^n}+\frac{2n-1}{2na^2}I_n.$$
</s>