# Finding the correct contour to evaluate an integral with finite bounds of integration

What I am interested in is finding a closed form solution to the following integral:

$$\int_{-1}^{1}\frac{\sqrt{1-x^2}}{1+x^2}dx$$

My approach so far is as follows:

Let us consider $\Gamma = \gamma_1+\gamma_2$ where $\gamma_1$ is the path defined on the real axis from $-1$ to $1$. $\gamma_2$ is defined as $\textbf{not sure...}$. Thus, by the Residual Theorem, (under the assumption that our contour is in the upper half plane), we have:

$$\int_{\Gamma}f=2\pi i \text{Res}(f;i)=2\pi i \bigg( \frac{\sqrt{2}}{2i}\bigg)=\pi \sqrt{2}$$

And with the help of Mathematica, one finds that:

$$\int_{-1}^{1}\frac{\sqrt{1-x^2}}{1+x^2}dx=\pi(\sqrt{2}-1)$$

Naturally, I'm simply stuck on defining the contour to yield a nice integral to which should evaluate to $\pi$. From my understanding, defining $\gamma_2 = e^{it}, t\in [0, \pi]$ will not work since $i$ lies on such a contour.

• Well, the integral is symmetric, which might help. – Simply Beautiful Art Jan 18 '17 at 2:38

## 2 Answers

If one wishes to use complex analysis to evaluate the integral, $\int_{-1}^1 \frac{\sqrt{1-x^2}}{1+x^2}\,dx$, then one can proceed as follows.

Let $f(z)=\frac{\sqrt{1-z^2}}{1+z^2}$. Analyze the contour integral

$$I=\oint_C \frac{\sqrt{1-z^2}}{1+z^2}\,dz$$

where $C$ is the classical "dog-bone" or "dumbbell" contour.

Then, accounting for the residues from the poles at $z=\pm i$ and the Residue at Infinity we have

\begin{align} I&=2\int_{-1}^{1}\frac{\sqrt{1-x^2}}{1+x^2}\,dx\\\\ &=2\pi i \text{Res}\left(\frac{\sqrt{1-z^2}}{1+z^2}, z=\pm i,\infty\right)\\\\ &=2\pi i \left(\frac{\sqrt 2}{2i}+\frac{-\sqrt 2}{-2i}+i\right)\\\\ &=2\pi \left(\sqrt 2 -1\right) \end{align}

whereupon dividing by $2$ yields the coveted integral

$$\int_{-1}^1 \frac{\sqrt{1-z^2}}{1+z^2}\,dz=\pi(\sqrt 2 -1)$$

as was to be shown!

Instead of appealing to the residue at infinity, we can alternatively and equivalently analyze the integral of $\frac{\sqrt{1-z^2}}{1+z^2}$ around $C$, where $C$ is a circle of radius $R$, centered at the origin and let $R\to \infty$. Then, we have

\begin{align} \lim_{R\to \infty}\oint_{|z|=R}\frac{\sqrt{1-z^2}}{1+z^2}\,dz&=\lim_{R\to \infty}\int_0^{2\pi}\frac{\sqrt{1-R^2e^{i2\phi}}}{1+R^2e^{i\phi}}\,iRe^{i\phi}\,d\phi\\\\ &=2\pi\\\\ &=2\pi i \text{Res}\left(\frac{\sqrt{1-z^2}}{1+z^2},z=\pm i\right)-2\int_{-1}^1\frac{\sqrt{1-x^2}}{1+x^2}\,dx \end{align}

whereupon solving for the integral of interest yields the expected result!

• I hope to help make this page even more useful by documenting some of the calculations. (+1). – Marko Riedel Jan 20 '17 at 4:57
• Quick question, how exactly does one derive the fact that $\lim_{R\rightarrow \infty}\int_{|z|=R}f(z)dz=2\pi i \text{Res}(f; z=\pm i)-2\int_{-1}^{1}f(x)dx$ and not just $2\pi i \text{Res}(f; z=\pm i)$ in the context of the second derivation? – Jonathan Jan 25 '17 at 4:55
• Good question. We need deform the contour around the poles (that's where the residues contribute) and around the branch cut (that's where the integral from $-1$ to $1$ contributes twice; once from each side of the cut). – Mark Viola Jan 25 '17 at 6:26
• @MarkViola Excuse me for the late question, but why should you account for the residues when the dog bone contour doesn't include $z = \pm i$? Thank you. – Nen Nov 29 '17 at 23:49
• @eddy Note that $f$ is not analytic in and on the dog bone contour. – Mark Viola Nov 30 '17 at 16:36

I would like to add some commentary to the excellent answer by @DrMV, showing how to compute the residues involved. We will use

$$f(z) = \frac{1}{1+z^2} \exp(1/2 \times\mathrm{LogA}(1+z)) \exp(1/2 \times\mathrm{LogB}(1-z)).$$

Here $\mathrm{LogA}$ denotes the branch of the logarithm where $-\pi \lt \arg \mathrm{LogA} \le \pi$ and $\mathrm{LogB}$ where $0 \lt \arg \mathrm{LogB} \le 2\pi.$ The branch cut from $\mathrm{LogB}$ is inside the dogbone contour while for $x\lt -1$ both branch cuts apply. In fact they cancel and we have continuity across the cut and may derive analyticity by Morera's theorem as explained at this MSE link.

