MATH-334 · Lesson 6 of 12 · 28 min
Contour integrals
The second half of complex analysis is integration, and it is here that the subject becomes truly surprising. In real calculus we integrate over intervals. In the complex plane there are many ways to get from one point to another, so a complex integral is taken along a curve, called a contour. This lesson defines contour integrals, computes the most important examples, proves the basic estimate used throughout the rest of the course, and shows when an integral depends only on the endpoints of the path. The single integral \(\oint_{|z| = 1}\frac{dz}{z} = 2\pi i\), computed below, is the seed from which Cauchy's theorem, the integral formula and the residue theorem all grow.
Curves and contours
A parametrized curve is a continuous function \(\gamma : [a, b] \to \mathbb{C}\), \(\gamma(t) = x(t) + iy(t)\). It is smooth if \(\gamma'(t) = x'(t) + iy'(t)\) exists, is continuous, and is never zero. A contour is a finite chain of smooth curves joined end to end: a piecewise smooth curve. The curve is closed if \(\gamma(a) = \gamma(b)\), and simple if it does not cross itself (apart from the endpoints of a closed curve). A simple closed curve is a Jordan curve; by the Jordan curve theorem it divides the plane into a bounded inside and an unbounded outside. The positive orientation of a simple closed contour is anticlockwise, keeping the inside on the left.
The standard building blocks are:
The line segment from \(z_1\) to \(z_2\): \(\gamma(t) = z_1 + t(z_2 - z_1)\), \(0 \le t \le 1\), with \(\gamma'(t) = z_2 - z_1\).
The circle of radius \(r\) about \(z_0\), positively oriented: \(\gamma(t) = z_0 + re^{it}\), \(0 \le t \le 2\pi\), with \(\gamma'(t) = ire^{it}\).
The reverse of a curve \(\gamma\), written \(-\gamma\), traverses it backwards: \((-\gamma)(t) = \gamma(a + b - t)\).
The definition
Let \(f\) be continuous on a smooth curve \(\gamma : [a, b] \to \mathbb{C}\). The contour integral of \(f\) along \(\gamma\) is
\[\int_\gamma f(z)\,dz = \int_a^b f(\gamma(t))\,\gamma'(t)\,dt.\]
The right side is an integral of a complex-valued function of a real variable, computed by integrating the real and imaginary parts separately. For a contour made of several smooth pieces, add the integrals over the pieces. Heuristically, \(dz = \gamma'(t)\,dt\), just as in a substitution. The definition is a limit of Riemann sums \(\sum f(z_k)(z_{k+1} - z_k)\) over points along the curve, and it is exactly a line integral from MATH-209: writing \(f = u + iv\) and \(dz = dx + i\,dy\),
\[\int_\gamma f\,dz = \int_\gamma (u\,dx - v\,dy) + i\int_\gamma (v\,dx + u\,dy).\]
The integral has the expected properties. It is linear in \(f\). It is additive over a chain of curves. Reversing the curve changes its sign: \(\int_{-\gamma} f\,dz = -\int_\gamma f\,dz\). And it does not depend on the parametrization: if \(\gamma\) is reparametrized by an increasing smooth change of variable \(t = \phi(s)\), the chain rule and the real substitution rule give the same value.
The fundamental example
Let \(C_r\) be the positively oriented circle \(|z - z_0| = r\) and \(n\) an integer. With \(z = z_0 + re^{it}\) and \(dz = ire^{it}\,dt\),
\[\oint_{C_r}(z - z_0)^n\,dz = \int_0^{2\pi} r^ne^{int}\,ire^{it}\,dt = ir^{n+1}\int_0^{2\pi}e^{i(n+1)t}\,dt.\]
If \(n \ne -1\), the last integral is \(\frac{e^{i(n+1)t}}{i(n+1)}\Big|_0^{2\pi} = 0\). If \(n = -1\) the integrand is 1 and the integral is \(2\pi\). Therefore
\[\oint_{|z - z_0| = r}(z - z_0)^n\,dz = \begin{cases} 2\pi i & n = -1, \\ 0 & n \ne -1. \end{cases}\]
The answer does not depend on the radius. Every power integrates to zero round the circle except \(\frac{1}{z - z_0}\), which gives \(2\pi i\). This one computation, together with power series, underlies the residue theorem of lesson 10.
Integrals that depend on the path
Integrate \(f(z) = \bar{z}\) from 0 to \(1 + i\) along two paths. Along the segment \(z = t(1 + i)\), \(0 \le t \le 1\): \(\int_0^1 t(1 - i)(1 + i)\,dt = \int_0^1 2t\,dt = 1\). Along the path that goes first from 0 to 1 and then up to \(1 + i\): the first leg gives \(\int_0^1 t\,dt = \frac{1}{2}\); on the second leg \(z = 1 + it\), \(dz = i\,dt\), giving \(\int_0^1 (1 - it)i\,dt = i + \frac{1}{2}\). The total is \(1 + i\). The two answers differ, so the integral of \(\bar{z}\) depends on the path. Compare \(f(z) = z^2\): along any path from 0 to \(1 + i\) we will get \(\frac{(1 + i)^3}{3} = \frac{-2 + 2i}{3}\). The difference is that \(z^2\) is analytic and has an antiderivative.
Antiderivatives and path independence
Theorem (fundamental theorem for contour integrals). Suppose \(f\) is continuous on a domain \(D\) and has an antiderivative \(F\) there, meaning \(F' = f\) on \(D\). Then for every contour \(\gamma\) in \(D\) from \(z_1\) to \(z_2\),
\[\int_\gamma f(z)\,dz = F(z_2) - F(z_1).\]
Proof. For a smooth piece, the chain rule gives \(\frac{d}{dt}F(\gamma(t)) = F'(\gamma(t))\gamma'(t) = f(\gamma(t))\gamma'(t)\). Applying the real fundamental theorem of calculus to the real and imaginary parts, \(\int_a^b f(\gamma(t))\gamma'(t)\,dt = F(\gamma(b)) - F(\gamma(a))\). For a contour, the intermediate values telescope. \(\square\)
Consequently, if \(f\) has an antiderivative on \(D\), the integral of \(f\) round every closed contour in \(D\) is zero. So every polynomial integrates to zero round any closed contour, and \((z - z_0)^n\) for \(n \ne -1\) integrates to zero round any closed contour avoiding \(z_0\), since \(\frac{(z - z_0)^{n+1}}{n + 1}\) is an antiderivative.
Conversely, \(\frac{1}{z}\) has no antiderivative on the punctured plane, because its integral round the unit circle is \(2\pi i \ne 0\). It does have an antiderivative on the slit plane, namely \(\operatorname{Log} z\), and on any other domain where a branch of the logarithm exists. The value \(2\pi i\) is the jump in the logarithm on going once round the origin: \(\oint \frac{dz}{z}\) measures the change in \(\log z\), that is \(i\) times the change in \(\arg z\).
The converse of the theorem also holds. If \(f\) is continuous on a domain \(D\) and its integral round every closed contour in \(D\) is zero, then integrals in \(D\) depend only on the endpoints, and fixing \(z_1\) and setting \(F(z) = \int_{z_1}^{z} f(w)\,dw\) along any path defines an antiderivative. The proof that \(F' = f\) uses the estimate below on a short segment from \(z\) to \(z + h\).
The winding number
The integral of \(\frac{1}{z - z_0}\) has a geometric meaning for every closed contour, not only for circles. Let \(\gamma\) be a closed contour not passing through \(z_0\). Along \(\gamma\) we can choose the argument of \(\gamma(t) - z_0\) continuously, as a function \(\theta(t)\), and the modulus \(\rho(t) = |\gamma(t) - z_0|\) is continuous too. Locally \(\ln\rho(t) + i\theta(t)\) is a branch of \(\log(z - z_0)\), whose derivative is \(\frac{1}{z - z_0}\), so
\[\oint_\gamma\frac{dz}{z - z_0} = \Big[\ln\rho(t) + i\theta(t)\Big]_a^b = i\big(\theta(b) - \theta(a)\big),\]
because \(\rho\) returns to its starting value. The total change of argument round a closed curve is a multiple of \(2\pi\), so the integral is \(2\pi i\) times an integer. That integer,
\[n(\gamma, z_0) = \frac{1}{2\pi i}\oint_\gamma\frac{dz}{z - z_0},\]
is the winding number of \(\gamma\) about \(z_0\): the net number of anticlockwise turns the curve makes round the point. A positively oriented circle winds once round each point inside and zero times round each point outside; traversing it twice gives 2, clockwise gives \(-1\). The winding number is constant on each connected piece of the complement of \(\gamma\) and is 0 on the unbounded piece. It will appear in the general forms of Cauchy's integral formula and the residue theorem.
Worked problem
Half-turns of the logarithm
Compute \(\int \frac{dz}{z}\) from 1 to \(-1\) along the upper and the lower halves of the unit circle.
Show solution
- Upper half: \(z = e^{it}\), \(0 \le t \le \pi\). The integral is \(\int_0^\pi i\,dt = i\pi\).
- Lower half: \(z = e^{-it}\), \(0 \le t \le \pi\), with \(dz = -ie^{-it}\,dt\). The integral is \(\int_0^\pi -i\,dt = -i\pi\).
- The upper path minus the lower path is the whole circle traversed anticlockwise, and indeed \(i\pi - (-i\pi) = 2\pi i\).
Answer: \(i\pi\) and \(-i\pi\). Each equals the change in a continuous branch of \(\log z\) along the path: the argument rises from 0 to \(\pi\) or falls from 0 to \(-\pi\).
The ML inequality
For a complex-valued function \(g\) on \([a, b]\), \(\big|\int_a^b g(t)\,dt\big| \le \int_a^b |g(t)|\,dt\). (Write the integral as \(Re^{i\phi}\); then \(R = \int \operatorname{Re}(e^{-i\phi}g)\,dt \le \int |g|\,dt\).) The length of a smooth curve is \(L(\gamma) = \int_a^b |\gamma'(t)|\,dt\). Combining:
Theorem (ML inequality). If \(|f(z)| \le M\) on \(\gamma\), then \(\big|\int_\gamma f(z)\,dz\big| \le M\,L(\gamma)\).
This crude estimate is used constantly. It bounds the error terms in proofs, and it is how we show that the integrals over large semicircles vanish when evaluating real integrals in lesson 11.
Worked problem
Bounding an integral
Show that \(\big|\int_{C_R}\frac{dz}{z^2 + 1}\big| \le \frac{2\pi R}{R^2 - 1}\) for the circle \(|z| = R > 1\), and deduce the limit as \(R \to \infty\).
Show solution
- On \(|z| = R\), the reverse triangle inequality gives \(|z^2 + 1| \ge |z|^2 - 1 = R^2 - 1\).
- So \(\big|\frac{1}{z^2 + 1}\big| \le M = \frac{1}{R^2 - 1}\) on the circle, whose length is \(L = 2\pi R\).
- By the ML inequality the integral has modulus at most \(\frac{2\pi R}{R^2 - 1}\), which tends to 0.
Answer: The integral tends to 0 as \(R \to \infty\). In fact, by Cauchy's theorem and the residue theorem, it equals 0 for every \(R > 1\).
Worked problem
A computation along a segment
Compute \(\int_\gamma z\,dz\) and \(\int_\gamma \operatorname{Re} z\,dz\) along the segment from 0 to \(2 + i\).
Show solution
- Parametrize \(z = t(2 + i)\), \(dz = (2 + i)\,dt\), \(0 \le t \le 1\).
- \(\int z\,dz = (2 + i)^2\int_0^1 t\,dt = \frac{3 + 4i}{2}\), agreeing with \(\frac{z^2}{2}\big|_0^{2 + i}\).
- \(\int \operatorname{Re} z\,dz = \int_0^1 2t(2 + i)\,dt = 2 + i\).
Answer: \(\frac{3}{2} + 2i\) and \(2 + i\). The first depends only on the endpoints; the second, of a non-analytic function, would change along a different path.
import cmath, math
def contour_integral(f, gamma, dgamma, a, b, n=2000):
"""Composite Simpson's rule for the integral of f(gamma(t)) gamma'(t) dt on [a, b]."""
h = (b - a) / n
s = 0
for k in range(n + 1):
t = a + k*h
w = 1 if k in (0, n) else (4 if k % 2 else 2)
s += w * f(gamma(t)) * dgamma(t)
return s * h / 3
circle = lambda t: cmath.exp(1j*t) # unit circle
dcircle = lambda t: 1j*cmath.exp(1j*t)
for n in [-3, -2, -1, 0, 1, 2]:
val = contour_integral(lambda z: z**n, circle, dcircle, 0, 2*math.pi)
print(f"integral of z^{n:+d} round |z|=1: {val.real:+.10f}{val.imag:+.10f}i")
print("2*pi*i =", 2j*math.pi)
# Path dependence of conj(z) from 0 to 1+i.
seg = contour_integral(lambda z: z.conjugate(), lambda t: t*(1+1j), lambda t: 1+1j, 0, 1)
leg1 = contour_integral(lambda z: z.conjugate(), lambda t: t, lambda t: 1, 0, 1)
leg2 = contour_integral(lambda z: z.conjugate(), lambda t: 1+1j*t, lambda t: 1j, 0, 1)
print("conj(z): straight", seg, " via 1:", leg1 + leg2)
seg2 = contour_integral(lambda z: z*z, lambda t: t*(1+1j), lambda t: 1+1j, 0, 1)
print("z^2 straight:", seg2, " exact (1+i)^3/3 =", (1+1j)**3/3)
# ML bound for 1/(z^2+1) on |z| = R.
for R in [2, 10, 100]:
val = contour_integral(lambda z: 1/(z*z+1), lambda t: R*cmath.exp(1j*t), lambda t: 1j*R*cmath.exp(1j*t), 0, 2*math.pi)
print(f"R={R}: |integral| = {abs(val):.2e}, ML bound = {2*math.pi*R/(R*R-1):.2e}")integral of z^-3 round |z|=1: +0.0000000000+0.0000000000i integral of z^-2 round |z|=1: +0.0000000000+0.0000000000i integral of z^-1 round |z|=1: +0.0000000000+6.2831853072i integral of z^+0 round |z|=1: +0.0000000000+0.0000000000i integral of z^+1 round |z|=1: -0.0000000000+0.0000000000i integral of z^+2 round |z|=1: +0.0000000000-0.0000000000i 2*pi*i = 6.283185307179586j conj(z): straight (1.0000000000000002+0j) via 1: (1.0000000000000002+1j) z^2 straight: (-0.6666666666666669+0.6666666666666669j) exact (1+i)^3/3 = (-0.6666666666666666+0.6666666666666666j) R=2: |integral| = 1.14e-16, ML bound = 4.19e+00 R=10: |integral| = 2.63e-17, ML bound = 6.35e-01 R=100: |integral| = 6.78e-18, ML bound = 6.28e-02
Common mistakes
Common mistakes
MistakeForgetting the factor \(\gamma'(t)\) when substituting the parametrization.
Instead\(dz = \gamma'(t)\,dt\); for the unit circle that is \(ie^{it}\,dt\).
MistakeAssuming every contour integral depends only on the endpoints.
InsteadThat holds when the integrand has an antiderivative on a domain containing the path; \(\bar{z}\) is a counterexample.
MistakeUsing \(\operatorname{Log} z\) as an antiderivative of \(\frac{1}{z}\) along a path crossing the negative real axis.
InsteadAn antiderivative must be valid on a domain containing the whole path; use a different branch or split the path.
MistakeBounding \(|z^2 + 1|\) above when you need a lower bound.
InsteadFor an upper bound on \(\frac{1}{|z^2 + 1|}\), use \(|z^2 + 1| \ge |z|^2 - 1\).
MistakeTraversing a circle clockwise without changing the sign.
InsteadPositive orientation is anticlockwise; reversing a curve negates the integral.
Summary and key terms
- A contour integral is \(\int_\gamma f\,dz = \int_a^b f(\gamma(t))\gamma'(t)\,dt\), independent of parametrization and negated by reversal.
- Round any circle about \(z_0\), \((z - z_0)^n\) integrates to \(2\pi i\) for \(n = -1\) and to 0 otherwise.
- If \(f\) has an antiderivative \(F\) on a domain, integrals depend only on endpoints and closed integrals vanish.
- \(\frac{1}{z}\) has no antiderivative on the punctured plane; its circle integral \(2\pi i\) records the change in \(\log z\).
- The ML inequality \(|\int_\gamma f\,dz| \le ML\) bounds integrals by the maximum modulus times the length.
- Contour
- A piecewise smooth curve made of finitely many smooth pieces.
- Positive orientation
- Anticlockwise traversal of a simple closed curve, keeping the inside on the left.
- Antiderivative
- A function \(F\) analytic on a domain with \(F' = f\) there.
- Arc length
- \(L(\gamma) = \int_a^b |\gamma'(t)|\,dt\).
- ML inequality
- \(|\int_\gamma f\,dz| \le M\,L(\gamma)\) when \(|f| \le M\) on \(\gamma\).
Practice problems
Work each problem on paper first, then reveal the answer to check.
Compute \(\oint_{|z| = 2}\frac{dz}{z^3}\).
Show answer
0, since \(-\frac{1}{2z^2}\) is an antiderivative on the punctured plane.
Compute \(\int_\gamma \bar{z}\,dz\) round the positively oriented unit circle.
Show answer
\(\int_0^{2\pi}e^{-it}ie^{it}\,dt = 2\pi i\). (Note \(\bar{z} = \frac{1}{z}\) on the unit circle.)
Compute \(\int_\gamma e^z\,dz\) along any contour from 0 to \(i\pi\).
Show answer
\(e^{i\pi} - e^0 = -2\).
Find the length of the curve \(\gamma(t) = e^{(1 + i)t}\), \(0 \le t \le 1\), and bound \(\int_\gamma z\,dz\).
Show answer
\(|\gamma'| = \sqrt{2}e^t\), so \(L = \sqrt{2}(e - 1)\); \(|z| \le e\), so the bound is \(\sqrt{2}e(e - 1)\).
Show that \(\oint_{|z - 2| = 1}\frac{dz}{z} = 0\).
Show answer
The circle lies in the right half-plane, where \(\operatorname{Log} z\) is an antiderivative.
Find the winding number about 0 of \(\gamma(t) = 2e^{3it}\), \(0 \le t \le 2\pi\).
Show answer
The curve goes three times anticlockwise round the circle of radius 2, so \(n(\gamma, 0) = 3\); directly, \(\frac{1}{2\pi i}\int_0^{2\pi}3i\,dt = 3\).
Compute \(\oint_{|z| = 2}\frac{dz}{z - 1}\) and \(\oint_{|z| = 2}\frac{dz}{z - 3}\).
Show answer
\(2\pi i\), since the circle winds once round 1; and 0, since 3 lies outside the circle, in the unbounded component where the winding number is 0.
Lesson quiz · 5 questions
Score 60% or more to complete this lesson.
Create a free account to save your progress, take quizzes and earn a certificate.