# How to take $\int_0^{+\infty} \frac{x^2+1}{x^4+1}dx$?

The integral:

$$\int_0^{+\infty} \frac{x^2+1}{x^4+1}dx$$

If num were greater than denum I would just devide it normally with long division, but it is not, how should I handle it then?

• Hint: $x^4 + 1 = (x^4 + 2x^2 + 1) - 2x^2 = (x^2+1)^2 - (x\sqrt{2})^2 = (x^2 + x\sqrt{2} + 1) (x^2 - x\sqrt{2} + 1)$. – Daniel Schepler May 22 '17 at 21:17
• "How to take"? What does that mean? To decide whether it converges or not, or to evaluate it? – DonAntonio May 22 '17 at 21:20
• Here is your answer: wolframalpha.com/input/… – Crostul May 22 '17 at 21:22
• @DonAntonio i think the OP wants to compute the result exactly... – gt6989b May 22 '17 at 21:24
• @gt6989b I'd rather have the OP to have the good manners to address doubts about his ill-posed question . I don't usually like guessing. – DonAntonio May 22 '17 at 21:25

Whenever I see an integrand that is sort of symmetric under $x \to x^{-1}$, I will try to see whether I can express the intergrand in terms of $x \pm x^{-1}$. Using following identities, $$\frac{dx}{x} = \frac{d(x-x^{-1})}{x+x^{-1}} = \frac{d(x+x^{-1})}{x-x^{-1}}$$ we find \begin{align} \int_0^\infty \frac{x^2+1}{x^4+1}dx &= \int_0^\infty \frac{x+x^{-1}}{x^2+x^{-2}} \frac{dx}{x} = \int_0^\infty \frac{x+x^{-1}}{x^2+x^{-2}} \frac{d(x-x^{-1})}{x+x^{-1}} = \int_0^\infty \frac{d(x-x^{-1})}{(x-x^{-1})^2+2}\\ &= \int_{-\infty}^\infty \frac{dy}{y^2+2} = \left[\frac{1}{\sqrt{2}}\tan^{-1}\frac{y}{\sqrt{2}}\right]_{-\infty}^\infty = \frac{\pi}{\sqrt{2}} \end{align}

• Now that's a sneaky, nice argument! +1 I'd rather do this by complex integration – DonAntonio May 22 '17 at 21:31
• @DonAntonio But its always quite fun to see these simple elementary solutions done beautifully. – Simply Beautiful Art May 22 '17 at 21:35
• @DonAntonio I think people are running out of idea to create hard looking but easy to compute integral. This is the third (or fourth?) time this week I answered question using this trick! It start to become automatic.... – achille hui May 22 '17 at 21:39

$$\int_{0}^{1}\frac{x^2+1}{x^4+1}\,dx + \int_{1}^{+\infty}\frac{x^2+1}{x^4+1}\,dx = 2\int_{0}^{1}\frac{1+x^2}{1+x^4}\,dx = 2\int_{0}^{1}\frac{1+x^2-x^4-x^6}{1-x^8}\,dx$$ hence the value of the integral is provided by the (Dirichlet) series $$2\sum_{k\geq 0}\left(\frac{1}{8k+1}+\frac{1}{8k+3}-\frac{1}{8k+5}-\frac{1}{8k+7}\right)$$ that can be computed through the digamma reflection formula. Its value is just $$\boxed{I = \color{red}{\frac{\pi}{\sqrt{2}}}} .$$ The given integral is straightforward to compute through the residue theorem, too.

By symmetry,

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

By taking a semi-circle contour in the upper half of the complex plane and applying Cauchy's residue formula, we find that

\begin{align}\int_{-\infty}^{+\infty}\frac{x^2+1}{x^4+1}\ dx&=2\pi i\left[\lim_{a\to e^{\pi i/4}}\frac{(a^2+1)(a-e^{\pi i/4})}{a^4+1}+\lim_{b\to e^{3\pi i/4}}\frac{(b^2+1)(b-e^{3\pi i/4})}{b^4+1}\right]\\&=2\pi i\left[\frac{1+i}{4e^{3\pi i/4}}+\frac{1-i}{4e^{9\pi i/4}}\right]\\&=\frac{\pi i}{2\sqrt2}\left[(1-i)^2-(1+i)^2\right]\\&=\sqrt2\pi\end{align}

Thus,

$$\int_0^{+\infty}\frac{x^2+1}{x^4+1}\ dx=\frac{\sqrt2\pi}2=\frac\pi{\sqrt2}$$


With $\ds{p \equiv \exp\pars{{\pi \over 4}\,\ic}}$ and integrating in a quarter circle in the first quadrant:

\begin{align} \int_{0}^{\infty}{x^{2} + 1 \over x^{4} + 1}\,\dd x & = \Re\pars{2\pi\ic\,\lim_{x \to p}{\bracks{x\vphantom{^{2}} - p}\bracks{x^{2} + 1} \over x^{4} + 1}} \label{1}\tag{1} \\[5mm] & = \Re\pars{2\pi\ic\,\lim_{x \to p}{x^{3} - px^{2} + x - p \over x^{4} + 1}} \\[5mm] & = -2\pi\,\Im\pars{\lim_{x \to p}{3x^{2} - 2px + 1 \over 4x^{3}}} = -\,{\pi \over 2}\,\Im\pars{\lim_{x \to p}{3x^{3} - 2px^{2} + x \over x^{4}}} \\[5mm] & = {\pi \over 2}\,\Im\pars{p^{3} + p} = {\pi \over 2}\,\Im\pars{p^{2}\bracks{p + {1 \over p}}} = {\pi \over 2}\,\Im\pars{\ic\bracks{2\cos\pars{\pi \over 4}}} \\[5mm] & = \bbx{{\root{2} \over 2}\,\pi} \end{align}

