---
title: The Cauchy–Riemann equations
heading: The test for a complex derivative, in terms of u and v
eyebrow: A12 · Lesson 3 · The Cauchy–Riemann equations
xp: 40
---

::: hook
Lesson 2's definition of the complex derivative is hard to check directly: it asks a limit to agree from infinitely many directions. Comparing just two of them, along the real axis and along the imaginary axis, gives two equations between the partial derivatives of u and v, the **Cauchy–Riemann equations**. Together with continuous partial derivatives they're enough: a function that satisfies them is differentiable, and one that breaks them isn't. They're also the equations behind every two-dimensional field: they make u and v the potential and the flux function of the same field.
:::

::: play
- Two tiny segments leave the point $z_0$, one along the real direction and one along the imaginary direction, at right angles. The map is $f(z) = z^2 + k\bar z^2$; the solid curves are the segments' images.
- With k = 0, $f = z^2$ is analytic: the images still meet at 90° and have equal lengths (the readouts), because the map rotates and scales them alike.
- Raise k: the images skew and stretch differently, and the Cauchy–Riemann equations fail. A $\bar z$ term ruins differentiability.
:::
:::

```sim plot
view: complex
range: 2
slider: k = 0..1 step 0.05 = 0
slider: a = -1.5..1.5 step 0.05 = 1
slider: b = -1.5..1.5 step 0.05 = 0.5
curve: a + j*b + 0.3*u | over: u = 0..1 | dashed | color: ch2
curve: a + j*b + 0.3*j*u | over: u = 0..1 | dashed | color: ch3
curve: (a + j*b + 0.3*u)^2 + k*conj(a + j*b + 0.3*u)^2 | over: u = 0..1 | color: ch2
curve: (a + j*b + 0.3*j*u)^2 + k*conj(a + j*b + 0.3*j*u)^2 | over: u = 0..1 | color: ch3
dot: a + j*b | label: z₀
readout: angle between the images, ° = arg((2*j*(a + j*b) - 2*j*k*conj(a + j*b))/(2*(a + j*b) + 2*k*conj(a + j*b)))*180/pi
readout: their length ratio = abs((2*j*(a + j*b) - 2*j*k*conj(a + j*b))/(2*(a + j*b) + 2*k*conj(a + j*b)))
```

::: predict
## For $f = u + jv$, approaching along the real axis gives $f' = u_x + jv_x$. What does approaching along the imaginary axis give?

- [ ] $u_y + jv_y$
- [x] $v_y - ju_y$
- [ ] $u_x - jv_x$
- [ ] $-u_y + jv_y$

::: reveal
$v_y - ju_y$: with $h = j\Delta y$, the difference quotient is $(\Delta u + j\Delta v)/(j\Delta y) = -j\,u_y + v_y$. Setting it equal to $u_x + jv_x$ and matching real and imaginary parts gives the Cauchy–Riemann equations.
:::
:::

::: nameit
## The equations

A function $f = u + jv$ with continuous first partial derivatives is complex-differentiable at a point exactly when

$$\frac{\partial u}{\partial x} = \frac{\partial v}{\partial y}, \qquad \frac{\partial u}{\partial y} = -\frac{\partial v}{\partial x}$$

and then

$$f'(z) = u_x + j\,v_x = v_y - j\,u_y$$

## Using them

- To test a function: compute the four partials and compare.
- To find $f'$ without limits: $u_x + jv_x$.
- Writing x and y in terms of z and $\bar z$ ($x = (z + \bar z)/2$, $y = (z - \bar z)/2j$), the equations say $\partial f/\partial\bar z = 0$: an analytic function depends on z alone, never on $\bar z$.

## Geometry

The equations say the map stretches the real direction and the imaginary direction by the same amount and keeps them at right angles: the matrix of partials is a rotation times a scaling. That's the conformal property again.
:::

::: example
## Check $f(z) = z^3$.

::: solution
1. **Split into u and v.**
   $$\begin{aligned} u &= x^3 - 3xy^2 \\ v &= 3x^2y - y^3 \end{aligned}$$
2. **First equation.**
   $$\begin{aligned} u_x &= 3x^2 - 3y^2 \\ v_y &= 3x^2 - 3y^2 \end{aligned}$$
