# Problem of Integration by Parts involving algebraic and exponential functions

Can anyone please help me in solving this integration problem $\int \frac{e^x}{1+ x^2}dx \,$?

Actually, I am getting stuck at one point while solving this problem via integration by parts.

• Is it now readable ?? Sorry, I could not edit the problem well here :( – Dwaipayan Gupta Sep 3 '15 at 9:31
• I edited your question, is it what you wanted to ask? Or should there be some bounds on the integral? – 5xum Sep 3 '15 at 9:34
• wolframalpha.com/input/?i=integral+e%5Ex%2F%281%2Bx%5E2%29 – Peđa Terzić Sep 3 '15 at 9:38
• Exactly !! .. thank you so much ! @5xum – Dwaipayan Gupta Sep 3 '15 at 9:39
• Sadly, as MathBot's comment shows, you can expect the integral to not be an elementary function. – 5xum Sep 3 '15 at 9:41

Since $x^2+1=(x+i)(x-i)$, partial fraction decomposition leads to $$\frac 1{x^2+1}=\frac 1{2i}\Big(\frac{1}{x-i}-\frac{1}{x+i}\Big)=-\frac i{2}\Big(\frac{1}{x-i}-\frac{1}{x+i}\Big)$$ So $$I=\int \frac{e^x}{1+ x^2}\,dx =-\frac i{2}\int\Big(\frac{e^x}{x-i}-\frac{e^x}{x+i}\Big)\,dx=-\frac i{2}\int\Big(\frac{e^i\,e^{x-i}}{x-i}-\frac{e^{-i}\,e^{x+i}}{x+i}\Big)\,dx$$ Now make change of variable $y=x-i$ for the first and $z=x+i$ for the second. So $$I=-\frac {i e^i}{2}\int \frac{e^y}y dy+\frac {i e^{-i}}{2}\int \frac{e^z}z dz$$ and remember that $$\int\frac {e^t} t dt=\text{Ei}(t)$$ which finally makes $$I=\frac{1}{2}\, i \,e^{-i}\, \text{Ei}(x+i)-\frac{1}{2}\, i\, e^i\, \text{Ei}(x-i)$$ with $i\,e{^i}=-\sin (1)+i \cos (1)$ and $i\,e^{-i}=\sin (1)+i \cos (1)$.

• wow !!!!!!! thank you so much, Mr. @Claude Leibovici !!!!! thank you for this detailed step-by-step solution of the problem ! – Dwaipayan Gupta Sep 3 '15 at 9:57
• You are very welcome ! My goal was just to show how to arrive to the end result you already received. – Claude Leibovici Sep 3 '15 at 10:00
• thank you, thank you ! (^_^) and yes, I needed this detailed solution, Sir !! – Dwaipayan Gupta Sep 3 '15 at 10:02

According to Wolfram|Alpha, no closed form exists. However, that doesn't mean we can't make any progress at all.

We can use the substitution $x=\tan{u}$, expand the resulting integrand as a power series in $\tan{u}$ and then each term can be expressed by way of a reduction formula.

Let $x=\tan{u}$. Then, ${\mathrm{d}x \over \mathrm{d}u} = \sec^{2}{u}$. Hence, we have \begin{eqnarray*} \int\frac{e^{x}}{1+x^{2}}\,\mathrm{d}x & = & \int\frac{e^{\tan{u}}}{1+\tan^{2}{u}}\sec^{2}{u}\,\mathrm{d}u\\ & = & \int e^{\tan{u}}\,\mathrm{d}u\\ & = & \int \left( 1+ \tan{u} + \frac{1}{2!}\tan^{2}{u}+ \ldots + \frac{1}{k!}\tan^{k}{u} + \ldots \right)\,\mathrm{d}u\\ & = & \int \left( \sum_{k=0}^{\infty}\frac{1}{k!}\tan^{k}{u} \right)\,\mathrm{d}u\\ & = & \sum_{k=0}^{\infty}\frac{1}{k!}I_{k}, \end{eqnarray*} where, for each $k=0,1,2,\ldots$, we have $I_{k} = \int \tan^{k}{u}\,\mathrm{d}u$.

Now we consider the reduction formula as follows: for $k\geq2$, we have \begin{eqnarray*} I_{k} & = & \int\tan^{k}{u}\,\mathrm{d}u\\ & = & \int (\sec^{2}{u}-1)\tan^{k-2}{u}\,\mathrm{d}u\\ & = & \int \sec^{2}{u}\tan^{k-2}{u}\,\mathrm{d}u - I_{k-2} & = & \frac{1}{k-1}\tan^{k-1}{u} -I_{k-2}. \end{eqnarray*} Additionally, note that $I_{0} = u\,(+\text{constant})$ and $I_{1} = \log{\sec{u}}\,( + \text{constant} )$. Using the formula derived above and these two initial values, we can calculate $I_{k}$ for any value of $k$ (there may well be a general formula; I haven't checked).

Hence, we have a series representation of the integral to as many terms as we please; note also that each term in the series is basically a polynomial in $x=\tan{u}$ with an extra $\tan^{-1}{x}$ or $\log{\sec{\tan^{-1}{x}}}$ tacked on at the end.

• Thank you, Mr. @Will R ! (^_^) – Dwaipayan Gupta Sep 3 '15 at 10:09
• No problem; I'll continue to look into simplifying the series later on, if I find anything of interest I'll edit the post and notify you. – Will R Sep 3 '15 at 11:19
• It is an interesting solution, for sure. The problem would be the convergence. For example, integrating from $x=0$ to $x=10$ requires to go up to $k=26$ for six correct significant figures. – Claude Leibovici Sep 3 '15 at 11:27
• @ClaudeLeibovici Yes, I was wondering about issues of rapidity of convergence (I don't know much about those kinds of details, yet); but, as far as I can see, the infinite series should converge, which, lacking further context, I took to be all that was necessary. – Will R Sep 3 '15 at 11:29
• I totally agree with you. And programming it is so simple with your solution ! – Claude Leibovici Sep 3 '15 at 11:31

This is an alternative to the other answer I have provided. I have decided to add it as another answer because I think it uses a sufficiently different approach, and nobody else seems to have hinted at it. We begin just as we begun in my other answer to this same question, and continue until we reach $$\int e^{\tan{u}}\,\mathrm{d}u.$$ From here, the two answers diverge radically, and the content of this post will be entirely concerned with evaluating this integral, which in turn answers the question.
In the other answer, we expanded $e^{\tan{u}}$ as a power series in $\tan{u}$. Now, instead, we shall first expand $\tan{u}$ as a power series in terms of $u$. Then $e^{\tan{u}}$ is an infinite product of exponentials, each of which can be expanded as a power series. From this sequence of expansions, we produce a power series for $e^{\tan{u}}$ which can be integrated term-by-term.
The power series for $\tan{u}$, valid for $|u|<\pi/2$, is $$\tan{u} = \sum_{n=1}^{\infty} {B_{2n}(-4)^{n}(1-4^{n}) \over (2n)!}u^{2n-1} = u+\frac{u^{3}}{3}+\frac{2u^{5}}{15}+\ldots.$$
Hence, for $|u|<\pi/2$, we have \begin{eqnarray*} \exp{\tan{u}} & = & \exp{\left(\sum_{n=1}^{\infty} {B_{2n}(-4)^{n}(1-4^{n}) \over (2n)!}u^{2n-1}\right)}\\ & = & \prod_{n=1}^{\infty}\exp{\left( {B_{2n}(-4)^{n}(1-4^{n}) \over (2n)!}u^{2n-1}\right)}\\ & = & \exp{u}\cdot\exp{\frac{u^{3}}{3}}\cdot\exp{\frac{2u^{5}}{15}}\cdot\ldots\\ & = & \sum_{k=1}^{\infty} \left({B_{2}^{k}(-4)^{k}(1-4)^{k} \over k!2!^{k}}u^{k}\right) \cdot \sum_{k=1}^{\infty} \left({B_{4}^{k}(-4)^{2k}(1-4^{2})^{k} \over k!4!^{k}}u^{3k}\right)\cdot\ldots\\ & = & \left( 1+\frac{u}{1!}+\frac{u^{2}}{2!}+\ldots \right)\left( 1+\frac{u^{3}}{3^{1}\cdot1!}+\frac{u^{6}}{3^{2}\cdot2!}+\ldots \right)\left( 1+\frac{2u^{5}}{15\cdot1!}+\frac{2^{2}u^{10}}{15^{2}\cdot2!}+\ldots \right)\\ & = & 1 + u + \frac{u^{2}}{2!} + \left(\frac{u^{3}}{3!}+\frac{u^{3}}{3\cdot1!}\right) + \left(\frac{u^{4}}{4!}+\frac{u}{1!}\cdot\frac{u^{3}}{3\cdot1!}\right)\\ && \;\; + \left(\frac{u^{5}}{5!} +\frac{u^{2}}{2!}\cdot\frac{u^{3}}{3\cdot1!}+ \frac{2u^{5}}{15}\right)+\ldots\\ & = & 1 + u + \frac{u^{2}}{2} + \frac{u^{3}}{2}+\frac{3u^{4}}{8}+\frac{37u^{5}}{120}+\ldots. \end{eqnarray*}
Therefore, assuming that our interval of integration is within $|\tan^{-1}{x}|<\pi/2$, we have \begin{eqnarray*} \int\frac{e^{x}}{1+x^{2}}\,\mathrm{d}x = \text{constant} + \tan^{-1}{x} + \frac{(\tan^{-1}{x})^{2}}{2}+ \frac{(\tan^{-1}{x})^{3}}{6}+\frac{(\tan^{-1}{x})^{4}}{8}+\frac{3(\tan^{-1}{x})^{5}}{40}+\frac{37(\tan^{-1}{x})^{6}}{720}+\ldots, \end{eqnarray*} and I'm pretty sure we can adjust this to other intervals of integration using the fact that $\tan{(u+\pi)}=\tan{u}$ for all $u\in\mathbb{R}$ for which $\tan{u}$ is defined.