# Help, Where is wrong when I do same complex integration using two different contours

everyone! please give few hit. I want take the integral $$I=\int_{0}^{\infty}{\frac {dx}{ \sqrt{x}(1+{x}^{2})}}$$ by using the Residue Theorem. I choice two contours in complex plane with $z=r e^{i\theta}$ to calculate, But I get different results which one of them is same as the textbook and WolframAlpha, i.e. $I=\frac {\sqrt{2}}{2} \pi$.

In this situation, the Residue Theorem is $\oint_{\Gamma_{1}}{\frac{dz}{\sqrt{z} (1+{z}^{2})}} =-\pi i^{\frac{3}{2}}$ for combined contour $\Gamma_{1}$ of four parts of contours $C_{1}$,$C_{2}$,$C_{3}$ and $C_{4}$ and I also have the following results for these four contours with the radius of $C_{4}$ and $C_{2}$ turn to be $\infty$ and $0$, respectively $$\int_{C_{1}}{\frac{dz}{\sqrt{z} (1+{z}^{2})}} =-i I$$ $$\int_{C_{3}}{\frac{dz}{\sqrt{z} (1+{z}^{2})}} =I$$ $$\left|\int_{C_{2}}{\frac{dz}{\sqrt{z} (1+{z}^{2})}}\right| \le \lim_{\delta\rightarrow 0}{\frac {\pi \delta}{\left| \sqrt {\delta}-{\delta}^{\frac{5}{2}}\right|}}=0$$ $$\left|\int_{C_{4}}{\frac{dz}{\sqrt{z} (1+{z}^{2})}}\right| \le \lim_{R\rightarrow \infty}{\frac {\pi R}{\left| \sqrt {R}-{R}^{\frac{5}{2}}\right|}}=0$$. So, I have $I(1-i)=-\pi i^{\frac{3}{2}}$ and $I=\frac {\sqrt{2}}{2} \pi$.

But, In 2nd contour, I can not get the result, Please help find where did I mistake. The 2nd contour is given as

In this situation, the Residue Theorem is $\oint_{\Gamma_{2}}{\frac{dz}{\sqrt{z} (1+{z}^{2})}} =\int_{C_{1}}+\int_{C_{2}}+\int_{C_{3}}+\int_{C_{4}}=2 \pi i （Resf(z)_{z=i}+Resf(z)_{z=-i}）=-i \pi \sqrt{2}$ for combined contour $\Gamma_{2}$ of four parts of contours $C_{1}$,$C_{2}$,$C_{3}$ and $C_{4}$ and I also have the following results for these four contours with the radius of $C_{2}$ and $C_{4}$ turn to be $\infty$ and $0$, respectively $$\int_{C_{1}}{\frac{dz}{\sqrt{z} (1+{z}^{2})}} =\int_{C_{1}}{\frac{d(r e^{i 0})}{\sqrt{r} e^{i \frac{0}{2}} (1+{r}^{2} e^{i 2* 0})}}=\int_{C_{1}}{\frac{d(r)}{\sqrt{r} (1+{r}^{2})}}=\int_{0}^{\infty}{\frac{dr}{\sqrt{r} (1+{r}^{2})}}=I$$

$$\int_{C_{3}}{\frac{dz}{\sqrt{z} (1+{z}^{2})}} =\int_{C_{3}}{\frac{d(r e^{i 2 \pi})}{\sqrt{r} e^{i \pi} (1+{r}^{2} e^{i 4*\pi})}}=\int_{C_{3}}{\frac{dr}{-\sqrt{r} (1+{r}^{2})}}=-\int_{+\infty}^{0}{\frac{dr}{\sqrt{r} (1+{r}^{2})}}=\int_{0}^{\infty}{\frac{dr}{\sqrt{r} (1+{r}^{2})}}=I$$

To evaluate the up level of the integral of $C_{4}$ and $C_{2}$, I first calculate the up level of absolute value of $f(z)$. Because $$\left|f(z) \right|=\frac {1}{\left| \sqrt{r}{e}^{i\frac {\theta}{2}}(1+{r}^{2}{e}^{ i2\theta}) \right|} \le \frac { 1 }{ \left| \sqrt { r } -{ r }^{ \frac { 5 }{ 2 } } \right| }$$

