---
title: Branch cuts and principal values
heading: Integrals that need a keyhole, a wedge or a detour around a pole
eyebrow: A12 · Lesson 18 · Branch cuts and principal values
xp: 40
---

::: hook
The semicircle trick of lesson 17 needs an integrand that is analytic on the real axis and single-valued. Many useful integrals break one rule or the other. $\int_0^\infty\frac{dx}{\sqrt x(1 + x)}$ involves $\sqrt x$, which has a branch cut. $\int_{-\infty}^{\infty}\frac{\sin x}{x}dx$, the area under the sinc function, comes from $e^{jx}/x$, which has a pole right on the path. Three contour shapes deal with these cases: a **keyhole** wrapped around a branch cut, a **wedge** that uses a function's symmetry, and a small **indentation** around a pole on the axis, which defines a principal value.
:::

::: play
- The contour wraps around the positive real axis, where $z^{a-1}$ has its branch cut. It runs out along the top edge, around the big circle, back along the bottom edge, and around the small circle.
- The dot at −1 is the pole of $\frac{z^{a-1}}{1 + z}$, the only singularity inside.
- Across the cut, $z^{a-1}$ is multiplied by $e^{2\pi j(a - 1)}$, so the two edges don't cancel. Move a and watch the readouts: the edges together give $(1 - e^{2\pi ja})I$, and the residue fixes I.
:::

```sim plot
view: complex
range: 3
slider: a = 0.05..0.95 step 0.01 = 0.5
slider: R = 1.5..2.8 step 0.1 = 2.5
curve: R*exp(j*u) | over: u = 0.06..6.22 | color: ch2
curve: 0.3*exp(j*u) | over: u = 0.4..5.88 | color: ch2
curve: u + 0.12*j | over: u = 0.28..R | color: ch2
curve: u - 0.12*j | over: u = 0.28..R | color: ch2
dot: -1 | label: pole at −1
readout: integral from 0 to infinity = pi/sin(pi*a) | digits: 5
readout: real part of the factor across the cut = cos(2*pi*a) | digits: 4
```

::: predict
## What is $\int_{-\infty}^{\infty}\frac{\sin x}{x}dx$?

- [ ] 0, because sin x is odd
- [x] π
- [ ] 2π
- [ ] It doesn't converge

::: reveal
π. The integrand $\frac{\sin x}{x}$ is even (odd over odd), so it doesn't cancel, and it converges because the oscillations shrink as $1/x$. The value comes from half a residue: the pole of $e^{jx}/x$ at the origin sits on the path, and a detour around half of it contributes $\pi j$ times its residue, 1.
:::
:::

::: nameit
## The keyhole contour

For $\int_0^\infty x^{a-1}R(x)\,dx$ with $0 < a < 1$ and R rational, take the branch of $z^{a-1}$ with $0 \le \arg z < 2\pi$, cut along the positive real axis. On the top edge it equals $x^{a-1}$. On the bottom edge, after one full turn, it equals $x^{a-1}e^{2\pi j(a - 1)} = x^{a-1}e^{2\pi ja}$, and the path runs back toward 0. If the big and small circles contribute nothing in the limit,

$$\left(1 - e^{2\pi ja}\right)\int_0^\infty x^{a-1}R(x)\,dx = 2\pi j\sum\text{Res}\left(z^{a-1}R(z)\right).$$

With $R = \frac{1}{1 + x}$ this gives $\int_0^\infty\frac{x^{a-1}}{1 + x}dx = \frac{\pi}{\sin\pi a}$.

## Logarithms

The same keyhole with $\ln z$ in place of $z^{a-1}$ evaluates $\int_0^\infty R(x)\,dx$: the bottom edge's extra $2\pi j$ leaves $\int_0^\infty R(x)\,dx = -\sum\text{Res}(R(z)\ln z)$. Integrals with $\ln x$ itself in them follow by the same idea with $(\ln z)^2$.

## The wedge

