TITLE: Integrating $\int_{-\infty}^\infty \frac{1}{1 + x^4}dx$ with the residue theorem
QUESTION [11 upvotes]: Calculate integral
$$\int\limits_{-\infty}^{\infty}\frac{1}{x^4+1} dx$$
with residue theorem. 
Can I evaluate $\frac 12\int_C  \dfrac{1}{z^4+1} dz$ where $C$ is simple closed contour of the upper half of unit circle like this? 
And find the roots of polynomial $z^4 +1$ which are the fourth roots of $-1$. 
In $C$ there is $z_1 =e^{i\pi/4}=\frac{1}{\sqrt{2}}+\frac{i}{\sqrt{2}}$ and $z_2=e^{3\pi/4}=-\frac{1}{\sqrt{2}}+\frac{i}{\sqrt{2}}$.
So the residuals $B_1$ and $B_2$ for $z_1$ and $z_2$ are simple poles and that
\begin{align}
B_1&=\frac{1}{4 z_1^3}\frac{z_1}{z_1}=-\frac{z_1}{4} \\
B_2&=\frac{1}{4z_2^3}\frac{z_2}{z_2}=-\frac{z_2}{4}
\end{align}
And the sum of residuals is
$$B_1+B_2=-\frac{1}{4}(z_1 + z_2)=-\frac{1}{4}\left(\frac{1}{\sqrt{2}}+\frac{1}{\sqrt{2}} \right)=-\frac{i}{2 \sqrt{2}}$$
So my integral should be
$$\int\limits_{-\infty}^{\infty}\frac{1}{x^4+1} dx =\frac 12 \times 2\pi i (B_1+B_2)=\frac{\pi}{\sqrt{2}}$$
Is this valid?

REPLY [4 votes]: $\newcommand{\bbx}[1]{\,\bbox[8px,border:1px groove navy]{{#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}$
$$\bbox[15px,#ffe,border:2px dotted navy]{\ds{%
\mbox{There is an interesting 'real integration' which I want to recall here}}}
$$
\begin{align}
\mc{J} & \equiv \int_{-\infty}^{\infty}{\dd x \over 1 + x^{4}} =
2\int_{0}^{\infty}{1 \over 1/x^{2} + x^{2}}\,{1 \over x^{2}}\,\dd x
\\[5mm] & = 
\overbrace{2\int_{0}^{\infty}{1 \over \pars{x - 1/x}^{2} + 2}\,
{1 \over x^{2}}\,\dd x}^{\ds{\mc{J}}}\label{1}\tag{1}
\\[5mm] & \stackrel{x\ \mapsto\ 1/x}{=}\,\,\,
\underbrace{2\int_{0}^{\infty}{\dd x \over \pars{1/x - x}^{2} + 2}}
_{\ds{\mc{J}}}
\label{2}\tag{2}
\end{align}
With \eqref{1} and \eqref{2} RHS:
\begin{align}
\mc{J} & = {\mc{J} + \,\mc{J} \over 2} =
\int_{0}^{\infty}{1 \over \pars{x - 1/x}^{2} + 2}\,
\pars{1 + {1 \over x^{2}}}\,\dd x
\,\,\,\stackrel{\pars{x - 1/x}\ \mapsto\ x}{=}\,\,\,
\int_{-\infty}^{\infty}{\dd x \over x^{2} + 2}
\\[5mm] & \,\,\,\stackrel{x/\root{2}\ \mapsto\ x}{=}\,\,\,
\root{2}\int_{0}^{\infty}{\dd x \over x^{2} + 1} =\
\bbox[15px,#ffe,border:2px dotted navy]{\ds{{\root{2} \over 2}\,\pi}}
\end{align}