Finding $\int_{-\infty}^\infty \frac{x^2}{x^4+1}\;dx$

$$\int_{-\infty}^\infty \frac{x^2}{x^4+1}\;dx$$

I'm trying to understand trigonometric substitution better, because I never could get a good handle on it. All I know is that this integral is supposed to reduce to the integral of some power of cosine. I tried $x^2=\tan\theta$, but I ended up with $\sin\theta\cos^3\theta$ as my integrand. Can someone explain how to compute this?

• If you have $\sin\theta\cos^3\theta$ as your integrand, isn't it straightforward to substitute $u = \cos\theta$, and then $du = -\sin\theta d\theta$? – Brian Tung Dec 8 '15 at 2:49
• Maybe, but I'm not sure that I substituted correctly. If $x^2 = \tan\theta$ I don't think I can day $dx = \sec^2\theta$. It would me $2xdx = \sec^2\theta$, which makes everything messy. – Pareod Dec 8 '15 at 2:52
• Then try multiple subs. Allow that $y = x^2$, $dy = 2xdx$, then let $y=\tan(\phi)$, and then finally let $u = cos(\phi)$. – Rellek Dec 8 '15 at 2:54
• Factor $x^4+1.$ – Lucian Dec 8 '15 at 2:55
• My guess is that if the person asking wouldn't be attempting trig subs if they knew contour integration. – Rellek Dec 8 '15 at 2:58

You have $x^4+1=(x^2+x\sqrt 2+1)(x^2-x\sqrt 2+1)$ Now you can do partial fractions. After that, a trig substitution will be your friend. Trig substitutions work well with quadratics, not so well with higher powers.

• Would the numerators be of the form $Ax^2 + Bx +C$? – Pareod Dec 8 '15 at 3:09
• Each numerator would be of the form Ax + B – Kaynex Dec 8 '15 at 3:18

$$\dfrac{2x^2}{x^4+1}=\dfrac{x^2+1}{x^4+1}+\dfrac{x^2-1}{x^4+1}$$

$$=\dfrac{1+1/x^2}{(x-1/x)^2+2}+\dfrac{1-1/x^2}{(x+1/x)^2-2}$$

For the first integral, set $x-1/x=u$ and can you guess the substitution for the second?

Notice that: $$\begin{eqnarray*} \int_{-\infty}^{+\infty}\frac{x^2}{x^4+1}\,dx &=& 2\int_{0}^{+\infty}\frac{x^2}{x^4+1}\,dx\\ &=& 2\int_{0}^{1}\frac{x^2}{1+x^4}\,dx+2\int_{1}^{+\infty}\frac{x^2}{1+x^4}\,dx\\&=&2\int_{0}^{1}\frac{1+x^2}{1+x^4}\,dx\\&=&2\left(1+\frac{1}{3}-\frac{1}{5}-\frac{1}{7}+\frac{1}{9}-\frac{1}{11}+\ldots\right)\\&=&2\left(1+\frac{2}{4^2-1}-\frac{2}{8^2-1}+\frac{2}{12^2-1}-\ldots\right)\end{eqnarray*}$$ and, from the logarithmic derivative of the Weierstrass product for the sine and cosine function: $$\sum_{k\geq 0}\frac{1}{(2k+1)^2-x^2}=\frac{\pi}{4x}\,\tan\left(\frac{\pi x}{2}\right),$$ $$\sum_{k\geq 1}\frac{1}{k^2-x^2}=\frac{1-\pi x\cot(\pi x)}{2x^2},$$ so by taking limits as $x\to\frac{1}{2}$ we get: $$\int_{-\infty}^{+\infty}\frac{x^2}{x^4+1}\,dx = \color{red}{\frac{\pi}{\sqrt{2}}}.$$

