TITLE: Integrating around a dog bone contour
QUESTION [14 upvotes]: Prove that
$$\int^{1}_{0} \sqrt{x}\sqrt{1-x}\,dx = \frac{\pi}{8}$$
$$\textit{proof}$$
Consider the function
$$f(z) = \sqrt{z-z^2} = e^{\frac{1}{2}\log(z-z^2)}$$
Consider the branch cut on the x-axis
$$x(1-x)\geq 0\,\, \implies \, 0\leq x \leq 1 $$
Consider $ w= z-z^2 $ then
$$\log(w) = \log|w|+i\theta,\,\, \theta\in[0,2\pi)$$
Consider the contour

Consider the integral
$$\int_{c_0}f(z)\,dz+\int_{c_1}f(z)\,dz+\int^{1-\epsilon}_{\epsilon} e^{\frac{1}{2}\log|x-x^2|}\,dx-\int^{1-\epsilon}_{\epsilon} e^{\frac{1}{2}\log|x-x^2| +\pi i}\,dx = 2\pi i \mathrm{Res}(f,\infty)$$
Consider the Laurent expansion of
$$\sqrt{z-z^2} =i \sqrt{z^2} \sqrt{1-\frac{1}{z}}= iz\sum_{k=0}^\infty{\frac{1}{2} \choose k} \left(-\frac{1}{z} \right)^k$$
Hence we deuce that
$$ \mathrm{Res}(f,\infty) = -\frac{i}{8}$$
That implies
$$\int_{c_0}f(z)\,dz+\int_{c_1}f(z)\,dz+2\int^{1-\epsilon}_{\epsilon} \sqrt{x}\sqrt{1-x}\,dx = \frac{\pi}{4}$$
Considering integrals the contours around $c_0$ and $c_1$ go to zero . Finally we get
$$\int^{1}_{0} \sqrt{x}\sqrt{1-x}\,dx = \frac{\pi}{8}$$

Question
I have my concerns about the expansion at infinity 
$$\sqrt{z-z^2} =i \sqrt{z^2} \sqrt{1-\frac{1}{z}}= iz\sum_{k=0}^\infty{\frac{1}{2} \choose k} \left(-\frac{1}{z} \right)^k$$
First I am assuming that $\sqrt{z^2} = z$ which seems to be wrong on the chosen branch cut. Also it is wrong to assume that $\sqrt{zw} = \sqrt{z}\sqrt{w}$.

