# Difficult Integral: $\int\frac{x^n}{\sqrt{1+x^2}}dx$

How to calculate this difficult integral: $\int\frac{x^2}{\sqrt{1+x^2}}dx$?

The answer is $\frac{x}{2}\sqrt{x^2\pm{a^2}}\mp\frac{a^2}{2}\log(x+\sqrt{x^2\pm{a^2}})$.

And how about $\int\frac{x^3}{\sqrt{1+x^2}}dx$?

• WA now seems to understand LaTeX and so it is easy to experiment and see a general form. Try wolframalpha.com/input/… and change the exponent. – lhf Sep 14 '11 at 11:39
• Where did $a$ come from? – TonyK Sep 14 '11 at 11:46
• There is a nice recursion you can derive: letting $\mu_n=\int \frac{t^n}{\sqrt{t^2+1}}\mathrm dt$, we have $$\mu_n=\frac1{n}(t^{n-1}\sqrt{1+t^2}-(n-1)\mu_{n-2})$$. The integrals for $n=0,1$ are easily derived, so you can use those to start the recursion. – J. M. is a poor mathematician Sep 14 '11 at 11:53
• but how did you get this recursion？ – Charles Bao Sep 14 '11 at 12:11

Recall the hyperbolic functions $$\cosh t= \frac{e^t + e^{-t}}{2} = \cos(it)$$ and $$\sinh t=\frac{e^t - e^{-t}}{2} = i\sin(-it).$$

Note that $\frac{d}{dt}\sinh t = \cosh t$, $\frac{d}{dt}\cosh t = \sinh t$ and also $\cosh^2 t -\sinh^2 t = 1$.

Making the substitution $\sinh t=x$ we see that
$$\frac{x^n\, dx}{\sqrt{1+x^2}} = \frac{\sinh^n t\, \cosh t\,dt}{\sqrt{1+\sinh^2t}}= \frac{\sinh^n t\, \cosh t\,dt}{\sqrt{\cosh^2t}}=\sinh^n t\, dt$$ which leads us to $$\int\frac{x^n\, dx}{\sqrt{1+x^2}} = \int \sinh^n t\, dt.$$ To complete the problem, the binomial theorem is useful.

• This is one case where the hyperbolic sine is a better substitution choice than the tangent. – J. M. is a poor mathematician Sep 14 '11 at 12:24
• @J.M.: It is fairly standard in the hyperbolic world :) – AD. Sep 14 '11 at 12:26
• @J. M.: The integration is definitely easier with $x=\sinh(t)$, but it often leaves a more involved back-substitution to get things in terms of $x$. – robjohn Sep 14 '11 at 13:34
• @robjohn: Dunno, but I don't find $\mathrm{arsinh}(x)$ complicated... – J. M. is a poor mathematician Sep 14 '11 at 13:36
• @robjohn: That is why we get the $\log$ etc. – AD. Sep 14 '11 at 13:38

Here's one way to go about deriving a recursion relation for integrals of the form

$$\int\frac{x^n}{\sqrt{1+x^2}}\mathrm dx$$

Split the integral like so:

$$\int x^{n-1}\frac{x}{\sqrt{1+x^2}}\mathrm dx$$

and integrate by parts:

$$\int x^{n-1}\frac{x}{\sqrt{1+x^2}}\mathrm dx=x^{n-1}\sqrt{1+x^2}-(n-1)\int\sqrt{1+x^2} x^{n-2}\mathrm dx$$

Noting that $1+x^2$ is always positive for real $x$, we then complicate things a little:

$$\int \frac{x^n}{\sqrt{1+x^2}}\mathrm dx=x^{n-1}\sqrt{1+x^2}-(n-1)\int(1+x^2)\frac{x^{n-2}}{\sqrt{1+x^2}}\mathrm dx$$

Perform another split:

$$\int\frac{x^n}{\sqrt{1+x^2}}\mathrm dx=x^{n-1}\sqrt{1+x^2}-(n-1)\left(\int \frac{x^n}{\sqrt{1+x^2}}\mathrm dx+\int\frac{x^{n-2}}{\sqrt{1+x^2}}\mathrm dx\right)$$

and we see something we can isolate:

