Evaluate $\int_{-1}^1 \frac{x^2e^{\arctan x}}{\sqrt{{1+x^2}}}\ \mathrm{d}x$

$$\int_{-1}^1 \frac{x^2e^{\arctan x}}{\sqrt{{1+x^2}}}\ \mathrm{d}x$$

My try:

I tried substituting $x= \tan\theta$ and got,

$\displaystyle\int e^\theta \tan^2\theta \sec\theta\ \mathrm{d}\theta$ and cannot move forward. so I thought of finding two integrals($I$ and $J$)one of which is required and the other is taken such that $I+J, I-J$ are easy to find.but couldn't find such $J$ $\left(I=\displaystyle\int\frac{x^2e^{\arctan x}}{1+x^2}\ \mathrm{d}x\right)$

Also, I don't think I could make use of definite integral properties.

WolframAlpha result for the integral is

$\frac{(x-1)\sqrt{1+x^2}e^{arctanx}}{2}+C$

I also want to know how you got the idea for the solution.


As the integrand contains a factor of $e^{\arctan x}$ we expect the result to contain the same. Writing $$\frac{x^2e^{\arctan x}}{\sqrt{1+x^2}}=(e^{\arctan x}f(x))’$$ we obtain $(1+x^2)f’(x)+f(x)=x^2\sqrt{1+x^2}$. It is convenient to make the substitution $f(x)=g(x)\sqrt{1+x^2}$ as this will make the RHS a polynomial. This gives $$(1+x^2)g’(x)+(1+x)g(x)=x^2.$$ Consider the power series $g(x)=a_0+a_1x+a_2x^2+\cdots$ so that $$x^2=(1+x^2)(a_1+2a_2x+3a_3x^2+\cdots)+(1+x)(a_0+a_1+a_2x^2+\cdots).$$ Equating constant and linear terms gives $a_1=-a_0$ and $a_2=0$. Equating quadratic terms gives $a_3=(1+2a_0)/3$ with all higher-order coefficients being a constant multiple of $a_3$. Therefore, we have the general solution $$\int\frac{x^2e^{\arctan x}}{\sqrt{1+x^2}}\,dx=e^{\arctan x}\sqrt{1+x^2}\left(a_0(1-x)+\frac{1+2a_0}3x^3h(x)\right)$$ where $h(x)$ is a power series. Taking $a_0=-1/2$ conveniently eliminates $h(x)$ and the result follows.


Substitute $x=\tan t$ \begin{align} I= \int_{-1}^1 \frac{x^2e^{\arctan x}}{\sqrt{{1+x^2}}}\ {d}x &= \int_{-\pi/4}^{\pi/4} e^{t}\tan^2 t\sec t\>dt\\ &=\int_{-\pi/4}^{\pi/4} e^{t}\sec t \> d(\tan t-1) - \int_{-\pi/4}^{\pi/4} e^{t}\sec t \> dt\\ &= e^{t}\sec t (\tan t - 1) \bigg|_{-\pi/4}^{\pi/4}- I=\sqrt2e^{-\frac\pi4} \end{align}