In \eqref{1},

• I omitted the integration along the imaginary axis because its real part vanishes out.

• The integral along the arc, of radius $\ds{R}$, is of $\ds{\,\mrm{O}\pars{1 \over R}}$ as $\ds{R \to \infty}$ such that it vanishes out in such a limit.

$\Huge\left.b\right)$

With $\ds{\Lambda > 0}$:

\begin{align} \int_{0}^{\infty}{x^{2} + 1 \over x^{4} + 1}\,\dd x & = \lim_{\Lambda \to \infty}\int_{0}^{\Lambda}{x^{2} + 1 \over x^{4} + 1}\,\dd x = \Im\lim_{\Lambda \to \infty}\int_{0}^{\Lambda}{x^{2} + 1 \over x^{2} - \ic} \,\dd x \\[5mm] & = \Im\pars{\bracks{1 + \ic}\lim_{\Lambda \to \infty} \int_{0}^{\Lambda}{\dd x \over x^{2} - \ic}} \\[5mm] & = \Im\pars{{1 + \ic \over 2\root{i}}\lim_{\Lambda \to \infty}\int_{0}^{\Lambda}\bracks{% {1 \over x - \root{\ic}} - {1 \over x + \root{\ic}}}\dd x} \\[5mm] & = {1 \over 2}\, \Im\pars{\bracks{\expo{-\ic\pi/4} + \expo{\ic\pi/4}}\bracks{\pi\ic}} = \bbx{{\root{2} \over 2}\,\pi} \end{align}

• @user1892304 Thanks. By the way, they are concise answers too !!!. – Felix Marin May 26 '17 at 17:20

Substituting $x = t^{\frac{1}{4}}$ yields the integral:

$$\frac{1}{4}\int_0^{\infty}\frac{x^{-\frac{1}{4}} + x^{-\frac{3}{4}}}{1+x}dx=\frac{\pi}{2\sin\left(\frac{\pi}{4}\right)}=\frac{\pi}{\sqrt{2}}$$

where we've used the result:

$$\int_0^{\infty}\frac{x^{-p}}{1+x}dx=\frac{\pi}{\sin(\pi p)}$$

This can be proven using contour integration, see page 12 of this document.

By substituting $x\mapsto\frac1x$, we get $$\int_0^1\frac{x^2+1}{x^4+1}\,\mathrm{d}x=\int_1^\infty\frac{x^2+1}{x^4+1}\,\mathrm{d}x$$ Therefore, using formula $(6)$ from this answer, we get \begin{align} \int_0^\infty\frac{x^2+1}{x^4+1}\,\mathrm{d}x &=2\int_0^1\frac{x^2+1}{x^4+1}\,\mathrm{d}x\\ &=2\int_0^1\left(1+x^2-x^4-x^6+x^8+x^{10}-x^{12}-x^{14}+\cdots\right)\,\mathrm{d}x\\ &=2\left(1+\frac13-\frac15-\frac17+\frac19+\frac1{11}-\frac1{13}-\frac1{15}+\cdots\right)\\ &=2\sum_{k=1}^\infty\left(\frac1{8k-7}+\frac1{8k-5}-\frac1{8k-3}-\frac1{8k-1}\right)\\ &=\frac14\sum_{k=1}^\infty\left[\left(\tfrac1k-\tfrac1{k-\frac18}\right)+\left(\tfrac1k-\tfrac1{k-\frac38}\right)-\left(\tfrac1k-\tfrac1{k-\frac58}\right)-\left(\tfrac1k-\tfrac1{k-\frac78}\right)\right]\\ &=\frac14\left(\color{#C00}{H_{-\frac18}}+\color{#090}{H_{-\frac38}-H_{-\frac58}}\color{#C00}{-H_{-\frac78}}\right)\\[4pt] &=\frac\pi4\left(\color{#C00}{\cot\left(\frac\pi8\right)}+\color{#090}{\cot\left(\frac{3\pi}8\right)}\right)\\[5pt] &=\frac\pi{\sqrt2} \end{align} Since $\cot\left(\frac\pi8\right)=\sqrt2+1$ and $\cot\left(\frac{3\pi}8\right)=\sqrt2-1$.

The function integrand is positive.

By equivalence test

Near zero, no problem.

Near $+\infty,$ we have

$$\frac {x^2+1}{x^4+1}\sim \frac {x^2}{x^4}\sim \frac {1}{x^2} .$$

thus it Converges.

Or by comparison test

for great enough $x$

$$\frac {x^2+1}{x^4+1}\leq \frac {2x^2}{x^4} =\frac {2}{x^2}$$

• This assumes the questioner needs to decide convergence and nothing else. – Matthew Leingang May 22 '17 at 21:21