<s>[INST] How to solve long integration by partial fraction decomposition problems faster? Some problems are just too time consuming for short exam times what is the fastest way to solve problems like this one for example $$\int \frac{5x^4-21x^3+40x^2-37x+14}{(x-2)(x^2-2x+2)^2}dx$$
 [/INST] With $x=t+1$
\begin{align}
&\ \frac{5x^4-21x^3+40x^2-37x+14}{(x-2)(x^2-2x+2)^2}
= \frac{5t^4-t^3+7t^2+1}{(t-1)(t^2+1)^2}
= \frac{A}{t-1}+ {P(t)}
\end{align}
where $A = \lim_{t\to 1}\frac{5t^4-t^3+7t^2+1}{(t^2+1)^2}=3
$ and
\begin{align}
P(t)= &\ \frac{5t^4-t^3+7t^2+1}{(t-1)(t^2+1)^2}
-\frac{3}{t-1}\\
= &\ \frac{2t^3+t^2+2t+2}{(t^2+1)^2}
=\frac{2t(t^2+1)+(t^2+1)+1}{(t^2+1)^2}
= \frac{2t+1}{t^2+1}+ \frac{1}{(t^2+1)^2}\\
\end{align}
Thus, the integral becomes
$$I=\int \frac3{t-1}+ \frac{2t+1}{t^2+1}+ \frac{1}{(t^2+1)^2}\ dt
$$
</s>