3. **Second equation.**
   $$\begin{aligned} u_y &= -6xy \\ -v_x &= -6xy \end{aligned}$$
   Both hold everywhere, so $z^3$ is analytic.
4. **The derivative.**
   $$\begin{aligned} f' &= u_x + jv_x \\ &= 3x^2 - 3y^2 + 6jxy \\ &= 3z^2 \end{aligned}$$

**Answer:** the Cauchy–Riemann equations hold everywhere, so $z^3$ is analytic, with $f' = 3z^2$.
:::
:::

::: example
## Is $f = x^2 + jy^2$ differentiable anywhere?

::: solution
1. **First equation.** $u_x = 2x$ and $v_y = 2y$ agree only on the line $y = x$.
2. **Second equation.** $u_y = 0 = -v_x$ always.
3. **Differentiable or analytic.** So it's differentiable on the line $y = x$ and nowhere else, which means it's analytic nowhere: analyticity needs a whole open region.

**Answer:** it's differentiable only on the line $y = x$, so it's analytic nowhere.
:::
:::

::: example
## In polar form the Cauchy–Riemann equations read $u_r = \frac1r v_\theta$ and $v_r = -\frac1r u_\theta$, with $f' = e^{-j\theta}(u_r + jv_r)$. Use them to check $\text{Log}\,z = \ln r + j\theta$ and find its derivative.

::: solution
1. **Name the parts.** Here $u = \ln r$ and $v = \theta$.
2. **First equation.** $u_r = \frac1r$ and $\frac1r v_\theta = \frac1r$, so it holds.
3. **Second equation.** $v_r = 0$ and $-\frac1r u_\theta = 0$, so it holds too, everywhere except the origin and the branch cut, where θ jumps.
4. **The derivative.**
   $$\begin{aligned} f' &= e^{-j\theta}\left(\frac1r + 0\right) \\ &= \frac{1}{re^{j\theta}} \\ &= \frac1z \end{aligned}$$
   the same as for the real logarithm.
5. **Why polar.** Polar form is the natural one for functions built from r and θ, where the Cartesian partials would be messy.

**Answer:** Log z satisfies both equations everywhere except the origin and the branch cut, and its derivative is $1/z$.
:::
:::

::: check
given: x = 1 | 2 | -1; y = 1 | -1 | 3
answer: 3*x^2 - 3*y^2
tolerance: 0

## For $f = z^3$, $u = x^3 - 3xy^2$. What's $\partial u/\partial x$ at $(\given{x}, \given{y})$? (By Cauchy–Riemann it equals $\partial v/\partial y$.)

::: right
Right. $3x^2 - 3y^2$ = {answer}.
:::

::: misses
- [3*x^2] Differentiate the $-3xy^2$ term too.
- [any] Not yet. Differentiate $x^3 - 3xy^2$ with respect to x.
:::
:::

::: check
given: x = 1 | 2 | -1; y = 1 | -1 | 3
answer: 6*x*y
tolerance: 0

## For $f = z^3$, $v = 3x^2y - y^3$. What's $\partial v/\partial x$ at $(\given{x}, \given{y})$? (It should equal $-\partial u/\partial y$.)

::: right
Right. $6xy$ = {answer}.
:::

::: misses
- [any] Not yet. Differentiate $3x^2y - y^3$ with respect to x.
:::
:::

::: check
given: ux = 2 | -3 | 0.5; vx = 1 | 4 | -2
answer: abs(ux + j*vx)
tolerance: 0.5%

## An analytic function has $u_x = \given{ux}$ and $v_x = \given{vx}$ at a point. What's $\lvert f'\rvert$ there, the local magnification?

::: right
Right. $\lvert u_x + jv_x\rvert$ = {answer}.
:::

::: misses
- [ux + vx] $f' = u_x + jv_x$ is complex; take its size.
- [any] Not yet. $f' = u_x + jv_x$.
:::
:::

::: check
given: a = 1 | 2 | 3; x = 1 | 2; y = 1 | 3
answer: 2*x - 2*a*y
tolerance: 0

## For $f = x^2 + jay^2$ (with a = {a}), what's $u_x - v_y$ at $(\given{x}, \given{y})$? (Zero would mean the first Cauchy–Riemann equation holds there.)

