# evaluate $\displaystyle \int_0^{ \infty } \frac{\log(x^{2}+1)}{x^{4}+1}dx$ using contour integration

I started off with this contour(I apologize for the software i used but I am new to this all).

there is a branch cut from $$i \to i{\infty}$$, and another one from $$-i \to -i{\infty}$$.

the contour encloses only two poles, namely $$z=e^{\pi i/4}$$ and $$z=e^{3\pi i/4}$$.

by residue theorem, $$\oint_C \frac{\log(z^{2}+1)}{z^{4}+1}dz = 2 \pi i\sum_{z_i=e^{i\pi/4},e^{3i\pi/4}}\operatorname{Res}\left[\frac{\log(z^{2}+1)}{z^{4}+1},z_i\right]$$

upon applying L'Hospital rule to evaluate the residues,

$$\oint_C = 2\pi i(\lim_{z \to e^\frac{i\pi}{4}}(z-e^\frac {i\pi}{4})\frac{\log(z^{2}+1)}{z^{4}+1}+\lim_{z \to e^\frac{3\pi i}{4}}(z-e^\frac {3\pi i}{4})\frac{\log(z^{2}+1)}{z^{4}+1})=2\pi i\left(\frac{\log(1+i)}{4e^{\frac{3i\pi}{4}}} + \frac{\log(1-i)}{4e^{\frac{i\pi}{4}}}\right)=\frac{\pi}{2}[e^\frac{-i\pi}{4}(\frac{ln2}{2}+ i\frac{\pi}{4})+e^\frac{i\pi}{4}(\frac{ln2}{2}-i\frac{\pi}{4})]=\frac{\pi}{2}[\frac{{e^\frac{i\pi}{4}}+e^\frac{-i\pi}{4}}{2}ln2+(\frac{1}{\sqrt2}+\frac{i}{\sqrt2})(\frac{\pi}{4}-\frac{i\pi}{4})]=\frac{\pi}{2}[\frac{1}{\sqrt2}ln2+\frac{\pi}{4\sqrt2}(1+i)(1-i)]=\frac{\pi}{2\sqrt2}[ln2+\frac{\pi}{2}]$$

I am guessing I made a mistake in the arguments when opened them using $$\log(z)=\log|z|+ i\arg z$$, taking the arguments as $$\frac{\pi}{4}$$ for $$z=1+i$$ and $$\frac{-\pi}{4}$$ for $$z=1-i$$, but that yielded the wrong answer. apart from the LHS having the residues, everything in the RHS with the twice the desired integral and line integrals along the imaginary axis and around $$z=i$$ were right as follows

If $$\displaystyle \int_0^{ \infty } \frac{\log(x^{2}+1)}{x^{4}+1}dx=I$$

then in the limit as $$\lim_{a \to \infty}$$ and $$\lim_{b \to 0}$$

$$\frac{\pi}{2\sqrt2}[ln2+\frac{\pi}{2}]= 2I - 2\pi i \int_i^{i\infty}\frac{1}{z^{4}+1} dz$$ (the round trip around $$z=i$$, cancels out the $$\log$$ terms and leaves a difference of $$2\pi i$$).

I would appreciate some help on how to evaluate the desired integral with this contour.

• Hi, welcome to Math SE. Hint: if you replace $\ln(x^2+1)$ with $2\Re\ln(x+i)$ before making the integration variable complex, you won't need a keyhole.
– J.G.
Commented Feb 14 at 8:31
• I didn't think of that. This is my first time evaluating an integral with two branch cuts, so I didn't think of that, I will try it. But How do I evaluate the residue with the logarithms containing log(1+i) and log(1-i)? Commented Feb 14 at 8:54
• I'm not sure what you mean. If you make the integration range $\Bbb R$ using the fact the original integrand is even, then use my suggestion, the enclosed poles are at $e^{i\pi/4},\,e^{3i\pi/4}$. Then, for example, the residue at the first is$$\lim_{z\to e^{i\pi/4}}\frac{z-e^{i\pi/4}}{z^4+1}\ln(z+i).$$The log factor comes outside, then you can use L'Hôpital's rule.
– J.G.
Commented Feb 14 at 9:02
• your suggestion is better. I agree. Writing ln(x^2+1) and $\Re$ln(x+i) does indeed short the branch cut at i and removes the keyhole. But I am curious so as to how to simplify the residues obtained when you use a keyhole and open the log terms using log(z)=log|z|+i(argz), I know that |1$\pm$i|=2, but upon setting the arguments as $\pm \frac {\pi}{4}$, the answer obtained was wrong Commented Feb 14 at 9:07
• @Accelerator I did take J.G.'s approach and you are right. I resolved the problem quickly. but i was still curious as to how to evaluate the residues within my original contour. I would really appreciate it if you could take the time to write an answer using this contour desmos.com/calculator/tk3bcapobo Commented Feb 15 at 6:49

There are several ways to proceed. Here, we will evaluate the integral of interest $$I$$, as given by

$$I=\int_0^\infty \frac{\log(x^2+1)}{x^4+1}\,dx$$

using contour integration. Hence, we will evaluate the conotu integral $$J$$ as given by

$$J=\oint_C \frac{\log(z^2+1)}{z^4+1}\,dz$$

where $$C$$ is the keyhole contour as defined by the OP. Using the residue theorem, we find that

\begin{align} \int_{-\infty}^\infty \frac{\log(x^2+1)}{x^4+1}\,dx&=\int_1^\infty \frac{[\log(x^2-1)+i\pi]-[\log(x^2-1)-i\pi]}{1+x^4}\,i\,dx\\\\ &+2\pi i \text{Res}\left(\frac{\log(z^2+1)}{z^4+1}, z=e^{i\pi/4}\right)\\\\ 2\int_0^\infty \frac{\log(x^2+1)}{x^4+1}\,dx&=-2\pi \int_1^\infty \frac1{x^4+1}\,dx+2\pi i \left(\frac{\log(\sqrt{2})+i\pi/4}{4e^{i3\pi/4}}+\frac{\log(\sqrt2)-i\pi/4}{4e^{i9\pi/4}}\right)\\\\ \int_0^\infty \frac{\log(x^2+1)}{x^4+1}\,dx&=- \underbrace{\int_1^\infty \frac{\pi}{x^4+1}\,dx}_{=\pi^2\sqrt{2}/8 -\pi\sqrt{2}\text{coth}^{-1}(\sqrt{2})/4}+\frac\pi 4\left(\sqrt2 \log(\sqrt2)+\pi \sqrt 2/4\right)\\\\ &=\frac{\pi \sqrt 2}{4}\left(\log(2+\sqrt2)-\pi/4\right) \end{align}

And we are done!

• Thank you, good sir. I saw my mistake was not in the residues but rather the integral around the keyhole that leaves $$\int_{i}^{i\infty} \frac {-2\pi idz}{z^{4}+1}$$I made a fault in the substitution z=ix and missed an additional i, not accounting for the +ve sign that gets carried on to the LHS where the residues are Commented Feb 20 at 16:07
• You're welcome. My pleasure. Commented Feb 20 at 16:36