$$n\int\frac{x^n}{\sqrt{1+x^2}}\mathrm dx=x^{n-1}\sqrt{1+x^2}-(n-1)\int\frac{x^{n-2}}{\sqrt{1+x^2}}\mathrm dx$$

and then we finally divide both sides by $n$:

$$\int\frac{x^n}{\sqrt{1+x^2}}\mathrm dx=\frac1{n}\left(x^{n-1}\sqrt{1+x^2}-(n-1)\int\frac{x^{n-2}}{\sqrt{1+x^2}}\mathrm dx\right)$$

We can use the starting values $\int\frac{\mathrm dx}{\sqrt{1+x^2}}=\mathrm{arsinh}\,x$ and $\int\frac{x \mathrm dx}{\sqrt{1+x^2}}=\sqrt{1+x^2}$ for the recursion.

(This is a response to Srivatsan's comment, which got too long for the comment box.)

• Thanks for writing the answer. (Btw I ran out of votes, so I'll upvote it when I get them back.) – Srivatsan Sep 14 '11 at 15:12
• @Sri: No worries; I expend my votes too quickly, too. – J. M. is a poor mathematician Sep 14 '11 at 15:19

I would first try the substitution $x=\tan(\theta)$, so that $\sqrt{1+x^2}=\sec(\theta)$. That gives \begin{align} \int\frac{x^n}{\sqrt{1+x^2}}\;\mathrm{d}x &=\int \tan^n(\theta)\sec(\theta)\;\mathrm{d}\theta\\ &=\tan^{n-1}(\theta)\sec(\theta)-(n-1)\int\tan^{n-2}(\theta)\;\sec^3(\theta)\;\mathrm{d}\theta\\ &=\tan^{n-1}(\theta)\sec(\theta)-(n-1)\int(\tan^n(\theta)+\tan^{n-2}(\theta))\;\sec(\theta)\;\mathrm{d}\theta\\ &=\frac{1}{n}\tan^{n-1}(\theta)\sec(\theta)-\frac{n-1}{n}\int\tan^{n-2}(\theta)\;\sec(\theta)\;\mathrm{d}\theta \end{align} If $n$ is odd, this reduces to $$\int\tan(\theta)\sec(\theta)\;\mathrm{d}\theta=\sec(\theta)+C$$ If $n$ is even, this reduces to \begin{align} \int\sec(\theta)\;\mathrm{d}\theta&=\int\sec^2(\theta)\;\mathrm{d}\sin(\theta)\\ &=\int\frac{1}{2}\left(\frac{1}{1-\sin(\theta)}+\frac{1}{1+\sin(\theta)}\right)\;\mathrm{d}\sin(\theta)\\ &=\frac{1}{2}\log\left(\frac{1+\sin(\theta)}{1-\sin(\theta)}\right)+C\\ &=\log(\sec(\theta)+\tan(\theta))+C \end{align}

Since $\frac{d}{dt}\sqrt{1+t^2} = \frac{t}{\sqrt{1+t^2}}$, we can integrate by parts to get $$\int \frac{t^2}{\sqrt{1+t^2}}\mathrm dt = \int t\cdot \frac{t}{\sqrt{1+t^2}}\mathrm dt = t\sqrt{1+t^2} - \int \sqrt{1+t^2}\mathrm dt.$$ Cheating a little bit by looking at a table of integrals, we get that since $$\frac{d}{dt} \left [ t\sqrt{1+t^2} + \ln(t + \sqrt{1+t^2}) \right ] = t\frac{t}{\sqrt{1+t^2}} + \sqrt{1+t^2} + \frac{1}{t + \sqrt{1+t^2}} \left [ 1 + \frac{t}{\sqrt{1+t^2}} \right ]$$ which simplifies to $2\sqrt{1+t^2}$, the integral on the right above is $\frac{1}{2}[t\sqrt{1+t^2} + \ln(t + \sqrt{1+t^2})]$ and thus we have $$\int \frac{t^2}{\sqrt{1+t^2}}\mathrm dt = \frac{1}{2}\left [t\sqrt{1+t^2} - \ln(t + \sqrt{1+t^2})\right ]$$ which matches the answer given by Charles Bao if we set $X=x$ and $a=1$ in his original post.