<s>[INST] Integral: $\int \dfrac{dx}{(x^2-4x+13)^2}$? 
How can I integrate $$\int \dfrac{dx}{(x^2-4x+13)^2}?$$

Here is my attempt:
$$\int \dfrac{dx}{(x^2-4x+13)^2}=\int \dfrac{dx}{((x-2)^2+9)^2}$$
Substitute $x-2=3\tan\theta$, $\ dx=3\sec^2\theta d\theta$
\begin{align*}
&=\int \dfrac{3\sec^2\theta d\theta}{(9\tan^2\theta+9)^2}\\
&=\int \dfrac{3\sec^2\theta d\theta}{81\sec^4\theta}\\
&=\dfrac{1}{27}\int \cos^2\theta d\theta\\
&=\dfrac{1}{27}\int \frac{1+\cos2\theta}{2} d\theta\\
&=\dfrac{1}{54}\left(\theta+\frac{\sin2\theta}{2}\right)+C
\end{align*}
This is where I got stuck. How can I get the answer in terms of $x$?
Can I solve it by other methods?
 [/INST] Here is an alternative method. You can first use substitution to simplify the integral:
$$\int \dfrac{dx}{(x^2-4x+13)^2}$$
$$ =\int \dfrac{dx}{((x-2)^2+9)^2} = \int \dfrac{du}{(u^2+9)^2} \tag{$u=x-2, du = dx$}$$
$$=\frac{1}{81}\int \dfrac{du}{(\frac{u^2}{9}+1)^2} = \frac{1}{27} \int \dfrac{dv}{(v^2+1)^2} \tag{$u=3v, du = 3 \ dv$}$$
and then use integration by parts as shown in Rene's answer in this thread. This leads to:
$$2\int \frac{1}{(1+v^2)^2}\,dv=\frac{v}{1+v^2}+\int \frac{1}{1+v^2}\,dv$$
$$\int \frac{1}{(1+v^2)^2}\,dv=\frac{1}{2} \left(\frac{v}{1+v^2}+\arctan(v) \right)$$
and then a couple of back-substitutions leads you to the answer of the original problem.
</s>