<s>[INST] How to evaluate $\int \frac1{(x^2+a^2)^{m}}dx$ The integral $$\int\frac{1}{(x^2+a^2)^m}dx$$ can be expressed by a recursive formula of $$\frac{1}{2a^2(m-1)}\frac{x}{(x^2+a^2)^{m-1}} + \frac{2m-3}{2a^2(m-1)}\int\frac{dx}{(x^2+a^2)^{m-1}}$$ I do not understand how integration by part leads to this result. Specifically, since $$\int u dv = uv - \int v du$$ I want to know what is $u$, $du$, $v$, $dv$.
 [/INST] Integrate by parts as follows
\begin{align}
&\int\frac{1}{(x^2+a^2)^m}dx\\
= &\int \frac1{2a^2(m-1)x^{2m-3}}\ d\left[\bigg(\frac{x^2}{x^2+a^2} \bigg)^{m-1}\right]\\
=&\  \frac{1}{2a^2(m-1)}\frac{x}{(x^2+a^2)^{m-1}} + \frac{2m-3}{2a^2(m-1)}\int\frac{1}{(x^2+a^2)^{m-1}}dx
\end{align}
Thus
$$u= \frac1{2a^2(m-1)x^{2m-3}},\>\>\>\>\>
v= \left(\frac{x^2}{x^2+a^2} \right)^{m-1} $$
</s>