\(\text{Integral of the month: } \int_0^1 \sqrt{x(1-x)} dx\)
Integral, complex integration, Integral of the month, Dog-bone contour
\(\require{cancel}\) \(\def\oot{\frac{1}{2}}\)
The integral
We want to compute the integral:
\[\begin{equation} I = \int_0^1 \sqrt{x(1-x)} dx. \label{eq:integral} \end{equation}\]
This integral converges since the square root function behaves like \(\textcolor{blue}{\sqrt{x}}\) near \(x=0\) and like \(\textcolor{green}{\sqrt{1-x}}\) near \(x=1\), both of which are integrable. The integral can be evaluated directly using the Beta function, but we’ll use a dog-bone contour to demonstrate the technique.
The dog-bone contour
The challenge in evaluating this integral lies in the branch cuts created by the non-integer powers \(x^\alpha\) and \((1-x)^\beta\). We can take branch cuts along the positive real axis for \(x^\alpha\) (from \(0\) to \(\infty\)) and along the negative real axis for \((1-x)^\beta\) (from \(1\) to \(-\infty\)). However, a more elegant approach is to use a dog-bone contour that wraps around the branch cuts on the interval \([0,1]\) from both sides.
The dog-bone contour, shown in Figure 1, consists of:
- Two small circular arcs \(\textcolor{blue}{C_1}\) and \(\textcolor{green}{C_2}\) around the branch points at \(z=0\) and \(z=1\)
- Two paths \(\gamma_1\) and \(\gamma_2\) that run just above and below the real axis connecting the arcs
Note that the contour and the branch cuts require some care.
Setting up the complex function
We extend the real integral to the complex plane by defining:
\[\begin{equation} f(z) = \sqrt{z(1-z)} = \textcolor{blue}{z^{1/2}}\textcolor{green}{(1-z)^{1/2}}, \label{eq:fofz} \end{equation}\]
where we need to carefully define the branch cuts. We take:
- \(\textcolor{blue}{\sqrt{z}} = |z|^{1/2} e^{i\arg(z)/2}\) with branch cut along \((-\infty, 0]\) with \(\arg(z) \in [-\pi, \pi)\)
- \(\textcolor{green}{\sqrt{1-z}} = |1-z|^{1/2} e^{i\arg(1-z)/2}\) with branch cut along \((-\infty, 1)\) with \(\arg(1-z) \in [0, 2\pi)\).
The dog-bone contour wraps around the interval \([0,1]\) from both sides. It is critical to note that the \(\textcolor{blue}{C_1}\) contour cuts through both branch cuts; and we have to show that this double crossing results in the cancellation of the individual discontinuities. To show this, consider a complex number \(z=-1+i \delta\), where we will vary \(\delta\) from \(-|\epsilon|\) to \(|\epsilon|\) with \(\epsilon\) a small number. \(\arg(z)\) will jump from \(\pi\) to \(-\pi\) as \(\delta\) goes from \(-\epsilon\) to \(\epsilon\), i.e., as we cut through the branch cut from above. The argument of \(\sqrt{z}\) will jump from \(\pi/2\) to \(-\pi/2\), that is a discontinuity of \(\pi\).
Let’s investigate \(\sqrt{1-z}\) at \(z=1-i \delta\), which reduces to \(\sqrt{i \delta}\) as \(\delta\) goes from \(-\epsilon\) to \(\epsilon\), and that will have a discontinuity of \(\pi\) as we cut through the branch cut from above. Combined together, the jumps add up to \(2\pi\), which can be dropped.
Evaluating the contour integral
The contour integral can be decomposed as:
\[\begin{equation} \oint_C f(z) dz = \int_{\textcolor{blue}{C_1}} f(z) dz + \int_{\gamma_1} f(z) dz + \int_{\textcolor{green}{C_2}} f(z) dz + \int_{\gamma_2} f(z) dz. \label{eq:contour_decomp} \end{equation}\]
Let’s analyze each piece:
The integrals along \(\gamma_1\) and \(\gamma_2\)
The \(\textcolor{blue}{\sqrt{z}}\) term is well-behaved for \(\Re\{z\} > 0\). We can replace it with \(\textcolor{blue}{\sqrt{x}}\) along \(\gamma_1\) and \(\gamma_2\) curves.
Since the branch cut for \(\textcolor{green}{\sqrt{1-z}}\) is along \([-\infty,1)\), we need to be careful about the slit \([0,1]\). On \(\gamma_1\), the imaginary part is very small but positive, resulting arg(1-z) = 0, so \(\textcolor{green}{\sqrt{1-z}} = \textcolor{green}{\sqrt{1-x}}\).
On \(\gamma_2\), the imaginary part is very small but negative, resulting in \(\arg(1-z) = 2\pi\), so \(\textcolor{green}{\sqrt{1-z}} = \textcolor{green}{\sqrt{1-x}} e^{i\pi} = -\textcolor{green}{\sqrt{1-x}}\).
It follows that:
\[\begin{eqnarray} \int_{\gamma_1} f(z) dz &=& \int_0^1 \textcolor{blue}{\sqrt{x}} \textcolor{green}{\sqrt{1-x}} dx = \int_0^1 \sqrt{x(1-x)} dx = I, \nonumber\\ \int_{\gamma_2} f(z) dz &=& -\int_0^1 (-\textcolor{blue}{\sqrt{x}}) \textcolor{green}{\sqrt{1-x}} dx = \int_0^1 \sqrt{x(1-x)} dx = I. \label{eq:c1_c2} \end{eqnarray}\]
The minus sign in the second equation comes from the fact that \(\gamma_2\) is traversed in the opposite direction, but the extra minus sign from \(\textcolor{blue}{\sqrt{z}}\) cancels it.
The small circular arcs
The integrals over \(\textcolor{blue}{C_1}\) (around \(z=0\)) and \(\textcolor{green}{C_2}\) (around \(z=1\)) vanish as the radius \(\epsilon \to 0\) because: - Near \(z=0\): \(|f(z)| \sim |\textcolor{blue}{z}|^{1/2}\), and the path length is \(\sim \epsilon\), so the integral is \(\sim \epsilon^{3/2} \to 0\) - Near \(z=1\): \(|f(z)| \sim |\textcolor{green}{1-z}|^{1/2}\), and the path length is \(\sim \epsilon\), so the integral is \(\sim \epsilon^{3/2} \to 0\).
Putting it all together
The dog-bone contour by itself is not closed. To apply the residue theorem, we need to close the contour by adding a large circle \(C_R\) at infinity. The complete closed contour consists of:
- The dog-bone contour (small arcs \(\textcolor{blue}{C_1}\), \(\textcolor{green}{C_2}\) and paths \(\gamma_1\), \(\gamma_2\))
- A large circle \(C_R\) at infinity connecting the ends.
By Cauchy’s theorem, the closed contour integral is:
\[\begin{equation} \oint_C f(z) dz = \int_{\textcolor{blue}{C_1}} f(z) dz + \int_{\gamma_1} f(z) dz + \int_{\textcolor{green}{C_2}} f(z) dz + \int_{\gamma_2} f(z) dz + \int_{C_R} f(z) dz = 2\pi i \sum \text{Res}. \label{eq:combined} \end{equation}\]
Since the small arcs vanish as \(\epsilon \to 0\), we have:
\[\begin{equation} \int_{\gamma_1} f(z) dz + \int_{\gamma_2} f(z) dz + \int_{C_R} f(z) dz = 2\pi i \sum \text{Res}. \label{eq:final_relation} \end{equation}\]
Now, on \(\gamma_2\), we traverse from \(1\) to \(0\) in the negative direction. With our branch cut convention:
- \(\textcolor{blue}{\sqrt{z}} = -\textcolor{blue}{\sqrt{x}}\) (since we’re below the cut)
- \(\textcolor{green}{\sqrt{1-z}} = \textcolor{green}{\sqrt{1-x}}\) (since we’re above the cut \([1,\infty)\))
On \(\gamma_2\), traversing from \(1\) to \(0\) (opposite direction), we have \(dz = -dx\). So: \[\begin{equation} \int_{\gamma_2} f(z) dz = \int_1^0 (-\textcolor{blue}{\sqrt{x}}) \textcolor{green}{\sqrt{1-x}} dz = \int_1^0 (-\textcolor{blue}{\sqrt{x}}) \textcolor{green}{\sqrt{1-x}} (-dx) = \int_0^1 \sqrt{x(1-x)} dx = I. \label{eq:c2_corrected} \end{equation}\]
Thus: \[\begin{equation} \int_{\gamma_1} f(z) dz + \int_{\gamma_2} f(z) dz = I + I = 2I. \label{eq:zero_result} \end{equation}\]
Cauchy’s theorem states that the integral of a function over a closed contour is zero if the function is analytic inside and on the contour. Since \(f(z)\) is analytic inside and on the dog-bone contour, we have: \[\begin{equation} \oint_C f(z) dz = 0. \label{eq:cauchy_theorem} \end{equation}\] It follows that: \[\begin{equation} \int_{\gamma_1} f(z) dz + \int_{\gamma_2} f(z) dz = 2I=0. \label{eq:cauchy_theorem_result} \end{equation}\]
This makes no sense as it is clear that the integral is not zero. What went wrong? The problem is that Cauchy’s theorem is only applicable if the function is analytic inside and on the contour. Since \(f(z)\) has branch points inside the contour, we cannot apply Cauchy’s theorem. However, all of our hard work was not in vain. We can extend the contour to include the residue at infinity to save the day.
Excluding the branch points
We will now deform the contour to avoid the branch points inside the contour. We will choose an arbitrary point in the existing contour Figure 1 and move up to a large circle at infinity, as shown in Figure 2.
To apply the residue theorem, we need to close the dog-bone contour. We do this by adding a large circle \(C_R\) at infinity that connects the ends of the dog-bone contour. The complete closed contour \(C\) (oriented counterclockwise) consists of the dog-bone plus the large circle. We have shown that the integral around the branch slit is \(2I\), see Eq. \(\ref{eq:cauchy_theorem_result}\). The contributions coming from the vertical lines cancel out, and we are left with the integral around the large circle \(C_R\). We can evaluate that integral explicitly.
If one naively looks at the integral, we see that its argument behaves like \(R\), and the measure also has an \(R\) too. Overall, it is like \(R^2\), and it looks like a losing proposition. On the other hand, the integral is over the angle, and that will give cancellations. So, overall it may end up being a non-zero and finite number. We have to bite the bullet and compute it explicitly.
Let’s define \(z=R e^{i\theta}\). However, we must be careful about the orientation of the contour. Looking at Figure 2, the large circle \(C_R\) is traversed in the clockwise direction (opposite to the standard counterclockwise orientation). When traversing a contour in the opposite direction, the integral picks up a minus sign.
For a clockwise traversal, if we parameterize as \(z = R e^{i\theta}\) with \(\theta\) going from \(0\) to \(2\pi\), we get \(dz = i R e^{i\theta} d\theta\), but since we’re going clockwise (opposite to the standard orientation), we need to account for the reversed direction. The integral becomes: \[\begin{equation} \int_{C_R} f(z) dz = -\int_0^{2\pi} f(R e^{i\theta}) i R e^{i\theta} d\theta = -i R \int_0^{2\pi} f(R e^{i\theta}) e^{i\theta} d\theta. \label{eq:integral_on_large_circle} \end{equation}\]
The minus sign accounts for the clockwise orientation of the contour.
Now, we need to evaluate \(f(R e^{i\theta})\). For large \(R\), we need to carefully expand \(f(z) = \sqrt{z(1-z)}\). Let’s factor out the dominant term.
\[\begin{equation} f(R e^{i\theta}) = \sqrt{R e^{i\theta}(1-R e^{i\theta})} = \sqrt{R e^{i\theta} - R^2 e^{2i\theta}} \label{eq:f_at_large_circle}. \end{equation}\]
Factoring out \(-R^2 e^{2i\theta}\): \[\begin{eqnarray} f(R e^{i\theta}) &=& \sqrt{-R^2 e^{2i\theta}\left(1 - \frac{1}{R e^{i\theta}}\right)} = R e^{i\theta} \sqrt{-1} \sqrt{1 - \frac{1}{R e^{i\theta}}}\nonumber\\ &=& i R e^{i\theta} \sqrt{1 - \frac{1}{R e^{i\theta}}}\nonumber\\ \label{eq:with_i}. \end{eqnarray}\]
Now we expand the square root using the binomial expansion. For \(|x| < 1\), we have: \[\begin{equation} \sqrt{1-x} = 1 - \frac{x}{2} - \frac{x^2}{8} - \frac{x^3}{16} - \cdots \label{eq:binomial_expansion}. \end{equation}\]
Substituting \(x = \frac{1}{R e^{i\theta}}\): \[\begin{equation} \sqrt{1 - \frac{1}{R e^{i\theta}}} = 1 - \frac{1}{2R e^{i\theta}} - \frac{1}{8R^2 e^{2i\theta}} + \mathcal{O}\left(\frac{1}{R^3}\right) \label{eq:expanded_sqrt}. \end{equation}\]
Hence: \[\begin{equation} f(R e^{i\theta}) = i R e^{i\theta} \left[1 - \frac{1}{2R e^{i\theta}} - \frac{1}{8R^2 e^{2i\theta}} + \mathcal{O}\left(\frac{1}{R^3}\right)\right], \label{eq:f_expanded} \end{equation}\]
so expanding the product: \[\begin{equation} f(R e^{i\theta}) = i R e^{i\theta} - \frac{i}{2} - \frac{i}{8R e^{i\theta}} + \mathcal{O}\left(\frac{1}{R^2}\right). \label{eq:f_final_expansion} \end{equation}\]
Now we substitute this expansion into Eq. \(\ref{eq:integral_on_large_circle}\): \[\begin{equation} \int_{C_R} f(z) dz = -i R \int_0^{2\pi} \left[i R e^{i\theta} - \frac{i}{2} - \frac{i}{8R e^{i\theta}} + \mathcal{O}\left(\frac{1}{R^2}\right)\right] e^{i\theta} d\theta. \label{eq:integral_with_expansion} \end{equation}\]
Expanding the integrand: \[\begin{equation} \int_{C_R} f(z) dz = -i R \int_0^{2\pi} \left[i R e^{2i\theta} - \frac{i}{2} e^{i\theta} - \frac{i}{8R} + \mathcal{O}\left(\frac{1}{R^2}\right)\right] d\theta. \label{eq:integral_expanded} \end{equation}\]
Evaluating each term: \[\begin{align} \int_{C_R} f(z) dz &= -i R \left[i R \int_0^{2\pi} e^{2i\theta} d\theta - \frac{i}{2} \int_0^{2\pi} e^{i\theta} d\theta - \frac{i}{8R} \int_0^{2\pi} d\theta + \mathcal{O}\left(\frac{1}{R^2}\right)\right] \nonumber \\ &= -i R \left[i R \cdot 0 - \frac{i}{2} \cdot 0 - \frac{i}{8R} \cdot 2\pi + \mathcal{O}\left(\frac{1}{R^2}\right)\right] \nonumber \\ &= -i R \left[-\frac{i\pi}{4R} + \mathcal{O}\left(\frac{1}{R^2}\right)\right] \nonumber \\ &= -\frac{\pi}{4} + \mathcal{O}\left(\frac{1}{R}\right). \label{eq:integral_result} \end{align}\]
In the limit \(R \to \infty\), the integral over the large circle becomes: \[\begin{equation} \lim_{R \to \infty} \int_{C_R} f(z) dz = -\frac{\pi}{4}. \label{eq:integral_limit} \end{equation}\]
The minus sign reflects the clockwise orientation of the contour \(C_R\) as shown in Figure 2. Readers with sharp eyes will notice that the only term that contributed to the final answer comes from the \(\frac{1}{z}\) term, and it comes with a minus sign. This establishes the foundation for the residue at infinity. You can imagine an inversion by \(\omega=1/z\), and that will map the singularity to \(\omega=0\) and the large circle is mapped to a very small circle around the origin. We will touch upon this in Residue at infinity.
Now we can complete the evaluation using the closed contour integral. The complete closed contour \(C\) consists of the dog-bone contour (contributing \(2I\) from Eq. \(\ref{eq:zero_result}\)) plus the large circle \(C_R\) (contributing \(-\pi/4\) from Eq. \(\ref{eq:integral_limit}\)). Since the branch points are now excluded from the interior of the contour, the function \(f(z)\) is analytic inside the closed contour \(C\). By Cauchy’s theorem (Eq. \(\ref{eq:cauchy_theorem}\)), the integral over the closed contour must be zero:
\[\begin{equation} \oint_C f(z) dz = \int_{\gamma_1} f(z) dz + \int_{\gamma_2} f(z) dz + \int_{C_R} f(z) dz = 0 \label{eq:closed_contour_integral}. \end{equation}\]
Substituting our known values: \[\begin{equation} 2I - \frac{\pi}{4} = 0. \label{eq:contour_equation} \end{equation}\]
Solving for \(I\): \[\begin{equation} I = \frac{\pi}{8}. \label{eq:final_result} \end{equation}\]
Residue at infinity
Since \(f(z) = \sqrt{z(1-z)}\) has no poles in the finite complex plane, we need to compute the residue at infinity. I will elaborate on the details of the residues at infinity in a separate post. For now, let’s just use its definition:
\[\begin{equation} \text{Res}(f, \infty) = -\text{Res}\left(\frac{1}{z^2}f\left(\frac{1}{z}\right), 0\right). \label{eq:residue_infinity_def} \end{equation}\]
Although I want to defer the juicy details to a separate post, it is worth providing a motivation for the \(\frac{1}{z^2}\) factor. The residues themselves are not invariant quantities under change of variables. However \(f(z)dz\) is! This is in great analogy with the probability density function in probability theory. the pdf (probability density function) changes under a change of variables, but the probability density times the volume element is invariant. \(\frac{1}{z^2}\) follows from transformation of the measure under the change of variables from \(z\) to \(1/z\).
First, we transform the function:
\[\begin{equation} f\left(\frac{1}{z}\right) = \sqrt{\frac{1}{z}\left(1-\frac{1}{z}\right)} = \sqrt{\frac{z-1}{z^2}} = \frac{\sqrt{z-1}}{z}. \label{eq:f_at_1_over_z} \end{equation}\]
This gives:
\[\begin{equation} \frac{1}{z^2}f\left(\frac{1}{z}\right) = \frac{\sqrt{z-1}}{z^3}. \label{eq:transformed_f} \end{equation}\]
For \(|z| < 1\), we can expand \(\sqrt{z-1}\). However, we need to be careful about the branch. For the principal branch with the cut along \((-\infty, 0]\), we have \(\sqrt{z-1} = i\textcolor{green}{\sqrt{1-z}}\) when \(|z| < 1\). Expanding:
\[\begin{equation} \textcolor{green}{\sqrt{1-z}} = 1 - \frac{z}{2} - \frac{z^2}{8} - \cdots, \label{eq:sqrt_1_minus_z_expansion} \end{equation}\]
so:
\[\begin{equation} \sqrt{z-1} = i\left(1 - \frac{z}{2} - \frac{z^2}{8} - \cdots\right) = i - \frac{iz}{2} - \frac{iz^2}{8} - \cdots. \label{eq:sqrt_z_minus_1_expansion} \end{equation}\]
This yields:
\[\begin{equation} \frac{1}{z^2}f\left(\frac{1}{z}\right) = \frac{i - \frac{iz}{2} - \frac{iz^2}{8} - \cdots}{z^3} = \frac{i}{z^3} - \frac{i}{2z^2} - \frac{i}{8z} - \cdots. \label{eq:laurent_expansion} \end{equation}\]
The coefficient of \(1/z\) is \(-i/8\), so:
\[\begin{equation} \text{Res}(f, \infty) = -\left(-\frac{i}{8}\right) = \frac{i}{8}. \label{eq:residue_infinity} \end{equation}\]
For a function that is analytic everywhere except possibly at infinity, the residue theorem states that the integral over a closed contour equals \(2\pi i\) times the sum of residues inside the contour. Since \(f(z)\) has no poles in the finite plane, all contributions come from the point at infinity.
However, there’s a subtlety: when we close the contour with a large circle, we must account for how the function behaves at infinity. For \(f(z) = \textcolor{blue}{\sqrt{z}}\textcolor{green}{\sqrt{1-z}}\), as \(|z| \to \infty\), we have \(f(z) \sim z\) (on the appropriate branch), which means the function grows linearly at infinity.
The key insight is that we can relate the dog-bone contour integral directly to the residue at infinity without explicitly computing the large circle contribution. The difference between the function values on the two sides of the branch cut (which gives \(2I\)) must be related to the behavior at infinity.
For a closed contour oriented counterclockwise, if the only singularity is at infinity, we have:
\[\begin{equation} \oint_C f(z) dz = -2\pi i \cdot \text{Res}(f, \infty). \label{eq:residue_theorem_infinity} \end{equation}\]
The minus sign appears because infinity is “outside” the finite region when viewed on the Riemann sphere. The dog-bone contour (with small arcs that vanish) contributes \(2I\), and this must equal the negative of \(2\pi i\) times the residue at infinity.
Using the residue at infinity we computed and the relation in Eq. \(\ref{eq:residue_theorem_infinity}\):
\[\begin{equation} 2I = -2\pi i \cdot \text{Res}(f, \infty) = -2\pi i \cdot \frac{i}{8} = \frac{\pi}{4}. \label{eq:contour_result} \end{equation}\]
We find:
\[\begin{equation} I = \frac{\pi}{8}. \label{eq:dog_bone_result} \end{equation}\]
This matches our Beta function result! The dog-bone contour method successfully evaluates the integral.
The Beta function
The integral can be evaluated directly using the Beta function:
\[\begin{equation} B(a,b) = \int_0^1 t^{a-1}(1-t)^{b-1} dt = \frac{\Gamma(a)\Gamma(b)}{\Gamma(a+b)}. \label{eq:beta} \end{equation}\]
Our integral is:
\[\begin{equation} I = \int_0^1 \sqrt{x(1-x)} dx = \int_0^1 \textcolor{blue}{x^{1/2}}\textcolor{green}{(1-x)^{1/2}} dx = B\left(\frac{3}{2}, \frac{3}{2}\right). \label{eq:beta_form} \end{equation}\]
Using the relation between Beta and Gamma functions:
\[\begin{equation} I = \frac{\Gamma(3/2)\Gamma(3/2)}{\Gamma(3)} = \frac{[\Gamma(3/2)]^2}{2}. \label{eq:gamma_form} \end{equation}\]
We know that \(\Gamma(3/2) = \sqrt{\pi}/2\), so:
\[\begin{equation} I = \frac{(\sqrt{\pi}/2)^2}{2} = \frac{\pi}{8}. \label{eq:final_value} \end{equation}\]
We conclude:
\[\begin{equation} \int_0^1 \sqrt{x(1-x)} dx = \frac{\pi}{8}. \label{eq:result} \end{equation}\]
Conclusion
The dog-bone contour provides a powerful method for evaluating integrals with branch cuts on \([0,1]\). For the integral \(\int_0^1 \sqrt{x(1-x)} dx\), we demonstrated how to:
- Set up the complex function \(f(z) = \textcolor{blue}{\sqrt{z}}\textcolor{green}{\sqrt{1-z}}\) with appropriate branch cuts
- Construct a dog-bone contour that wraps around the interval \([0,1]\)
- Relate the real integral to the contour integral via the discontinuity across the branch cut
- Compute the residue at infinity to evaluate the contour integral
The key insight is that the difference between the function values on the two sides of the branch cut (which gives \(2I\)) equals the sum of residues at all singularities, including infinity. By computing the residue at infinity as \(\text{Res}(f, \infty) = i/8\), we obtained:
\[\begin{equation} 2I = -2\pi i \cdot \frac{i}{8} = \frac{\pi}{4}, \end{equation}\]
yielding \(I = \pi/8\), which matches the result from the Beta function method.