For the continuity the rational factor is obviously the same above and below the cut, while for the two logarithmic factors we get for $x\lt -1$ and above the cut $\mathrm{LogA}(1+x) = \log(-x-1) + \pi i$ and $\mathrm{LogB}(1-x) = \log(-x+1) + 2\pi i$ (rotation) and below the cut $\mathrm{LogA}(1+x) = \log(-x-1) - \pi i$ and $\mathrm{LogB}(1-x) = \log(-x+1)$ (rotation again). This yields above the cut

$$\exp(1/2\times(\log(-x-1)+\pi i))\exp(1/2\times(\log(-x+1)+2\pi i)) \\ = \sqrt{x^2-1} \exp(3/2 \times \pi i) = -i\sqrt{x^2-1}$$

and below the cut

$$\exp(1/2\times(\log(-x-1)-\pi i))\exp(1/2\times(\log(-x+1))) \\ = \sqrt{x^2-1} \exp(-1/2 \times \pi i) = -i\sqrt{x^2-1}$$

and we have continuity across the cut. (For the cut itself the values are from the above-the-cut case.) We need to verify that the two segments above and below the single branch cut enclosed by the dogbone contour are multiples of the target integral. We get above the cut

$$\exp(1/2\times(\log(x+1))\exp(1/2\times(\log(-x+1)+2\pi i)) = - \sqrt{1-x^2}$$

and below

$$\exp(1/2\times(\log(x+1))\exp(1/2\times(\log(-x+1))) = \sqrt{1-x^2}.$$

This means that with a counter-clockwise traversal of the contour we pick up twice the target integral. Next to compute the residues we get for the easy ones at $\pm i$

$$\mathrm{Res}_{z=i} f(z) \\ = \frac{1}{2i}\exp(1/2\times (\log \sqrt{2} + i\pi/4)) \exp(1/2\times (\log \sqrt{2} + (2\pi i-i\pi/4))) \\ = -\frac{1}{2i} \sqrt{2} = \frac{i\sqrt{2}}{2}$$

and

$$\mathrm{Res}_{z=-i} f(z) \\ = -\frac{1}{2i}\exp(1/2\times (\log \sqrt{2} - i\pi/4)) \exp(1/2\times (\log \sqrt{2} + i\pi/4)) \\ = -\frac{1}{2i} \sqrt{2} = \frac{i\sqrt{2}}{2}.$$

For the residue at infinity we use (no branch cut anymore around infinity)

$$\mathrm{Res}_{z=\infty} f(z) = - \lim_{R\rightarrow\infty} \frac{1}{2\pi i} \int_{|z|=R} f(z) \; dz.$$

Putting $z= R \exp(i\theta)$ we obtain

$$\int_0^{2\pi} \frac{1}{1+R^2 \exp(2i\theta)} \exp(1/2\times\mathrm{LogA}(1+R\exp(i\theta))) \\ \times \exp(1/2\times\mathrm{LogB}(1-R\exp(i\theta))) Ri\exp(i\theta)d\theta.$$

We have two intervals, from $0$ to $\pi$ (upper half plane) and from $\pi$ to $2\pi$ (lower half plane). In the upper half plane we have as $R$ goes to infinity that

$$\mathrm{LogA}(1+R\exp(i\theta)) \rightarrow \log(R) + i\theta$$ and

$$\mathrm{LogB}(1-R\exp(i\theta)) \rightarrow \log(R) + i(\theta+\pi)$$

We obtain for the limit

$$\int_0^{\pi} \frac{R}{\exp(-2i\theta)+R^2} \exp(\log R) \exp(i\theta + \pi i/2) i \exp(-i\theta)\; d\theta \\ = - \int_0^{\pi} \frac{R^2}{\exp(-2i\theta)+R^2} \; d\theta \rightarrow -\pi.$$

In the lower half plane we get

$$\mathrm{LogA}(1+R\exp(i\theta)) \rightarrow \log(R) + i(\theta-2\pi)$$ and

$$\mathrm{LogB}(1-R\exp(i\theta)) \rightarrow \log(R) + i(\theta-\pi)$$

This is the sames as before except $\exp(\pi i/2)$ has been replaced by $\exp(-3\pi i/2)$ which makes no difference (both evaluate to $i$) and we once more obtain $-\pi$, for a total residue of $-(-2\pi)/(2\pi i) = -i.$

Now the contour produces twice the desired value as explained earlier and hence it is given by (poles outside rather than inside contour)

$$\frac{1}{2} \times - 2\pi i \times \left(-i + i\sqrt{2}\right)$$

which is

$$\bbox[5px,border:2px solid #00A000]{ \pi(\sqrt{2}-1)}$$

as claimed.

• This is an excellent explanation of the approach I took. (+1) – Mark Viola Jan 20 '17 at 18:12
• Just one thing - I took the argument of $1-z$ to be $-2\pi < \arg(1-z)\le 0$. That is, the branch cut for the branch point at $z=1$ was taken from $1$ to $-\infty$, as you have. So $-\pi < \arg(z-1)\le \pi$. Then with $-2\pi <\arg(1-z)\le 0$ so that on the upper have of the "composite" branch cut, the numerator is $+\sqrt{1-x^2}$ while on the lower half it is $-\sqrt{1-x^2}$. So, I am taking $\log(-1)=-i\pi$. – Mark Viola Jan 20 '17 at 18:25