If $R(z)$ is unchanged by a rotation, such as $\frac{1}{1 + z^n}$ under $z \to ze^{2\pi j/n}$, close the path along the ray at angle $2\pi/n$. That ray gives $-e^{2\pi j/n}$ times the real-axis integral, and only one pole sits inside the wedge.

## Principal values

If f has a simple pole at a real point a, the integral through it doesn't exist in the ordinary sense, but the symmetric limit does:

$$\text{PV}\int_{-\infty}^{\infty}f\,dx = \lim_{\varepsilon\to0}\left(\int_{-\infty}^{a - \varepsilon} + \int_{a + \varepsilon}^{\infty}\right)f\,dx.$$

Detouring around the pole on a small half circle above it picks up $-\pi j\,\text{Res}(f, a)$, so closing in the upper half-plane gives

$$\text{PV}\int_{-\infty}^{\infty}f\,dx = 2\pi j\sum_{\text{upper}}\text{Res} + \pi j\sum_{\text{on the axis}}\text{Res}.$$

A pole on the path counts half.
:::

::: example
## Evaluate $\int_0^\infty\frac{dx}{\sqrt x(1 + x)}$.

::: solution
1. **Set up the keyhole.** This is the keyhole integral with $a = \frac12$.
2. **The residue.** The only pole is at $z = -1 = e^{j\pi}$, where $z^{-1/2} = e^{-j\pi/2} = -j$, so the residue is $-j$.
3. **The edges.** They give $(1 - e^{j\pi})I = 2I$, so
   $$\begin{aligned} 2I &= 2\pi j(-j) \\ &= 2\pi \end{aligned}$$
   and $I = \pi$.
4. **The circles vanish.** Near 0 the integrand is about $\varepsilon^{-1/2}$ on a path of length $2\pi\varepsilon$, and far out it's about $R^{-3/2}$ on a length $2\pi R$.
5. **Check.** The substitution $x = t^2$ turns the integral into
   $$\int_0^\infty\frac{2\,dt}{1 + t^2} = \pi$$

**Answer:** π.
:::
:::

::: example
## Evaluate $\int_{-\infty}^{\infty}\frac{\sin kx}{x}dx$ for k > 0.

::: solution
1. **Use the exponential.** Take $\frac{e^{jkx}}{x}$, whose imaginary part is the integrand, and close in the upper half-plane, where $e^{jkz}$ decays.
2. **The poles.** There are none above the axis, and the one at 0 sits on it, with residue 1. So
   $$\text{PV}\int\frac{e^{jkx}}{x}dx = \pi j \cdot 1$$
3. **Take the imaginary part.**
   $$\int_{-\infty}^{\infty}\frac{\sin kx}{x}dx = \pi$$
   for every k > 0 (and −π for k < 0).
4. **In signal terms.** The area under $\frac{\sin \omega t}{\pi t}$, an ideal low-pass filter's impulse response, is 1: the filter passes DC unchanged.

**Answer:** π, for every k > 0.
:::
:::

::: example
## Evaluate $\int_0^\infty\frac{dx}{1 + x^3}$ with a wedge.

::: solution
1. **Choose the wedge.** The integrand is unchanged by $z \to ze^{2\pi j/3}$, so close the path along the ray at 120°.
2. **The return ray.** On it $z = re^{2\pi j/3}$, $z^3 = r^3$ and $dz = e^{2\pi j/3}dr$, so walking it inward gives $-e^{2\pi j/3}I$.
3. **The pole inside.** Inside the wedge is one pole, $z_0 = e^{j\pi/3}$, with residue
   $$\frac{1}{3z_0^2} = \frac{e^{-2\pi j/3}}{3}$$
4. **Residue theorem.**
   $$(1 - e^{2\pi j/3})I = \frac{2\pi j}{3}e^{-2\pi j/3}$$
