MATH-334 · Lesson 4 of 12 · 23 min

Analytic functions and the Cauchy–Riemann equations

Lesson 3 showed that complex differentiability is a demanding condition: \(\bar{z}\) fails it everywhere and \(|z|^2\) passes only at the origin. Checking the definition directly every time would be tedious. In this lesson we turn the condition into a pair of partial differential equations for the real and imaginary parts, the Cauchy–Riemann equations. They give a quick test for analyticity, a way to compute derivatives, and a bridge to the harmonic functions of physics: the real part of an analytic function is a steady-state temperature, an electrostatic potential or the velocity potential of an ideal fluid.

A little history

The equations appear in the work of d'Alembert on fluid flow in the 1750s and in Euler's papers of the 1770s on integration, where Euler used complex functions to evaluate real integrals. Augustin-Louis Cauchy made them the foundation of a theory of functions in his memoirs from 1814 onward, and Bernhard Riemann's doctoral dissertation of 1851 took the opposite route: it defined a complex function to be one whose real and imaginary parts satisfy these equations, and developed the geometric theory of mappings and Riemann surfaces from that starting point. The pair of names attached to the equations honours both approaches.

Deriving the equations

Write \(f(z) = u(x, y) + iv(x, y)\) and suppose \(f'(z_0)\) exists, where \(z_0 = x_0 + iy_0\). Then the difference quotient has the same limit along every path, in particular along the two coordinate directions.

Take \(h\) real, \(h = t \to 0\). Then

\[f'(z_0) = \lim_{t \to 0} \frac{u(x_0 + t, y_0) - u(x_0, y_0)}{t} + i\,\frac{v(x_0 + t, y_0) - v(x_0, y_0)}{t} = u_x + iv_x.\]

Take \(h\) imaginary, \(h = it\). Dividing by \(it\) multiplies by \(-i\), so

\[f'(z_0) = \lim_{t \to 0} \frac{1}{i}\Big(\frac{u(x_0, y_0 + t) - u(x_0, y_0)}{t} + i\,\frac{v(x_0, y_0 + t) - v(x_0, y_0)}{t}\Big) = v_y - iu_y.\]

The two expressions must agree. Comparing real and imaginary parts gives the Cauchy–Riemann equations

\[u_x = v_y, \qquad u_y = -v_x,\]

at \(z_0\), together with two formulas for the derivative: \(f'(z_0) = u_x + iv_x = v_y - iu_y\). So the equations are necessary for complex differentiability.

Check them on examples. For \(f(z) = z^2 = (x^2 - y^2) + i(2xy)\), \(u_x = 2x = v_y\) and \(u_y = -2y = -v_x\). They hold everywhere, and \(f' = u_x + iv_x = 2x + 2iy = 2z\). For \(f(z) = \bar{z} = x - iy\), \(u_x = 1\) but \(v_y = -1\): they fail everywhere. For \(|z|^2 = x^2 + y^2\), \(u_x = 2x\), \(v_y = 0\), \(u_y = 2y\), \(v_x = 0\); they hold only when \(x = y = 0\), matching lesson 3.

A sufficient condition

The equations alone are not quite enough. The classical counterexample is \(f(z) = \sqrt{|xy|}\), which satisfies the equations at the origin (all four partial derivatives are 0 there) but is not differentiable at 0: along the line \(y = x\) the quotient is \(\frac{|t|}{t(1 + i)}\), which has no limit. What is missing is a genuine two-variable differentiability of \(u\) and \(v\). The standard theorem is:

Theorem. Suppose \(u\) and \(v\) have continuous first partial derivatives on an open set \(U\) and satisfy the Cauchy–Riemann equations there. Then \(f = u + iv\) is analytic on \(U\), and \(f' = u_x + iv_x\).

Proof. Fix \(z_0\) in \(U\) and write \(h = s + it\). Because the partial derivatives are continuous, \(u\) and \(v\) are differentiable as functions of two variables (MATH-209), so

\[u(x_0 + s, y_0 + t) - u(x_0, y_0) = u_x s + u_y t + \varepsilon_1 |h|, \qquad v(x_0 + s, y_0 + t) - v(x_0, y_0) = v_x s + v_y t + \varepsilon_2 |h|,\]

with \(\varepsilon_1, \varepsilon_2 \to 0\) as \(h \to 0\) and the partials evaluated at \((x_0, y_0)\). Using \(u_y = -v_x\) and \(v_y = u_x\), the change in \(f\) is

\[(u_x s - v_x t) + i(v_x s + u_x t) + (\varepsilon_1 + i\varepsilon_2)|h| = (u_x + iv_x)(s + it) + (\varepsilon_1 + i\varepsilon_2)|h|.\]

Dividing by \(h\), the difference quotient equals \(u_x + iv_x\) plus a term of modulus at most \(|\varepsilon_1| + |\varepsilon_2|\), which tends to 0. So \(f'(z_0) = u_x + iv_x\). \(\square\)

Worked problem

Testing a function for analyticity

Show that \(f(z) = e^x(\cos y + i\sin y)\) is entire and find its derivative.

Show solution
  1. Here \(u = e^x\cos y\) and \(v = e^x\sin y\), with continuous partial derivatives everywhere.
  2. \(u_x = e^x\cos y = v_y\) and \(u_y = -e^x\sin y = -v_x\). The equations hold on the whole plane.
  3. By the theorem \(f\) is entire, and its derivative is \(u_x + iv_x = e^x\cos y + ie^x\sin y\), which is \(f\) itself.

Answer: This function is the complex exponential \(e^z\), studied in lesson 5. It is its own derivative, as in real calculus.

Worked problem

Differentiable at a single point

Find all points where \(f(z) = x^3 + i(1 - y)^3\) is complex differentiable, and the derivative there.

Show solution
  1. Here \(u = x^3\) and \(v = (1 - y)^3\). All partial derivatives are polynomials, hence continuous, so \(f\) is differentiable exactly where the equations hold.
  2. \(u_x = 3x^2\) and \(v_y = -3(1 - y)^2\). Equality forces \(3x^2 + 3(1 - y)^2 = 0\), so \(x = 0\) and \(y = 1\).
  3. \(u_y = 0\) and \(v_x = 0\), so the second equation holds everywhere.
  4. At \(z = i\) the derivative is \(u_x + iv_x = 0\).

Answer: Differentiable only at \(z = i\), with derivative 0; analytic nowhere, because a single point contains no open disk.

The equations in polar form

For functions naturally written in polar coordinates, \(z = re^{i\theta}\), there is a polar version. If \(f = u(r, \theta) + iv(r, \theta)\) with continuous partials, then away from the origin the Cauchy–Riemann equations are equivalent to

\[u_r = \frac{1}{r}v_\theta, \qquad v_r = -\frac{1}{r}u_\theta,\]

and then \(f'(z) = e^{-i\theta}(u_r + iv_r)\). These follow from the chain rule, \(x = r\cos\theta\), \(y = r\sin\theta\). As a check, \(f(z) = z^n = r^n\cos n\theta + ir^n\sin n\theta\) gives \(u_r = nr^{n-1}\cos n\theta = \frac{1}{r}v_\theta\) and \(v_r = nr^{n-1}\sin n\theta = -\frac{1}{r}u_\theta\), and \(f' = e^{-i\theta}nr^{n-1}e^{in\theta} = nz^{n-1}\). The polar form will be used in lesson 5 to show that the logarithm is analytic.

Consequences: rigidity

The equations already force strong conclusions. Suppose \(f\) is analytic on a domain \(D\) (an open connected set).

If \(f' = 0\) on \(D\), then \(u_x = u_y = v_x = v_y = 0\), so \(u\) and \(v\) are constant along every horizontal and vertical segment in \(D\); since any two points of a domain can be joined by such a staircase path, \(f\) is constant.

If \(f\) is real-valued on \(D\), then \(v = 0\), so \(u_x = v_y = 0\) and \(u_y = -v_x = 0\); again \(f\) is constant. An analytic function cannot take only real values unless it is constant.

If \(|f|\) is constant on \(D\), then \(f\) is constant. If \(|f| = 0\) this is clear. Otherwise \(u^2 + v^2 = c > 0\); differentiating, \(uu_x + vv_x = 0\) and \(uu_y + vv_y = 0\). Substituting the Cauchy–Riemann equations gives \(uu_x - vu_y = 0\) and \(uu_y + vu_x = 0\). This linear system for \(u_x, u_y\) has determinant \(u^2 + v^2 = c \ne 0\), so \(u_x = u_y = 0\), and then \(v_x = v_y = 0\).

These are the first signs of a theme. Real differentiable functions are flexible: they can be changed in one place without affecting another. Analytic functions are rigid: local information controls global behaviour.

Harmonic functions

Suppose \(f = u + iv\) is analytic and, as we will prove in lesson 8, \(u\) and \(v\) have continuous second partial derivatives. Differentiate the first equation with respect to \(x\) and the second with respect to \(y\): \(u_{xx} = v_{yx}\) and \(u_{yy} = -v_{xy}\). Mixed partials are equal, so

\[\Delta u = u_{xx} + u_{yy} = 0,\]

and similarly \(\Delta v = 0\). A function satisfying Laplace's equation is called harmonic. So the real and imaginary parts of an analytic function are harmonic. When \(u\) and \(v\) are related by the Cauchy–Riemann equations, \(v\) is called a harmonic conjugate of \(u\).

Geometrically the level curves of \(u\) and \(v\) are orthogonal wherever \(f' \ne 0\). The gradients are \(\nabla u = (u_x, u_y)\) and \(\nabla v = (v_x, v_y) = (-u_y, u_x)\), and their dot product is \(-u_xu_y + u_yu_x = 0\). In physics, if \(u\) is an electrostatic potential then its level curves are equipotentials and the level curves of \(v\) are the field lines; for an ideal fluid, \(u\) is the velocity potential and \(v\) the stream function, whose level curves are the streamlines. Electrical engineering texts often write \(j\) for the imaginary unit, and much of AC circuit theory and two-dimensional potential theory rests on exactly this structure.

Level curves of u = x squared minus y squared, a family of hyperbolas, and of v = 2xy, a second family of hyperbolas rotated by 45 degrees, crossing the first family at right angles.
Level curves of the real and imaginary parts of z squared meet at right angles

Finding a harmonic conjugate

Given a harmonic \(u\) on a simply connected domain, a harmonic conjugate exists and can be found by integrating the Cauchy–Riemann equations. Take \(u = x^3 - 3xy^2\), which satisfies \(u_{xx} + u_{yy} = 6x - 6x = 0\).

From \(v_y = u_x = 3x^2 - 3y^2\), integrate in \(y\): \(v = 3x^2y - y^3 + g(x)\) for some function \(g\).

From \(v_x = -u_y = 6xy\): differentiating the expression for \(v\) gives \(6xy + g'(x) = 6xy\), so \(g\) is constant.

So \(v = 3x^2y - y^3 + C\), and \(f = u + iv = z^3 + iC\). On a domain that is not simply connected the conjugate may fail to exist globally: \(u = \ln|z|\) is harmonic on the punctured plane, but its would-be conjugate is the argument \(\theta\), which cannot be defined continuously all the way round the origin. This is our first meeting with the multivaluedness of the logarithm, the subject of the next lesson.

The Wirtinger derivative

A useful shorthand: treat \(z\) and \(\bar{z}\) as independent variables, with \(x = \frac{z + \bar{z}}{2}\) and \(y = \frac{z - \bar{z}}{2i}\), and define

\[\frac{\partial f}{\partial \bar{z}} = \frac{1}{2}\Big(\frac{\partial f}{\partial x} + i\frac{\partial f}{\partial y}\Big).\]

A short computation shows \(\frac{\partial f}{\partial \bar{z}} = \frac{1}{2}\big((u_x - v_y) + i(v_x + u_y)\big)\), so the Cauchy–Riemann equations say exactly \(\frac{\partial f}{\partial \bar{z}} = 0\). Informally, an analytic function is one that depends on \(z\) alone and not on \(\bar{z}\). That is why \(z^2\), \(e^z\) and \(\frac{1}{z}\) pass, while \(\bar{z}\), \(|z|^2 = z\bar{z}\) and \(\operatorname{Re} z = \frac{z + \bar{z}}{2}\) fail.

Checking the Cauchy–Riemann equations and harmonicity by finite differences
import cmath

def partials(f, z, h=1e-6):
    fx = (f(z + h) - f(z - h)) / (2*h)          # derivative along the real direction
    fy = (f(z + 1j*h) - f(z - 1j*h)) / (2*h)   # derivative along the imaginary direction
    return fx, fy

def cr_report(name, f, z):
    fx, fy = partials(f, z)
    ux, vx, uy, vy = fx.real, fx.imag, fy.real, fy.imag
    print(f"{name:10s} at {z}: ux-vy = {ux-vy:+.2e}, uy+vx = {uy+vx:+.2e}, x-derivative {fx:.5f}")

z = 0.7 + 0.4j
cr_report("z^3", lambda w: w**3, z)
cr_report("exp", cmath.exp, z)
cr_report("1/z", lambda w: 1/w, z)
cr_report("conj", lambda w: w.conjugate(), z)
cr_report("|z|^2", lambda w: abs(w)**2, z)
print("exact 3z^2 =", 3*z**2, " exact -1/z^2 =", -1/z**2)

# u = x^3 - 3xy^2 is harmonic: a five-point Laplacian should be about zero.
u = lambda x, y: x**3 - 3*x*y**2
h = 1e-3; x, y = 0.7, 0.4
lap = (u(x+h, y) + u(x-h, y) + u(x, y+h) + u(x, y-h) - 4*u(x, y)) / h**2
print(f"discrete Laplacian of u at (0.7, 0.4): {lap:.2e}")
Output
z^3        at (0.7+0.4j): ux-vy = +0.00e+00, uy+vx = +9.71e-11, x-derivative 0.99000+1.68000j
exp        at (0.7+0.4j): ux-vy = +5.55e-11, uy+vx = +0.00e+00, x-derivative 1.85479+0.78419j
1/z        at (0.7+0.4j): ux-vy = -5.55e-11, uy+vx = +1.67e-10, x-derivative -0.78107+1.32544j
conj       at (0.7+0.4j): ux-vy = +2.00e+00, uy+vx = +0.00e+00, x-derivative 1.00000+0.00000j
|z|^2      at (0.7+0.4j): ux-vy = +1.40e+00, uy+vx = +8.00e-01, x-derivative 1.40000
exact 3z^2 = (0.9899999999999998+1.6799999999999997j)  exact -1/z^2 = (-0.7810650887573964+1.3254437869822489j)
discrete Laplacian of u at (0.7, 0.4): 1.11e-10

Common mistakes

Common mistakes

  • MistakeConcluding that a function is analytic because the Cauchy–Riemann equations hold at one point.

    InsteadAnalytic needs differentiability on an open set; and even at a point, the equations need continuous partials (or real differentiability) to imply complex differentiability.

  • MistakeWriting the second equation as \(u_y = v_x\).

    InsteadThe sign matters: \(u_y = -v_x\). Check with \(z^2\): \(u_y = -2y\), \(v_x = 2y\).

  • MistakeAssuming every harmonic function on any domain has a harmonic conjugate there.

    InsteadOn a non-simply connected domain the conjugate may be multivalued, as with \(\ln|z|\) and \(\arg z\).

  • MistakeUsing \(f' = u_x + iu_y\).

    InsteadThe correct formulas are \(f' = u_x + iv_x = v_y - iu_y\).

  • MistakeForgetting the factor \(\frac{1}{r}\) in the polar equations.

    InsteadThey read \(u_r = \frac{1}{r}v_\theta\) and \(v_r = -\frac{1}{r}u_\theta\).

Summary and key terms

  • If \(f = u + iv\) is differentiable at a point then \(u_x = v_y\) and \(u_y = -v_x\) there, and \(f' = u_x + iv_x\).
  • Continuous partial derivatives satisfying these equations on an open set make \(f\) analytic.
  • Analytic functions with zero derivative, real values or constant modulus on a domain are constant.
  • Real and imaginary parts of analytic functions are harmonic, and their level curves are orthogonal.
  • A harmonic function on a simply connected domain has a harmonic conjugate, found by integrating the equations.
Cauchy–Riemann equations
\(u_x = v_y\) and \(u_y = -v_x\).
Harmonic function
A twice continuously differentiable function with \(u_{xx} + u_{yy} = 0\).
Harmonic conjugate
A function \(v\) such that \(u + iv\) is analytic.
Domain
A non-empty open connected subset of the plane.
Stream function
The imaginary part of a complex potential, whose level curves are streamlines of an ideal flow.

Practice problems

Work each problem on paper first, then reveal the answer to check.

  1. Use the Cauchy–Riemann equations to show \(f(z) = z^3\) is entire.

    Show answer

    \(u = x^3 - 3xy^2\), \(v = 3x^2y - y^3\); \(u_x = 3x^2 - 3y^2 = v_y\), \(u_y = -6xy = -v_x\), with continuous partials.

  2. Where is \(f(z) = x^2 + iy^2\) complex differentiable? Is it analytic anywhere?

    Show answer

    \(u_x = 2x\), \(v_y = 2y\), \(u_y = 0 = -v_x\). Differentiable exactly on the line \(y = x\), which contains no open set, so analytic nowhere.

  3. Show that \(u = e^x\sin y\) is harmonic and find a harmonic conjugate.

    Show answer

    \(u_{xx} + u_{yy} = e^x\sin y - e^x\sin y = 0\). Integrating gives \(v = -e^x\cos y\); indeed \(u + iv = -ie^z\).

  4. If \(f\) is analytic on a domain and \(\operatorname{Im} f\) is constant, show \(f\) is constant.

    Show answer

    \(v_x = v_y = 0\) so by the equations \(u_x = u_y = 0\); hence \(f' = 0\) and \(f\) is constant.

  5. Is \(u = x^2 + y^2\) the real part of an analytic function?

    Show answer

    No: \(\Delta u = 4 \ne 0\), so it is not harmonic.

Lesson quiz · 5 questions

Score 60% or more to complete this lesson.

Take the quiz