REPLY [3 votes]: We    may    use    the     method    from    the    following    MSE
link     for    the
residue at infinity. The  introduction and the continuity argument can
be copied verbatim and will not be repeated here. We use
$$f(z) = \exp(1/2\times \mathrm{LogA}(z))
\exp(1/2\times \mathrm{LogB}(1-z))$$
with the  two logarithms defined as  in the linked-to  post. Note that
this is not the choice  Mathematica or Maple makes, but consistency is
sufficient here and we can re-use a vetted computation.
The difference is that we have $f(z)\sim  z$ at infinity so we need to
determine the  coefficients on $z,$  the constant coefficient  and the
one on $1/z.$ There was less work at the linked-to computation because
the function was $\sim 1/z$ at infinity. 
We use $f(z)/z^2$ for the first  one and put $z = R\exp(i\theta).$ Now
the modulus of $\mathrm{LogA}(z)$ is  $\log R.$ We get for the modulus
of $\mathrm{LogB}(1-z)$
$$\log\sqrt{(1-R\cos(\theta))^2 + R^2\sin(\theta)^2}
\\ = \log\sqrt{1-2R\cos(\theta) + R^2}.$$
We are manipulating logarithms of positive real numbers using the real
logarithm and may continue with
$$\log R + \log\sqrt{1-2\cos(\theta)/R+1/R^2}.$$
Using the  leading term  and the method  from the link  we immediately
obtain  $f(z)   \sim  -iz.$  For  the  constant   coefficient  we  use
$(f(z)+iz)/z.$ We have
$$\exp\left(\frac{1}{2}\log\sqrt{1-2\cos(\theta)/R+1/R^2}\right)
= \sqrt[4]{1-2\cos(\theta)/R+1/R^2}
\\ = 1 - \frac{1}{4} (2\cos(\theta)/R-1/R^2)
- \frac{3}{32} (2\cos(\theta)/R-1/R^2)^2 -\cdots
\\ = 1 - \frac{1}{2}\cos(\theta)\frac{1}{R}
+ \left(1/4 - \frac{3}{8}\cos(\theta)^2\right)\frac{1}{R^2}
- \cdots$$
We also have
$$\arctan\left(\frac{-R\sin(\theta)}{1-R\cos(\theta)}\right)
= \arctan\left(\frac{-\sin(\theta)}{1/R-\cos(\theta)}\right)
\\ = \theta + \sin(\theta)\frac{1}{R} + 
\sin(\theta)\cos(\theta)\frac{1}{R^2} + \cdots$$
so that  (this actually holds  everywhere as long as  $\theta$ matches
the range of $\arg\mathrm{LogB}$)
$$\exp\left(\frac{1}{2}i\arg\mathrm{LogB(1-z)}\right)
\\ = \exp\left(\frac{1}{2}i\theta\right)
\left(1 + \frac{1}{2}i\sin(\theta)\frac{1}{R} + 
\frac{1}{2}i\sin(\theta)\cos(\theta)\frac{1}{R^2} -
\frac{1}{8} \sin(\theta)^2\frac{1}{R^2} + \cdots\right).$$
Adding in $iz$ cancels the contribution  from the first terms of these
two  expansions.  We  get  from  the second  term  and collecting  the
contributions from the lower and upper half plane
$$\int_0^{2\pi} \frac{1}{R\exp(i\theta)}
\exp(\log R) \exp(i\theta+\pi i/2)
\\ \times \left(\frac{1}{2}i\sin(\theta)\frac{1}{R}
-\frac{1}{2}\cos(\theta)\frac{1}{R}\right)
Ri\exp(i\theta)
\; d\theta
\\ = \int_0^{2\pi}
\exp(\log R) \exp(i\theta+\pi i/2) i
\left(-\frac{1}{2}\exp(-i\theta)\right) \frac{1}{R}
\; d\theta
\\ = \frac{1}{2} \int_0^{2\pi}
\exp(i\theta)\exp(-i\theta)
\; d\theta = \pi.$$
for a residue of $-(\pi)/(2\pi i)  = i/2.$ This establishes $f(z) \sim
-iz + i/2.$ We  integrate $f(z) + iz - i/2$ to  get the coefficient on
$1/z$, obtaining
$$\int_0^{2\pi}
\exp(\log R) \exp(i\theta+\pi i/2)
\\ \times \frac{1}{R^2} \left(\frac{1}{4}-\frac{3}{8}\cos(\theta)^2
+ \frac{1}{2} i\sin(\theta)\cos(\theta)
- \frac{1}{8} \sin(\theta)^2
-\frac{1}{4}i\sin(\theta)\cos(\theta)\right)
\\ \times Ri\exp(i\theta)
\; d\theta$$
The inner term is
$$\frac{1}{8} - \frac{1}{4}\cos(\theta)^2 + \frac{1}{8}i\sin(2\theta)
= - \frac{1}{8}\cos(2\theta) + \frac{1}{8}i\sin(2\theta)
= - \frac{1}{8}\exp(-2i\theta).$$
which leaves for the integral
$$\frac{1}{8} \int_0^{2\pi} \exp(2i\theta)\exp(-2i\theta) \; d\theta
= \frac{\pi}{4}.$$
We get the residue $-(\pi/4)/(2\pi i) = i/8.$
We have established that at infinity,
$$\bbox[5px,border:2px solid #00A000]{ f(z) \sim
-iz + \frac{1}{2} i + \frac{1}{8} i \frac{1}{z}}$$
and hence $\mathrm{Res}_{z=\infty} f(z) = \frac{1}{8} i.$ Taking  into
account  that the  contour used  with this  branch produces  twice the
value of the integral we obtain
$$\frac{1}{2} \times -2\pi i \times \frac{1}{8} i$$
which is
$$\bbox[5px,border:2px solid #00A000]{ \frac{\pi}{8}.}$$