5. **Solve for I.** Since $1 - e^{2\pi j/3} = \frac32 - \frac{\sqrt3}{2}j = \sqrt3e^{-j\pi/6}$,
   $$\begin{aligned} I &= \frac{2\pi}{3\sqrt3}\cdot je^{-j\pi/2} \\ &= \frac{2\pi}{3\sqrt3} \\ &= 1.209 \end{aligned}$$
6. **In general.**
   $$\int_0^\infty\frac{dx}{1 + x^n} = \frac{\pi/n}{\sin(\pi/n)}$$

**Answer:** $\frac{2\pi}{3\sqrt3} = 1.209$.
:::
:::

::: check
given: a = 0.2 | 0.25 | 0.4
answer: pi/sin(pi*a)
tolerance: 0.5%

## What is $\int_0^\infty\frac{x^{\given{a} - 1}}{1 + x}dx$?

::: right
Right. $\frac{\pi}{\sin\pi a}$, from the keyhole.
:::

::: misses
- [pi/a] That's only the part near 0, where $x^{a-1}$ dominates.
- [any] $(1 - e^{2\pi ja})I = 2\pi j(-e^{j\pi a})$.
:::
:::

::: check
given: n = 3 | 4 | 6
answer: (pi/n)/sin(pi/n)
tolerance: 0.5%

## What is $\int_0^\infty\frac{dx}{1 + x^{\given{n}}}$?

::: right
Right. $\frac{\pi/n}{\sin(\pi/n)}$, from a wedge of angle $2\pi/n$; it approaches 1 as n grows.
:::

::: misses
- [pi/2] That's n = 2 only.
- [any] Substitute $t = x^n$ to reach the keyhole integral with $a = \frac1n$.
:::
:::

::: check
given: b = 2 | 3 | 5
answer: pi*ln(b)/(2*b)
tolerance: 0.5%

## What is $\int_0^\infty\frac{\ln x}{x^2 + \given{b}^2}dx$? (With b = 1 it's 0.)

::: right
Right. Put $x = bt$: the integral becomes $\frac1b\int_0^\infty\frac{\ln b + \ln t}{t^2 + 1}dt = \frac{\pi\ln b}{2b}$.
:::

::: misses
- [pi*log(b)/(2*b)] Use the natural logarithm.
- [any] Substitute $x = bt$ and use the b = 1 result.
:::
:::

::: check
given: k = 1 | 2; a = 1 | 2
answer: pi*(1 - exp(-k*a))/a^2
tolerance: 0.5%

## What is $\int_{-\infty}^{\infty}\frac{\sin \given{k}x}{x(x^2 + \given{a}^2)}dx$?

::: right
Right. The pole at 0 counts half and the one at $ja$ fully: $\pi j\cdot\frac{1}{a^2} + 2\pi j\cdot\frac{-e^{-ka}}{2a^2}$, whose imaginary part is $\frac{\pi(1 - e^{-ka})}{a^2}$.
:::

::: misses
- [pi/a^2] That's the pole at 0 alone; add the one at $ja$.
- [any] Use $\frac{e^{jkz}}{z(z^2 + a^2)}$: half the residue at 0 plus all of the one at $ja$.
:::
:::

::: check
given: b = 1 | 2 | 3
answer: -pi*b/(1 + b^2)
tolerance: 0.5%

## What is $\text{PV}\int_{-\infty}^{\infty}\frac{dx}{(x - \given{b})(x^2 + 1)}$?

::: right
Right. $\frac{2\pi j}{2j(j - b)} + \frac{\pi j}{b^2 + 1} = -\frac{\pi b}{1 + b^2}$, real as it must be.
:::

::: misses
- [pi*b/(1 + b^2)] Check the sign: $\frac{1}{j - b} = \frac{-b - j}{1 + b^2}$.
- [any] Full residue at j, half residue at b.
:::
:::

::: check
kind: parts
given: b = 2 | 4; a = 0.25 | 0.5

## Keyhole integrals with $a$ = {a}.

::: part
answer: b^(a - 1)*pi/sin(pi*a)
tolerance: 0.5%

