Compute $\int_0^1 \frac{x^2dx}{\sqrt{x(1-x)}}$ $\newcommand{\Res}{\operatorname{Res}}$I need to compute $\int_0^1 \frac{x^2dx}{\sqrt{x(1-x)}}$ using residues. I want to do this by letting $\gamma$ be the path which traverses $[0,1]$, then a loop $\gamma_{\epsilon}$ at $1$, then back through $-\gamma$, and finally a loop of radius $\gamma_{\epsilon}'$ again at $0$, and letting $\eta$ be the concatenation of these four.
Doing this, the whole integral should be $2\pi i(\Res_0(f)+\Res_1(f))$, where we let $f(z)=z^2/\sqrt{z(1-z)}$. Then, when we take the loop at $1$, we actually branches of the square root, so the returning path on $-\gamma$ will actually be doubly negative, hence the same as the integral from $\gamma$. That is, in total we have
$$2\int_{[0,1]}f(z)dz+\int_{\gamma_{\epsilon}}f(z)dz+\int_{\gamma_{\epsilon}'}f(z)dz=2\pi i(\Res_0(f)+\Res_1(f))$$
What confuses me now, is that taking $\epsilon\to0$, shouldn't the two middle integrals be equal to $2\pi i\Res_0(f)$ and $2\pi i\Res_1(f)$ respectively? Which would make the integral I'm interested in equal to $0$, which I don't think is correct.
I'm also having trouble computing the residues themselves, even Mathematica can't seem to give an answer.
 A: Residues are only defined at isolated singularities of holomorphic functions. If $f$ is holomorphic on $U$, then $\sqrt{f(z)}$ doesn't have an isolated singularity at zeros of odd order of $f$, but a branch point. For your integral, the function $z \mapsto z(1-z)$ has simple zeros at $0$ and at $1$, so $z \mapsto \sqrt{z(1-z)}$ has branch points at $0$ and $1$. We can define branches of that function on $\mathbb{C}\setminus [0,1]$, and that is what one does to evaluate the integral
$$\int_0^1 \frac{x^2}{\sqrt{x(1-x)}}\,dx.$$
The dumbbell contour one uses doesn't have any isolated singularity in the interior of the contour (the component of $\mathbb{C}\setminus \operatorname{Trace} \gamma$ that contains $0$), but there is one isolated singularity in the exterior, namely $\infty$. Since the contour is also a boundary curve of the exterior, but oriented negatively (as the boundary of the exterior), we have
$$\int_C \frac{z^2}{\sqrt{z(1-z)}}\,dz = - 2\pi i \operatorname{Res} \biggl( \frac{z^2}{\sqrt{z(1-z)}}; \infty\biggr).$$
The two possible branches of $\sqrt{z(1-z)}$ differ only in sign, and for $\lvert z\rvert > 1$ we can write each as $\pm iz\sqrt{1 - \frac{1}{z}}$ using the principal branch of the square root of $1+w$ on the unit disk.
Then the Laurent expansion of the integrand about $\infty$ is
$$\mp iz \biggl(1 - \frac{1}{z}\biggr)^{-1/2} = \mp iz \biggl(1 - \binom{-1/2}{1}\frac{1}{z} + \binom{-1/2}{2} \frac{1}{z^2} + O(z^{-3})\biggr) = \mp \biggl(iz + \frac{i}{2} +\frac{3i}{8z} + O(z^{-2})\biggr),$$
and we see that
$$\operatorname{Res} \biggl(\frac{z^2}{\sqrt{z(1-z)}}; \infty\biggr) = \mp \frac{3i}{8},$$
depending on which branch of the square root we take. Hence
$$\int_C \frac{z^2}{\sqrt{z(1-z)}}\,dz = \pm \frac{3\pi}{4}.$$
Choosing the branch that approaches positive real numbers as we approach the interval $(0,1)$ from the lower half-plane, we see that the integral is positive, and therefore
$$\int_0^1 \frac{x^2}{\sqrt{x(1-x)}}\,dx = \frac{3\pi}{8}.$$
A: I realize this is not what you're asking but just for fun try:$$$$
Let I denote the desired integral, 
observe that $$I =\int_0^1 \frac{x^2dx}{\sqrt{x(1-x)}} = \int_0^1 \frac{(1-x)^2dx}{\sqrt{x(1-x)}}$$
$$2I =\int_0^1 \frac{x^2+(1-x)^2}{\sqrt{x(1-x)}}dx = \int_0^1 \frac{2x^2-2x+1}{\sqrt{x(1-x)}}dx=\int_0^1 \frac{-2x(1-x)+1}{\sqrt{x(1-x)}}dx $$
$$= -2\int_0^1 \sqrt{x(1-x)}dx + \int_0^1 \frac{1}{\sqrt{x(1-x)}}dx$$
Now let $x = \sin(t)+\frac{1}{2}$ and solve the resulting trigonometric integral. :D
