# Contour integration with a square root

1. Sep 7, 2016

### ShayanJ

1. The problem statement, all variables and given/known data
Find the value of the integral $\int_0^\infty dx \frac{\sqrt{x}}{1+x^2}$ using calculus of residues!

2. Relevant equations

3. The attempt at a solution
This is how I did it:
$\int_0^\infty dx \frac{\sqrt{x}}{1+x^2}=\frac 1 2 \int_{-\infty}^\infty dx \frac{\sqrt{|x|}}{1+x^2}$
$\displaystyle \lim_{R\to \infty} \int_{-R}^R dz \frac{\sqrt{|z|}}{1+z^2}=\lim_{R\to \infty}\oint_{semicircle^+_R} dz \frac{\sqrt{|z|}}{1+z^2}-\underbrace{\lim_{R\to \infty} \int_{C_R}dz \frac{\sqrt{|z|}}{1+z^2}}_{\to 0} \Rightarrow \int_{-\infty}^\infty dz \frac{\sqrt{|z|}}{1+z^2}=2\pi i \frac{\sqrt{|i|}}{2i}=-2\pi i \frac i 2=\pi$
So:
$\int_0^\infty dx \frac{\sqrt{x}}{1+x^2}=\frac \pi 2$
I also tried using the keyhole contour because of the branch point at z=0. But this time I got $\frac{\pi}{1+i}$.
The problem is, wolframalpha.com gives $\frac \pi {\sqrt 2}$.
What did I do wrong?
Thanks

2. Sep 7, 2016

I think you incorrectly used the residue theorem. You need to break up the denominator by partial fractions with $1+x^2 =(x+i)(x-i)$ and then get it in the form $1/(z-z_0)$ of which you will have two terms for which the residue theorem can be applied with the $\sqrt{|z|}$ in the numerator.

Last edited: Sep 7, 2016
3. Sep 7, 2016

### ShayanJ

The denominator has two roots, i and -i. But because the contour is a semicircle in the upper half of the plane, only the residue at i contributes. So the residue theorem gives $2 \pi i \frac{\sqrt{|i|}}{i+i}$. But $|i|=1$, so the answer is $2 \pi i \frac{1}{2i}=\pi$.

4. Sep 7, 2016

With the residue theorem, the $z-z_0$ in the denominator is not part of the residue of the $f(z)$ of the numerator. I've got one problem with this problem that I haven't resolved. The $\sqrt{z} \, dz$ in the numerator (the arc length, etc.) is off sufficient magnitude that I don't think the semi-circle part of the contour can be said to be zero either in the upper half plane or lower half plane. I'm still at the drawing board.

5. Sep 7, 2016

### ShayanJ

Dude, you need help on this more than me!
The $z-z_0$ you're talking about is $z-i$ in the case of my problem which is cancelled when I calculate the residue using the formula $\displaystyle Res[f(z),z_0]_{n=1}=\lim_{z\to z_0} (z-z_0)f(z)$. So what I'm doing is $\left. \frac{(z-i)\sqrt{|z|}}{(i-z)(i+z)}\right|_{z=i}=\left. -\frac{\sqrt{|z|}}{i+z}\right|_{z=i}=-\frac{\sqrt{|i|}}{2i}$.
And the condition for the Jordan's lemma to be applicable is that $\displaystyle \lim_{R \to \infty} f(R e^{i\theta})=0 \ \ \ (0\leq \theta \leq \pi)$ which the function in the OP clearly satisfies.

6. Sep 7, 2016

### Orodruin

Staff Emeritus
Careful with the square root and the absolute value. The residue theorem only applies to functions that are analytic away from the poles.

7. Sep 7, 2016

### ShayanJ

So...what should I do?

8. Sep 7, 2016