Notice $$\int_{-\infty}^\infty \frac{x^2}{x^4+1} dx = 2 \int_0^\infty \frac{x^2}{x^4+1} dx = 2 \int_0^\infty \frac{dx}{x^2+x^{-2}} = 2 \int_0^\infty \frac{dx}{(x-x^{-1})^2+2}\\ = 2 \left(\color{red}{\int_0^1} + \color{blue}{\int_1^\infty}\right) \frac{dx}{(x-x^{-1})^2+2}$$ Change variable from $x$ to $\frac1x$ for that part of integral on $(0,1)$, this becomes $$2\int_1^\infty \frac{1}{(x-x^{-1})^2+2}(\color{blue}{1}+\color{red}{x^{-2}})dx = 2\int_1^\infty \frac{d(x-x^{-1})}{(x-x^{-1})^2+2}$$ Change variable once more to $y = x-x^{-1}$ and then to $y = \sqrt{2}z$, we get $$\int_{-\infty}^\infty \frac{x^2}{x^4+1} dx = 2 \int_0^\infty \frac{dy}{y^2+2} = \int_{-\infty}^\infty \frac{dy}{y^2+2} = \frac{1}{\sqrt{2}}\int_{-\infty}^{\infty} \frac{dz}{1+z^2} = \frac{\pi}{\sqrt{2}}$$

The most straightforward method is to use the residue theorem.

Let $f(z)=\frac{z^2}{z^4+1}$. This function has exactly two poles in the upper half plane of $\mathbb{C}$: $$z_1=e^{i\frac{\pi}{4}}$$ $$z_2=e^{i\frac{3\pi}{4}}$$

Calculate residues at that points:

$$\operatorname{res}_f(z_1)=\lim_{z\rightarrow z_1} \frac{z^2}{(z-e^{-i\frac{\pi}{4}})(z-e^{-i\frac{3\pi}{4}})(z-e^{i\frac{3\pi}{4}})}=\frac{1}{4}e^{-i \frac{\pi}{4}}$$

$$\operatorname{res}_f(z_2)=\lim_{z\rightarrow z_2} \frac{z^2}{(z-e^{-i\frac{\pi}{4}})(z-e^{-i\frac{3\pi}{4}})(z-e^{i\frac{\pi}{4}})}=\frac{1}{4}e^{-i \frac{3\pi}{4}}$$

Now we will use the residue theorem. Let $R>0$ be big enough so the upper semicircle contains $z_1$ and $z_2$. From the residue theorem the integral of $f$ over the above contour of integration is equal to $$2\pi i (\operatorname{res}_f(z_1)+\operatorname{res}_f(z_2))$$ It is easy to verify that when $R\rightarrow \infty$, then the integral over the semicircle part of that contour vanishes, so the contour integral converges to our initial integral $\int_{-\infty}^\infty \frac{x^2}{x^4+1} dx$. Thus

$$\int_{-\infty}^\infty \frac{x^2}{x^4+1} dx=2\pi i (\operatorname{res}_f(z_1)+\operatorname{res}_f(z_2))=\frac{\pi}{\sqrt{2}}$$

your substitution is perfectly ok, if you convert your integral to :$$I=2\int_{0}^{\infty}\frac{x^2 \mathrm{d}x}{x^4+1}$$ now by $x^2=\tan\theta$ we get

$$I=\int_{0}^{\frac{\pi}{2}}\sqrt{\tan\theta}\mathrm{d}\theta \tag{1}$$

now to evaluate $I$ consider its complement $$I=\int_{0}^{\frac{\pi}{2}}\sqrt{\cot\theta}\mathrm{d}\theta \tag{2}$$ adding both

$$2I=\int_{0}^{\frac{\pi}{2}}\left(\sqrt{\tan\theta}+\sqrt{\cot\theta}\right)\mathrm{d}\theta=2\int_{0}^{\frac{\pi}{4}}\left(\sqrt{\tan\theta}+\sqrt{\cot\theta}\right)\mathrm{d}\theta=2\int_{0}^{\frac{\pi}{4}}\left(\frac{\sin\theta+\cos\theta}{\sqrt{\sin\theta \cos\theta}}\right)$$ and use $\sin\theta \cos\theta=\frac{1}{\sqrt{2}}\sqrt{1-(\sin\theta-\cos\theta)^2}$ and use again the substitution $\sin\theta-\cos\theta=t$.

