Help evaluating $\int_0^\infty \frac{1}{x^{1/2}(x+1)}dx$ I began solving this with U sub and partial fractions...first for $x^{1/2}$ and then for $x+1$  but neither of those methods got me the answer of $\pi$.    
I know the indefinite integral should be $2\tan ^{-1} x^{1/2} + C$.
 A: The substitution $u=x^{1/2}$ works smoothly. We get $du=\frac{1}{2}x^{-1/2}\,dx$, so $dx=2x^{1/2}\,du=2u\,du$. It follows that
$$\int_0^\infty \frac{dx}{x^{1/2}(1+x)}=\int_0^\infty \frac{2\,du}{1+u^2}.$$
Now it's over, an antiderivative of $\frac{2}{1+u^2}$ is $2\arctan u$, and as $M\to\infty$, $\arctan M\to\frac{\pi}{2}$. 
Remark: It we want to be formal about the calculation, consider the integral 
$$\int_{\epsilon}^B \frac{dx}{\sqrt{x}(1+x)}.$$
Make the substitution as above. Then our integral is equal to
$$\int_{\sqrt{\epsilon}}^{\sqrt{B}}\frac{2\,du}{1+u^2}.$$
When we evaluate, we get $2\arctan(\sqrt{B})-2\arctan(\sqrt{\epsilon})$. This has limit $\pi$ as $b\to\infty$ and $\epsilon\to 0^+$. 
A: HINT:
Put $x=\tan^2\theta$ so that $dx=2\tan\theta\sec^2\theta d\theta$
If $x\to0, \tan^2\theta\to0\implies \tan\theta\to0\implies \theta\to0$ (taking the principal value)
and if $x\to\infty ,\tan^2\theta\to\infty\implies \tan\theta\to\pm\infty$
If we take $\tan\theta\to+\infty$ i.e., $\theta\to\frac\pi2$ (taking the principal value) $,\sqrt x=+\tan\theta$
Then the integral becomes $$\int_0^\frac\pi2 2d\theta=2\left(\frac\pi2-0\right)$$
If we take $\tan\theta\to -\infty$ i.e., $\theta\to -\frac\pi2$ (taking the principal value) $,\sqrt x=-\tan\theta$
Then the integral becomes  $$\int_0^{-\frac\pi2} (-2)d\theta=-2\left(-\frac\pi2-0\right)$$
A: The integral may also be evaluated using residue theory, using a keyhole contour $C$.  Consider
$$\oint_C dz \frac{z^{-1/2}}{z+1} = \int_{\epsilon}^R dx \frac{x^{-1/2}}{x+1} + i R \int_0^{2 \pi} d\theta \, e^{i \theta} \frac{R^{-1/2} e^{-i \theta/2}}{R e^{i \theta}+1}+ e^{-i \pi} \int_R^{\epsilon} dx dx \frac{x^{-1/2}}{x+1} \\ + i \epsilon\int_{2 \pi}^0 d\phi \, e^{i \phi} \frac{\epsilon^{-1/2} e^{-i \phi/2}}{\epsilon e^{i \phi}+1}$$
The second integral vanishes as $R \to \infty$, the fourth integral vanishes as $\epsilon \to 0$.  Thus,
$$\oint_C dz \frac{z^{-1/2}}{z+1} = 2 \int_0^{\infty} dx \frac{x^{-1/2}}{x+1} $$
This is equal to $i 2 \pi$ times the residue at $z=-1$, which may be computed by recognizing that, in the branch we have chosen, $-1=e^{i \pi}$.  Thus
$$2 \int_0^{\infty} dx \frac{x^{-1/2}}{x+1} = i 2 \pi e^{-i \pi/2} = 2 \pi $$
Therefore
$$\int_0^{\infty} dx \frac{x^{-1/2}}{x+1} = \pi $$