I have something that I think works and makes it very straightforward. Use the substitution $x=z^2$. You then get $z^4+1=(z^2+i)(z^2-i)$ and the partial fractions gets rid of the resulting $z^2$ in the numerator from the sqrt and the dx. The $z^2+i$ and $z^2-i$ can subsequently be factored (and use partial fractions to separate the terms) and simple application of the residue theorem (4 terms) should get you the answer. editing... I thought I had it, but once again I'm stuck because the contour doesn't close properly, i.e. often times there is a $e^{iz}$ term in these integrals so you can do the contour in the upper half plane and get zero for the semi-circle, but such a term is not present. I'm back to the drawing board !!!!

Last edited: Sep 7, 2016
9. Sep 8, 2016

### Ray Vickson

You CANNOT use contour integration the way you have done, because $|z|$ and $\sqrt{|z|}$ are not analytic (or even holomorphic) functions in the complex plane. The contour integration theorems will simply not apply to your integral as you have written it.

However, you can change variables to $t =\sqrt{x}$ and get an integral of the form
$$I = \int_0^{\infty} \frac{2 t^2}{1+t^4} \, dt$$
Now you CAN write
$$I = \int_{-\infty}^{\infty} \frac{t^2}{1+t^4} \, dt$$
and apply contour integration to that.

Note added in edit: for some reason, Orodruin's post did not appear on my screen until after I pressed the enter key to submit this material.

10. Sep 8, 2016

### ShayanJ

I applied the suggested substitution, but I got an extra i!
This is how I did it:
$\int_0^\infty \frac{\sqrt x}{1+x^2} dx \xrightarrow{b=\sqrt x} 2\int_0^\infty \frac{b^2}{1+b^4}db=\int_0^\infty \left( \frac{1}{b^2+i}+\frac{1}{b^2-i} \right) db=\frac 1 2 \int_{-\infty}^\infty \left( \frac{1}{b^2+i}+\frac{1}{b^2-i} \right) db$.

$\int_{-\infty}^\infty \frac{db}{b^2-i}=\oint_{semicircle^+} \frac{dz}{z^2-i}=2\pi i \left. \frac{1}{z+e^{i\frac \pi 4}} \right|_{z=e^{i\frac \pi 4}}=\pi i e^{-i\frac \pi 4}$

$\int_{-\infty}^\infty \frac{db}{b^2+i}=-\oint_{semicircle^-} \frac{dz}{z^2+i}=-2\pi i \left. \frac{1}{z+e^{i\frac {3\pi} 4}} \right|_{z=e^{i\frac {3\pi} 4}}=-\pi i e^{-i\frac {3\pi} 4}$

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

EDIT: I noticed that if I don't put that minus sign in the calculation of the integral on the semicricle-, the extra i won't happen. But I think that minus sign should be there because going from $-\infty$ to $\infty$ and also having a semicircle in the the lower half of the plane, means the contour is being traversed clockwise, so the direction should be reversed and there should be a minus sign. Is this wrong?

Last edited: Sep 8, 2016
11. Sep 8, 2016

### Orodruin

Staff Emeritus
If you close the second integral using a lower semi-circle you will pick up the pole at $b = e^{-i\pi/4}$, not the pole at $b = e^{3i\pi/4}$.

12. Sep 8, 2016

### Ray Vickson

If you complete in the upper half-plane the contour is counter-clockwise and you need the residues at $r_1 = e^{i\pi/4}$ and $r_2 =e^{3 i \pi/4}$; if you complete in the lower half-plane your contour is clockwise and you need the residues at $r_3= e^{5 i \pi/4} = e^{-3 i \pi/4}$ and $r_4 =e^{7 i \pi/4} = e^{-i \pi/4}$.

Completing in the upper half-plane gives
$$I = 2 \pi i \left( \frac{r_1^2}{(r_1-r_2)(r_1-r_3)(r_1-r_4)} + \frac{r_2^2}{(r_2-r_1)(r_2-r_3)(r_2-r_4)} \right)$$
That simplifies to $I = \pi/\sqrt{2}$, as it should.

Last edited: Sep 8, 2016