$$\left|\int_{C_{4}}{\frac{dz}{\sqrt{z} (1+{z}^{2})}}\right| \le \lim_{\delta\rightarrow 0}{\frac {2\pi \delta}{\left| \sqrt {\delta}-{\delta}^{\frac{5}{2}}\right|}}=0$$

$$\left|\int_{C_{2}}{\frac{dz}{\sqrt{z} (1+{z}^{2})}}\right| \le \lim_{R\rightarrow \infty}{\frac {2\pi R}{\left| \sqrt {R}-{R}^{\frac{5}{2}}\right|}}=0$$. So, I have $2I=-i \sqrt{2}\pi$ and $I=-i \frac {\sqrt{2}}{2} \pi$.

I think I should be make some mistake in the 2nd contour calculation. Is anyone can help me to fix it, thanks and please!! And what should be attended when I take a contour integral for a multivalued function except branch and branch cut?

• Without entering into the details, I think the problem here is the double valued characteristic of $\;\sqrt z\;$ . In the first contour you seem to have disregarded this, though establishing the principal value of the integral. In the second one it looks like the positive real axis is the chosen branch of the square root. Jun 24, 2016 at 18:13
• It 's my oversight, sorry. I use the branch $\sqrt{z}=\sqrt{r} e^{i \frac{\theta}{2}}$ and the branch cut is choice as the real positive axis. I think there mistake may be not from the multivalued, let me see... Jun 24, 2016 at 18:31
• May be your right, I will check, please wait!!! Joanpemo Jun 24, 2016 at 18:33
• @al I'll try to stick around a little, thank you. I didn't read your whole calculation but yet: it is not only the change of sign in choosing this or that branch, but perhaps there is some other mistake there. I'm curious, now. Jun 24, 2016 at 18:35
• Now, I am re-edit detailed process, it slow writing with Latex, please wait. Jun 24, 2016 at 19:03

Take the branch cut of $\sqrt{x}$ to be the negative real axis. We can deform the contour from $(0,\infty)$ to $(-\infty,0)$ on either side of the branch cut, at the cost of adding in a residue. Notice that the integrand has opposite values on either side of the branch cut. If we deform $(0,\infty)$ to $(-\infty,0)$ requiring that $arg(z)=\pi$, we have

$$\int_0^\infty\frac{dx}{\sqrt{x}(1+x^2)}=2\pi i\cdot \text{Res}\left(\frac{1}{\sqrt{z}(1+z^2)},z=i\right)-\int_{-\infty}^0\frac{dx}{\sqrt{x}_+(1+x^2)}.$$

($x_+$ means $arg(x)=\pi$ and $x_-$ means $arg(x)=-\pi$)

Repeating the same process but deforming to the other side of the branch cut, we have

$$\int_0^\infty\frac{dx}{\sqrt{x}(1+x^2)}=-2\pi i\cdot \text{Res}\left(\frac{1}{\sqrt{z}(1+z^2)},z=-i\right)-\int_{-\infty}^0\frac{dx}{\sqrt{x}_-(1+x^2)}.$$

Therefore we have

$$2\int_0^\infty\frac{dx}{\sqrt{x}(1+x^2)}=2\pi i\cdot\text{Res}\left(\frac{1}{\sqrt{z}(1+z^2)},z=i\right)-2\pi i\cdot \text{Res}\left(\frac{1}{\sqrt{z}(1+z^2)},z=-i\right).$$

$2\pi i\cdot\text{Res}\left(\frac{1}{\sqrt{z}(1+z^2)},z=i\right)=\pi\cdot e^{-i\pi/4}$ and $-2\pi i\cdot\text{Res}\left(\frac{1}{\sqrt{z}(1+z^2)},z=-i\right)=\pi\cdot e^{i\pi/4}$ so

$$\int_0^\infty\frac{dx}{\sqrt{x}(1+x^2)}=\frac{\pi}{2}(e^{i\pi/4}+e^{-i\pi/4})=\frac{\pi}{\sqrt{2}}.$$

