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?
 A: 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}}}.$$
A: $$\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?
A: 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}}$$
A: 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.
A: 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
A: 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}}$$
A: 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}
A: 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[4]{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}
A: Notice that: $$x^4 + 1 = x^4 + 2x^2 + 1 - 2x^2 = (x^2 + 1)^2 - 2x^2$$
A: Note\begin{align*}
\int_{-\infty}^{\infty} \frac{x^2}{x^4+1} dx 
&\overset{x\to \frac1x}=\int_{-\infty}^{\infty} \frac{1}{x^4+1}dx
=\int_{0}^{\infty} \frac{x^2+1}{x^4+1}dx
=\int_{0}^{\infty} \frac{1+\frac1{x^2}}{x^2+\frac1{x^2}}dx
\\
&= \int_{0}^{\infty} \frac{d(x-\frac{1}{x} )}{\left(x-\frac{1}{x}\right)^2+2} =\frac{1}{\sqrt{2}} \tan^{-1}{\frac{x-\frac{1}{x}}{\sqrt{2}}} \bigg \rvert_{0}^{\infty} 
= {\frac{\pi}{\sqrt{2}}}
\end{align*}
A: \begin{align*}
I=\int_{-\infty}^{\infty} \frac{x^2}{x^4+1} \; \mathrm{d}x &= \int_{-\infty}^{\infty} \frac{1}{\left(x-\frac{1}{x}\right)^2+2} \; \mathrm{d}x\\
&=\int_{-\infty}^{\infty} \frac{1}{x^2+2} \; \mathrm{d}x \tag{1}\\
&=\frac{1}{\sqrt{2}} \arctan{\left(\frac{x}{\sqrt{2}}\right)} \bigg \rvert_{-\infty}^{\infty} \\
&= \boxed{\frac{\pi}{\sqrt{2}}}
\end{align*}
Where Glasser's master theorem was used to arrive to (1).
A: $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
\begin{align}
&\bbox[5px,#ffd]{\int_{-\infty}^{\infty}{x^{2} \over
x^{4} + 1}\,\dd x} =
2\int_{0}^{\infty}{x^{2} \over x^{4} + 1}\,\dd x
\,\,\,\stackrel{x^{\large 4}\ \mapsto\ x}{=}\,\,\,
{1 \over 2}\int_{0}^{\infty}{x^{-1/4} \over 1 + x}\,\dd x
\label{1}\tag{1}
\end{align}
However, $\ds{{1 \over 1 + x} = 
\sum_{k = 0}^{\infty}\pars{-x}^{k} =
\sum_{k = 0}^{\infty}\color{blue}{\Gamma\pars{k + 1}}{\pars{-x}^{k} \over k!}}$.
With Ramanujan's Master Theorem, (\ref{1}) becomes
\begin{align}
&\bbox[5px,#ffd]{\int_{-\infty}^{\infty}{x^{2} \over
x^{4} + 1}\,\dd x} =
{1 \over 2}\int_{0}^{\infty}{x^{\color{red}{3/4} - 1} \over
x^{4} + 1}\,\dd x =
{1 \over 2}\,\Gamma\pars{\color{red}{3 \over 4}}
\color{blue}{\Gamma\pars{-\,\color{red}{3 \over 4} + 1}}
\\[5mm] = &\
{1 \over 2}\,{\pi \over \sin\pars{\pi/4}} =
\bbx{{\root{2} \over 2}\,\pi} \\ &
\end{align}
A: Via contour integration $\oint_C \frac{z^{\alpha-1}}{{1+z}} dz$ it was shown that
$$\int_0^\infty \frac{y^{\alpha-1}}{1+y} dy = \frac{\pi}{\sin \pi \alpha}.$$
Let $y=x^4$ so that $dy = 4x^3 dx.$
$$\int_{-\infty}^\infty \frac{x^2}{1+x^4} dx =\frac{1}{4} \int_{-\infty}^\infty \frac{y^{-1/4}}{1+y} dy  = \frac{1}{2} \int_0^\infty \frac{y^{-1/4}}{1+y}dy=\frac{1}{2} \frac{\pi}{\sin \frac{3\pi}{4}}=\frac{\pi}{\sqrt{2}}.$$
