<s>[INST] General rule for integrals of irrational functions involving $r = \sqrt{a^2 + x^2}$ Browsing the List of integrals of irrational functions I found out that if
$$r=\sqrt{(a^2+x^2)}$$
then
$$\int{rdx}=\frac12(xr+a^2\ln{(x+r)})$$
$$\int{r^3dx}=\frac14xr^3+\frac38a^2xr+\frac38a^4\ln(x+r)$$
$$\int{r^5dx}=\frac16xr^5+\frac{5}{24}a^2xr^3+\frac{5}{16}a^4xr+\frac{5}{16}a^6\ln(x+r)$$
Is there any general rule for defining $$\int{r^ndx}, \quad n=2k+1, \quad k\in\mathbb{N}$$
If so, then how to derive the formula? Thank you.
 [/INST] If we denote the integral by
$$I_k=\int\left(a^2+x^2\right)^{(2k+1)/2}\mathrm{d}x$$
then we can apply integration by parts to get
$$\begin{align}
I_k
&=x\left(a^2+x^2\right)^{(2k+1)/2}-(2k+1)\int x^2\left(a^2+x^2\right)^{(2k-1)/2}\mathrm{d}x\\
&=x\left(a^2+x^2\right)^{(2k+1)/2}-(2k+1)\int \left(a^2+x^2\right)^{(2k+1)/2}-a^2\left(a^2+x^2\right)^{(2k-1)/2}\mathrm{d}x\\
&=x\left(a^2+x^2\right)^{(2k+1)/2}-(2k+1)I_k+a^2(2k+1)I_{k-1}\\
\end{align}$$
Then we have the reduction formula
$$I_k=\frac1{2(k+1)}\left(x\left(a^2+x^2\right)^{(2k+1)/2}+a^2(2k+1)I_{k-1}\right)$$
So we then only need the solution to $I_1$ in order to calculate any other $I_k$. In fact it's easier to calculate $I_{-1}$ which is
$$I_{-1}=\int\frac{\mathrm{d}x}{\sqrt{a^2+x^2}}=\ln{\left(x+\sqrt{a^2+x^2}\right)}+C=\text{arsinh}\left(\frac{x}a\right)+C$$
</s>