• Why we should change the branch cut? I think it should be equivalent for which branch cut I choice. can you show this equivalence between these two contours? thanks !! please!! Jun 24, 2016 at 19:48
• If you want the branch cut to be the positive real axis, you need to specify which side of the branch cut you integrate. I'm assume you integrate taking $arg(x)=0$. You can apply the same ideas. You can deform from $(0,\infty)$ with $arg(x)=0$ to $(0,\infty)$ with $arg(x)=2\pi$. Jun 24, 2016 at 19:53
• In my calculation, I assume that above the real positive axis, $arg(z)=0$ and $arg(z)=2 \pi$ for below the real positive axis. But why I make mistake? can you help fix it? Jun 24, 2016 at 19:57
• I am not clear your mean "deform", because I can only take limit of the radius Jun 24, 2016 at 19:59

The first integral is equal to, in the limit as $R \to \infty$,

$$e^{i \pi} \int_{\infty}^0 \frac{dx}{e^{i \pi/2} \sqrt{x} (1+x^2)} + \int_0^{\infty} \frac{dx}{\sqrt{x} (1+x^2)} = (1-i) \int_0^{\infty} \frac{dx}{\sqrt{x} (1+x^2)}$$

which is equal to $i 2 \pi$ times the residue at the pole $z=e^{i \pi/2}$, so that

$$\sqrt{2} e^{-i \pi/4} \int_0^{\infty} \frac{dx}{\sqrt{x} (1+x^2)} = i 2 \pi \frac1{e^{i \pi/4} 2 e^{i \pi/2}} \implies \int_0^{\infty} \frac{dx}{\sqrt{x} (1+x^2)} = \frac{\pi}{\sqrt{2}}$$

The second integral is equal to, in the limit as $R \to \infty$,

$$\int_0^{\infty} \frac{dx}{\sqrt{x} (1+x^2)} + e^{i 2 \pi}\int_{\infty}^0 \frac{dx}{e^{i \pi}\sqrt{x} (1+x^2)}$$

which is equal to $i 2 \pi$ times the sum of the residues at the poles $z=e^{i \pi/2}$ and $z=e^{i 3 \pi/2}$. (NB This is the key to recovering the correct answer - we have defined the branch cut so that the argument of $-i$ must be $3 \pi/2$.) Thus,

$$2 \int_0^{\infty} \frac{dx}{\sqrt{x} (1+x^2)} = i 2 \pi \left [\frac1{e^{i \pi/4} 2 e^{i \pi/2}} + \frac1{e^{i 3 \pi/4} 2 e^{i 3 \pi/2}} \right ] = \pi \sqrt{2}$$

So both contours provide the same result, so long as the argument of the complex variable $z$ is treated consistently with respect to the branch cut.

• Is that you mean the residue at $-i$ should be calculated by using $e^{\frac{i 3 \pi}{2}}$? Jun 24, 2016 at 20:16
• @alxandernashzhang: YES!! Jun 24, 2016 at 20:16
• Well, Let me see... Jun 24, 2016 at 20:21
• Thanks!!! I also need some time to understand what happen... Why we should us the $e^{\frac{i3\pi}{2}}$ rather than directly use the $-i$? Jun 24, 2016 at 20:23
• @alxandernashzhang: Because the keyhole contour assumes that, above the positive real axis the argument of $z$ is $0$, below is $2 \pi$, so that all complex numbers must have argument between $0$ and $2 \pi$. Jun 26, 2016 at 20:20

I would propose the following to avoid the multiple valued problem in this case: substitute

$$x=u^2\implies dx=2u\,du\implies\;\text{we get the integral}\;\;$$

$$\int_0^\infty\frac{2u\;du}{u(1+u^4)}=2\int_0^\infty\frac{du}{1+u^4}=\frac\pi{\sqrt2}$$

which is your first result (This is more or less well known result, which can also be obtained by "usual", real methods, or by complex analysis).

• I agree that this does get the right answer, but it skirts the issue of the OP's lack of understanding of how to treat the multivaluedness of the integrand. Jun 24, 2016 at 18:23
• @RonGordon Thank you, and I agree with you. I briefly commented about this below the question, as I think it is a quite a wide subject to be properly dealt with in this site, and I proposed an idea to "go around the corner" and get what we want. Jun 24, 2016 at 18:26
• yes, this integration is well known. My aim to calculate with contour is to check the effect of choice of contour Jun 24, 2016 at 18:26
• @Ron Gordon can you represent detailed for intergral for multivalued function? Jun 24, 2016 at 19:07