### What is $\int_0^\infty\frac{x^{a-1}}{x + \given{b}}dx$?

::: misses
- [pi/sin(pi*a)] That's b = 1; scale with $x = bt$.
- [any] $b^{a-1}\frac{\pi}{\sin\pi a}$.
:::
:::

::: part
answer: pi*(1 - a)/sin(pi*a)
tolerance: 0.5%

### What is $\int_0^\infty\frac{x^{a-1}}{(1 + x)^2}dx$? (The pole at −1 is double.)

::: misses
- [pi/sin(pi*a)] The double pole's residue is the derivative of $z^{a-1}$ at −1.
- [any] The residue is $(a - 1)(-1)^{a-2}$ on this branch.
:::
:::
:::

::: check
kind: choice

## Why don't the integrals along the top and bottom edges of a keyhole cancel?

- [ ] They run in the same direction
- [x] The integrand takes different values on the two edges, because of the branch cut
- [ ] The small circle adds to one of them
- [ ] They do cancel, and the answer comes from the residues alone

::: right
Right. $z^{a-1}$ comes back multiplied by $e^{2\pi ja}$ after a full turn, so the edges leave $(1 - e^{2\pi ja})I$.
:::

::: misses
- [1] They run in opposite directions; it's the integrand that changes.
- [3] The small circle's contribution goes to zero.
- [4] If they canceled, the method would give 0 = the residue sum, which is false.
:::
:::

::: check
kind: derivation
vars: a = 0.1..0.9

## Work out $\int_0^\infty\frac{x^{a-1}}{1 + x}dx$ on the branch $0 \le \arg z < 2\pi$.

::: step
answer: -cos(pi*a)

### The residue at $z = -1 = e^{j\pi}$ is $e^{j\pi(a - 1)}$. What is its real part?
:::

::: step
answer: pi/sin(pi*a)

### Solve $(1 - e^{2\pi ja})I = 2\pi je^{j\pi(a-1)}$. What is I?
:::

::: right
Right. $I = \frac{-2\pi je^{j\pi a}}{1 - e^{2\pi ja}} = \frac{2\pi j}{e^{j\pi a} - e^{-j\pi a}} = \frac{\pi}{\sin\pi a}$.
:::
:::

::: explain
## Why does a pole on the path count half in a principal value?

::: model
Near a simple pole at a, $f(z) \approx \frac{c}{z - a}$. Skipping a gap of width 2ε around a and bridging it with a half circle of radius ε above the pole turns the path into one the residue theorem can handle. Along that half circle, $z - a = \varepsilon e^{j\theta}$ with θ running from π down to 0, so $\int\frac{c\,dz}{z - a} = c\int_\pi^0j\,d\theta = -\pi jc$, whatever ε is. A full circle around the pole would give $2\pi jc$; the half circle gives exactly half of it. Moving that term to the other side of the equation, the principal value picks up $+\pi jc$: half the residue, as if the pole sat halfway inside.
:::
:::

::: practice

::: check
given: a = 0.2 | 0.25 | 0.3 | 0.6 | 0.75 | 0.8
answer: pi/sin(pi*a)
tolerance: 0.5%

## $\int_0^\infty\frac{x^{a-1}}{1 + x}dx$ for a = {a}?

::: misses
- [any] $\frac{\pi}{\sin\pi a}$.
:::
:::

::: check
given: n = 3..10 int
answer: (pi/n)/sin(pi/n)
tolerance: 0.5%

## $\int_0^\infty\frac{dx}{1 + x^{\given{n}}}$?

::: misses
- [any] $\frac{\pi/n}{\sin(\pi/n)}$.
:::
:::

::: check
given: b = 0.25 | 0.5 | 1 | 2 | 3 | 4
answer: -pi*b/(1 + b^2)
tolerance: 0.5%

## $\text{PV}\int\frac{dx}{(x - \given{b})(x^2 + 1)}$?

::: misses
- [any] Half the residue on the axis, all of the one at j.
:::
:::
:::
