# Evaluating real integral using residue calculus: why different results?

I have to evaluate the real integral $$I = \int_0^{\infty} \frac{\log^2 x}{x^2+1}.$$ using residue calculus. Its value is $\frac{\pi^3}{8}$, as you can verify (for example) introducing the function $$\frac{(\log z-i(\pi/2))^2}{z^2+1}.$$ and considering the branch cut for the logarithm function on the negative semiaxis of the immaginary numbers and an upper half-circle indented at 0 as integration contour. I tried a different method, but unfortunately I obtained a different result and I don't know why. I consider the branching axis of the logarithm function as the positive real semiaxis. I tried as integration contour this closed curve. I used the complex function $$f(z)=\frac{\log^3z}{z^2+1}$$ obtaining $$\int_r^{R} \frac{\log^3 x}{x^2+1}\;dx + \int_\Gamma \frac{\log^3 z}{z^2+1}\;dz - \int_r^{R} \frac{(\log x+2\pi i)^3}{x^2+1}\;dx - \int_\gamma \frac{\log^3 z}{z^2+1}\;dz.$$ It is easy to see that integrals over circular paths $\gamma$ and $\Gamma$ tend to zero when $R\to \infty,r\to 0$. So we have to evaluate $$\int_r^{R} \frac{\log^3 x}{x^2+1}\;dx - \int_r^{R} \frac{(\log x+2\pi i)^3}{x^2+1}\;dx,$$ which immaginary part is (EDIT: changed $8\pi i$ to $8\pi^3 i$ ) $$-6\pi i \int_r^{R} \frac{\log^2 x}{x^2+1}\;dx + 8\pi^3 i \int_r^{R} \frac{1}{x^2+1}\;dx,$$ that has to be equal to the immaginary part of $$2\pi i\;\left( \mathrm{Res} \left[f,i \right] + \mathrm{Res}\left[f,-i \right]\right) = -i \frac{\pi^4}{4}.$$ So, doing the rest of the work, finally I found that the result is $\frac{17\pi^3}{24}$, that is clearly different from $\frac{\pi^3}{8}$... but where is the flaw in my argument? Please help

• isn't the value of this integral 0 ? – Santosh Linkha Jan 19 '13 at 16:05
• @experimentX: of course, you are right. I changed the function to integrate at the top of the page, now logarithm is squared. Sorry for the enormous typo. – Flast9 Jan 19 '13 at 16:28
• still, i can't solve it, here is an example of it. I would like to see it's solution, and the reason why the multiple of $\log x$ is taken. – Santosh Linkha Jan 19 '13 at 16:29
• It should be $12\pi^2 i\int_r^R$, not $8\pi i\int_r^R$. – mrf Jan 19 '13 at 17:11
• @mrf: why? However, I turned the value $8\pi i$ into the correct $8\pi^3 i$ – Flast9 Jan 19 '13 at 17:34

The error is where you get $$2\pi i\;\left( \mathrm{Res} \left[f,i \right] + \mathrm{Res}\left[f,-i \right]\right) = -i \frac{\pi^4}{4}.$$ If you use $\arg{i}=\frac{\pi}{2}$ then you must have $\arg(-i)=\frac{3\pi}{2}$ instead of $\arg(-i)=-\frac{\pi}{2}$, since you must use the same branch of the logarithm all through.

Taking this into account, we instead get $$2\pi i\;\left( \mathrm{Res} \left[f,i \right] + \mathrm{Res}\left[f,-i \right]\right) = \frac{13i\pi^4}{4}.$$

$\newcommand{\+}{^{\dagger}} \newcommand{\angles}{\left\langle\, #1 \,\right\rangle} \newcommand{\braces}{\left\lbrace\, #1 \,\right\rbrace} \newcommand{\bracks}{\left\lbrack\, #1 \,\right\rbrack} \newcommand{\ceil}{\,\left\lceil\, #1 \,\right\rceil\,} \newcommand{\dd}{{\rm d}} \newcommand{\down}{\downarrow} \newcommand{\ds}{\displaystyle{#1}} \newcommand{\expo}{\,{\rm e}^{#1}\,} \newcommand{\fermi}{\,{\rm f}} \newcommand{\floor}{\,\left\lfloor #1 \right\rfloor\,} \newcommand{\half}{{1 \over 2}} \newcommand{\ic}{{\rm i}} \newcommand{\iff}{\Longleftrightarrow} \newcommand{\imp}{\Longrightarrow} \newcommand{\isdiv}{\,\left.\right\vert\,} \newcommand{\ket}{\left\vert #1\right\rangle} \newcommand{\ol}{\overline{#1}} \newcommand{\pars}{\left(\, #1 \,\right)} \newcommand{\partiald}[]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\pp}{{\cal P}} \newcommand{\root}[]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,} \newcommand{\sech}{\,{\rm sech}} \newcommand{\sgn}{\,{\rm sgn}} \newcommand{\totald}[]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}} \newcommand{\ul}{\underline{#1}} \newcommand{\verts}{\left\vert\, #1 \,\right\vert} \newcommand{\wt}{\widetilde{#1}}$ $\ds{I\equiv\int_{0}^{\infty}{\ln^{2}\pars{x} \over x^{2} + 1}\,\dd x:\ {\large ?}}$

Let $\quad\ds{\ln\pars{z} = \ln\pars{\verts{z}} + \ic{\rm Arg}\pars{z}.\quad 0 < {\rm Arg}\pars{z} < 2\pi.\quad}$

According to the $\ds{\large\ln}$-branch cut, the integrand has poles at $\quad\ds{\expo{\pi\ic/2}}\quad$ and $\quad\ds{\expo{3\pi\ic/2}}$:

\begin{align} &\int_{0}^{\infty}{\ln^{3}\pars{x} \over x^{2} + 1}\,\dd x =2\pi\ic\,{\pars{\pi\ic/2}^{3} \over \ic + \ic} +2\pi\ic\,{\pars{3\pi\ic/2}^{3} \over -\ic - \ic} -\int_{\infty}^{0}{\bracks{\ln\pars{x} + 2\pi\ic}^{3} \over x^{2} + 1}\,\dd x \\[3mm]&=-\,{\pi^{4} \over 8}\,\ic + {27\pi^{4} \over 8}\,\ic +\int_{0}^{\infty}{\ln^{3}\pars{x} \over x^{2} + 1}\,\dd x +6\pi\ic\int_{0}^{\infty}{\ln^{2}\pars{x} \over x^{2} + 1}\,\dd x -12\pi^{2}\ \underbrace{\int_{0}^{\infty}{\ln\pars{x} \over x^{2} + 1}\,\dd x}_{\ds{=\ 0}} \\[3mm]&\phantom{=\!}-8\pi^{3}\ic\ \underbrace{\int_{0}^{\infty}{\dd x \over x^{2} + 1}}_{\ds{=\ {\pi \over 2}}} \end{align}

\begin{align} 0&=6\pi\ic\int_{0}^{\infty}{\ln^{2}\pars{x} \over x^{2} + 1}\,\dd x +\pars{-\,{1 \over 8} + {27 \over 8} - 4}\,\pi^{4}\,\ic =6\pi\ic\int_{0}^{\infty}{\ln^{2}\pars{x} \over x^{2} + 1}\,\dd x - {3 \over 4}\,\pi^{4}\,\ic \end{align}

$$\color{#66f}{\large\int_{0}^{\infty}{\ln^{2}\pars{x} \over x^{2} + 1}\,\dd x} ={3\pi^{4}\ic\,/4 \over 6\pi\ic} =\color{#66f}{\Large{\pi^{3} \over 8}}$$