Dogbone contour integral/branch cuts/residue at infinity I am trying to compute:
$$\int_0^1 \frac{\sqrt{x-x^2}}{x+2} dx$$
by contour integration. I define $f(z) = \sqrt{z-z^2}$ with a branch cut on $[0,1]$ in such a way that $f(-1)=\sqrt{2}i$, then define $g(z)=\frac{f(z)}{z+2}$. Then I integrate $g$ clockwise around a dogbone contour from 0 to 1. The two arcs' contributions go to zero as the radius goes to zero, simply because the integrand is bounded if $z$ is away from $-2$. The choice of branch cut means that the integrand is of opposite sign on the two sides of the branch cut. This combined with the different orientation (the top integral is traversed going to the right, the bottom to the left) means that the top and bottom integrals are the same, both equal in the limit to the value that is desired. Consequently:
$$2 \int_0^1 \frac{\sqrt{x-x^2}}{x+2} dx = 2 \pi i ( Res(g,-2) + Res(g,\infty) )$$
by the exterior domain residue theorem. The first one is by the rules of residue calculus $f(-2)=\sqrt{6}i$, from how $f$ is defined. This is fine (it turns out the way it should).
My problem is with $Res(g,\infty)$. The definition of this is $Res \left (-\frac{g(1/z)}{z^2},0 \right )$. So this is $Res \left (-\frac{f(1/z)}{z^2(1/z+2)},0 \right )$. My only idea for computing this was to try to break up $f(1/z)$ using the branch cut and ultimately binomial expand the square root. Doing this gives the correct answer, namely $-5/2i$, provided that $(-1)^{1/2}=i$ in the binomial expansion formula. I assume this comes from the fact that the binomial expansion holds for the principal square root, but am not sure. Overall plugging these back in gives
$$\int_0^1 \frac{\sqrt{x-x^2}}{x+2} dx = \pi (5/2 - \sqrt{6})$$
which is correct. But is there a better way of thinking about this?
 A: $\newcommand{\+}{^{\dagger}}
 \newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle}
 \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack}
 \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,}
 \newcommand{\dd}{{\rm d}}
 \newcommand{\down}{\downarrow}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}
 \newcommand{\fermi}{\,{\rm f}}
 \newcommand{\floor}[1]{\,\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}[1]{\left\vert #1\right\rangle}
 \newcommand{\ol}[1]{\overline{#1}}
 \newcommand{\pars}[1]{\left(\, #1 \,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\pp}{{\cal P}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,}
 \newcommand{\sech}{\,{\rm sech}}
 \newcommand{\sgn}{\,{\rm sgn}}
 \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}
 \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}
 \newcommand{\wt}[1]{\widetilde{#1}}$
$\ds{\int_{0}^{1}{\root{x - x^{2}} \over x + 2}\,\dd x:\ {\large ?}}$

${\large\tt\mbox{Following my own above comment:}}$

\begin{align}
&\color{#c00000}{\int_{0}^{1}{\root{x - x^{2}} \over x + 2}\,\dd x}
=\int_{\infty}^{1}
{\root{1/x - 1/x^{2}} \over 1/x + 2}\,\pars{-\,{\dd x \over x^{2}}}
=\int_{1}^{\infty}
{\root{x - 1} \over 1 + 2x}\,{\dd x \over x^{2}}
\\[3mm]&=\half\int_{0}^{\infty}
{\root{x} \over \pars{x + 3/2}\pars{x + 1}^{2}}\,\dd x
\\[3mm]&=\half\braces{2\pi\ic\bracks{
\overbrace{{\root{3/2}\expo{\ic\pi/2} \over \pars{-3/2 + 1}^{2}}}
^{\ds{=\ 2\root{6}\ic}}\ +\
\overbrace{\lim_{z \to \expo{\ic\pi}}\totald{}{z}\pars{\root{z} \over z + 3/2}}
^{\ds{=\ -5\ic}}}}
-\half\int_{\infty}^{0}
{\root{x}\expo{\ic\pi} \over \pars{x + 3/2}\pars{x + 1}^{2}}\,\dd x
\end{align}

$$\color{#44f}{\large
\int_{0}^{1}{\root{x - x^{2}} \over x + 2}\,\dd x
=\half\pars{5 - 2\root{6}}\pi} \approx 0.1587
$$