::: right
Right. $2x - 2ay$ = {answer}.
:::

::: misses
- [any] Not yet. $u = x^2$, $v = ay^2$.
:::
:::

::: check
given: x = 0.5 | 1 | 2; y = 0 | 1
answer: exp(x)*cos(y)
tolerance: 0.5%

## For $f = e^z$, $u = e^x\cos y$ and $v = e^x\sin y$. What's $u_x$ at $(\given{x}, \given{y})$, which is also the real part of $f'$?

::: right
Right. {answer}: $f' = e^z$ again.
:::

::: misses
- [exp(x)*sin(y)] That's $v_x$, the imaginary part.
- [any] Not yet. Differentiate $e^x\cos y$ with respect to x.
:::
:::

::: check
kind: choice

## Which pair (u, v) satisfies the Cauchy–Riemann equations everywhere?

- [ ] $u = x^2 + y^2$, $v = 2xy$
- [x] $u = x^2 - y^2$, $v = 2xy$
- [ ] $u = x$, $v = -y$
- [ ] $u = xy$, $v = x - y$

::: misses
- [1] $u_y = 2y$ but $-v_x = -2y$.
- [3] That's $\bar z$: $u_x = 1$ but $v_y = -1$.
- [4] $u_x = y$ but $v_y = -1$.
:::
:::

::: check
kind: parts
given: a = 2 | 3; x = 0.5 | 1; y = 0.3 | 1

## $f = e^{\given{a}z}$ has $u = e^{ax}\cos ay$ and $v = e^{ax}\sin ay$.

::: part
answer: a*exp(a*x)*cos(a*y)
tolerance: 0.5%

### What is $v_y$ at $(\given{x}, \given{y})$?

::: misses
- [exp(a*x)*cos(a*y)] That's u itself; differentiating brings out a.
- [any] $v_y = ae^{ax}\cos ay$, which equals $u_x$ as Cauchy–Riemann says.
:::
:::

::: part
answer: a*exp(a*x)
tolerance: 0.5%

### What is $\lvert f'\rvert$ there?

::: misses
- [exp(a*x)] The chain rule brings out a factor a.
- [any] $\lvert ae^{az}\rvert = ae^{ax}$.
:::
:::
:::

::: check
kind: derivation
vars: p = -3..3, q = -3..3

## At a point, an analytic function has $u_x = p$ and $v_x = q$.

::: step
answer: -q

### What is $u_y$?
:::

::: step
answer: p

### What is $v_y$?
:::

::: step
answer: p^2 + q^2

### What is the Jacobian $u_xv_y - u_yv_x$, the factor by which tiny areas grow?
:::

::: right
Right. The area factor is $\lvert f'\rvert^2$: an analytic map scales lengths by $\lvert f'\rvert$ in every direction, so areas grow by its square.
:::
:::

::: explain
## Why does a complex function that depends on $\bar z$ fail the Cauchy–Riemann equations?

::: model
Moving z by a small h moves $\bar z$ by $\bar h$, which is h reflected across the real axis: a step in the real direction moves both the same way, but a step in the imaginary direction moves them in opposite directions. A function of $\bar z$ therefore responds differently to real and imaginary steps, so its rate of change depends on the direction, which is exactly what the Cauchy–Riemann equations forbid. Writing them as $\partial f/\partial\bar z = 0$ says it directly: an analytic function changes only through z.
:::
:::

::: practice

::: check
given: x = 3 | -2; y = 1 | 2
answer: 3*x^2 - 3*y^2
tolerance: 0

## $u_x$ for $z^3$ at $(\given{x}, \given{y})$?

::: misses
- [any] $3x^2 - 3y^2$.
:::
:::

::: check
given: ux = 3 | -1; vx = 4 | 2
answer: abs(ux + j*vx)
tolerance: 0.5%

## $\lvert f'\rvert$ with $u_x = \given{ux}$, $v_x = \given{vx}$?

::: misses
- [any] $\lvert u_x + jv_x\rvert$.
:::
:::

::: check
given: x = 1 | 1.5; y = 0.5 | 2
answer: exp(x)*cos(y)
tolerance: 0.5%

## Real part of $(e^z)'$ at $(\given{x}, \given{y})$?

::: misses
- [any] $e^x\cos y$.
:::
:::
:::