Hope you can take it from here

• I'm having trouble understanding how you got $(1)$. Wouldn't the sub cause $2\int_{-\infty}^\infty \frac {\tan\theta} {\tan^2\theta + 1} d\theta$? – Pareod Dec 8 '15 at 3:24
• yes but what is $dx$, it is $\frac{sec^2\theta d\theta}{2x}=\frac{ sec^2\theta d\theta}{2\sqrt{tan\theta}}$. so you missed there.. – Ekaveera Kumar Sharma Dec 8 '15 at 3:28
• So would I also have to find $\int_0^{\pi/2} (\sqrt{\tan\theta}-\sqrt{\cot\theta})d\theta$ and then add both results together? – Pareod Dec 8 '15 at 4:03
• for definite integral with the above limits its not required. if you keenly observe the integral you commented above is zero, isn't it? – Ekaveera Kumar Sharma Dec 8 '15 at 4:05
• Okay, so $\int_0^{\pi/2} \sqrt{\tan\theta} d\theta = \int_0^{\pi/2} \sqrt{\tan\theta} + \sqrt{cot\theta} d\theta$? All I need to do is get rid of my subs and take the limit at my bound approaches infinity? – Pareod Dec 8 '15 at 4:14

In fact, using the transform $t=x^4$ and $t+1=\frac1{1-u}$ \begin{eqnarray} \int_{-\infty}^\infty\frac{x^2}{x^4+1}dx&=& 2\int_0^\infty\frac{x^2}{x^4+1}dx\\ &=&\frac12\int_0^\infty\frac{1}{\sqrt{t^3}(t+1)}dt\\ &=&\frac12\int_0^1(1-u)^{-\frac14}u^{-\frac34}du\\ &=&\frac12B(\frac14,\frac34)\\ &=&\frac12\frac{\pi}{\sin\frac{3}{4}\pi} \end{eqnarray}

Use the results from Jack's to establish the first inequality below, and for the third use $x \to \tan x$. The rest is standard stuff. \begin{align} I&=2\int_{0}^{\infty}\frac{x^2}{x^4+1}dx\\ &=2\int_{0}^{1}\frac{1+x^2 }{x^4+1}dx\\ &=2\int_0^{\pi/4}\frac{\left(\tan ^2x+1\right) \sec ^2x}{\tan ^4x+1}dx\\ &=2\int_0^{\pi/4}\frac{1}{\cos ^4x+\sin^4x}dx\\ &=2\int_0^{\pi/4}\frac{1}{(\cos ^2x-\sin^2x)^2+2\sin^2x\cos^2x}dx\\ &=2\int_0^{\pi/4}\frac{1}{\cos^2 2x+\frac12\sin^2 2x}dx\\ &=2\int_0^{\pi/4}\frac{\sec^2 2x}{1+\frac12\tan^2 2x}dx\\ &=2\int_0^{\pi/4}\frac{\sec^2 2x}{1+\frac12\tan^2 2x}dx\\ &=2 \times \frac{1}{\sqrt 2}\arctan\Big(\frac{1}{\sqrt2} \tan 2x\Big) \Big|_0^{\pi/4}\\ &=\frac{\pi}{\sqrt 2} \end{align}

Notice that: $$x^4 + 1 = x^4 + 2x^2 + 1 - 2x^2 = (x^2 + 1)^2 - 2x^2$$

• So this would be of the form $\sqrt {y^2 + a^2}$ where $y = (x^2 + 1)^2$ and $a = \sqrt 2x$? – Pareod Dec 8 '15 at 3:07
• So what would follow up. – Archis Welankar Dec 8 '15 at 3:07
• Did you try for $\frac{1}{a}tan^{-1}\frac{x}{a}$ – Archis Welankar Dec 8 '15 at 3:09
• Realized now I made a mistake in my work. So, I'm not sure where to go from here. You can treat it as a difference of squares like Ross Millikan did above, and that seems to be a good solution. – Kaynex Dec 8 '15 at 3:17