<s>[INST] $\int \frac{x^3+3x+2}{(x^2+1)^2 (x+1)} \ dx$ without using partial fraction decomposition One way to evaluate the integral $$\int \frac{x^3+3x+2}{(x^2+1)^2(x+1)} \ dx $$ is to rewrite it as $$ \int \frac{x^3+x+2x+2}{(x^2+1)^2(x+1)} dx \\=\int\frac{x(x^2+1) +2(x+1)}{(x^2+1)^2(x+1)}dx\\=\int\frac{x}{(x^2+1)(x+1)}dx+\int\frac{2}{(x^2+1)^2}dx$$ and then proceed by using partial fraction decomposition on the first integral. The second integral could be dealt with by substituting $x=\tan \theta$.
Is there a way to evaluate this integral without using partial fractions, and preferably without splitting it into two integrals as I did here?
 [/INST] To avoid partially fractionizing the integrand, proceed with the substitution below instead
\begin{align}
\int\frac{x^3+3x+2}{(x^2+1)^2(x+1)}\overset{x=\frac{1-y}{1+y}}{dx}
=&\ \frac12\int \frac{y^3-3y^2-3y-3}{(1+ y^2)^2}dy\\
=& \ \frac12\int \frac{(y^2-3)y}{(1+ y^2)^2}-\frac3{1+ y^2}\ dy\\
=& \ \frac1{1+ y^2}+\frac14\ln(1+ y^2)-\frac32\tan^{-1}y
\end{align}
</s>