<s>[INST] Evaluate $\int_{0}^{\infty} \frac{x^{1/2}}{1 + x^2}\,\mathrm dx$ using Residue Theorem. Evaluate $\int_{0}^{\infty} \frac{x^{1/2}}{1 + x^2}\,\mathrm dx$ using the Residue Theorem.
I have been given a formula to compute integrals of this type:
$I = \int_{0}^{\infty} R(x) x^{\alpha}\,\mathrm dx =  \frac{2\pi i}{1 - e^{2\pi i \alpha}} \sum_{a\in\mathbb{C}}\operatorname{Res}(R(z)z^{\alpha}, a) $ for $0 < \alpha < 1$,
however when I use this formula to compute the above integral I am finding that the answer is $\frac{i\pi}{\sqrt{2}}$. I know that the answer should not be complex so either I am doing the math wrong or this formula is incorrect.
 [/INST] On $\mathbb{C} \setminus \mathbb{R}_{\geqslant 0}$, we choose the branch of $\sqrt{z}$ with $\sqrt{i} = e^{i\pi/4} = \frac{1+i}{\sqrt{2}}$. Then the residues of $\frac{\sqrt{z}}{z^2+1}$ are
$$\begin{align}
\operatorname{Res}_i \frac{\sqrt{z}}{z^2+1} &= \frac{\sqrt{i}}{2i} = \frac{1+i}{2i\sqrt{2}}\\
\operatorname{Res}_{-i} \frac{\sqrt{z}}{z^2+1} &= \frac{\sqrt{-i}}{-2i} = \frac{-1+i}{-2i\sqrt{2}} = \frac{1-i}{2i\sqrt{2}},
\end{align}$$
the sum of the residues is then
$$\frac{1+i}{2i\sqrt{2}} + \frac{1-i}{2i\sqrt{2}} = \frac{1}{i\sqrt{2}}$$
and the formula yields $$ \frac{2\pi i}{1 - (-1)} \frac{1}{i\sqrt{2}} = \frac{\pi}{\sqrt{2}} \in \mathbb{R}.$$
</s>