7.5 Functions of a Complex Variable

Two real functions travelling together: limits, continuity, the Cauchy–Riemann equations, and harmonic functions

What will I learn in this section?

On completion of this section, you should be able to:

  • Understand the definition of a complex function.
  • Find the real and imaginary parts $u(x,y)$ and $v(x,y)$ of a complex function.
  • Understand the concepts of limit and continuity for complex functions.
  • Compute limits of complex functions, and show when a limit fails to exist.
  • Understand differentiability and analyticity, and apply the Cauchy–Riemann equations.
  • Understand harmonic functions and find a harmonic conjugate.
  • Know that the real and imaginary parts of an analytic function are harmonic.

A complex function takes a point of the plane and returns another point of the plane. That means it is really two real functions travelling together — and the whole subject turns on what happens when those two are forced to cooperate.

Splitting $f(z)$ into Real and Imaginary Parts

Definition: Complex Function

A function $f$ assigns to each $z$ in a set $S$ a single complex number $w = f(z)$. Writing $z = x + iy$ and separating the output into real and imaginary parts:

$$f(z) = u(x, y) + i\,v(x, y)$$

$u$ and $v$ are real-valued functions of the two real variables $x$ and $y$.

Example 1

Find $u$ and $v$ for $f(z) = z^2$.

$$f(z) = (x + iy)^2 = x^2 + 2ixy + i^2y^2 = \left(x^2 - y^2\right) + i(2xy)$$

So $u(x,y) = x^2 - y^2$ and $v(x,y) = 2xy$.

Example 2

Find $u$ and $v$ for $f(z) = \dfrac{1}{z}$, $z \ne 0$.

Multiply above and below by the conjugate:

$$\frac{1}{x + iy} \cdot \frac{x - iy}{x - iy} = \frac{x - iy}{x^2 + y^2}$$

So $u = \dfrac{x}{x^2+y^2}$ and $v = \dfrac{-y}{x^2+y^2}$. Note the minus sign in $v$, and that neither is defined at the origin.

You cannot draw the graph

The graph of $w = f(z)$ would need four dimensions: two for the input, two for the output. So we never graph a complex function. Instead we think of it as a mapping: it picks up a region of one plane and lays it down, stretched and rotated, on another.

Limits and Continuity

Definition: Limit

$\displaystyle\lim_{z \to z_0} f(z) = L$ means: $|f(z) - L|$ can be made as small as we like by taking $|z - z_0|$ small enough (but nonzero).

The difference that matters

On the real line, $z$ can approach $z_0$ from two directions. In the plane it can approach from infinitely many — along any line, any spiral, any path at all. For the limit to exist, every single approach must give the same answer. This makes limits much harder to have, and it is the source of all the power later in the chapter.

Example 3 — a limit that does not exist

Show that $\displaystyle\lim_{z \to 0} \frac{\bar{z}}{z}$ does not exist.

Approach along the real axis ($z = x$, so $\bar z = x$):

$$\frac{\bar z}{z} = \frac{x}{x} = 1 \;\longrightarrow\; 1$$

Approach along the imaginary axis ($z = iy$, so $\bar z = -iy$):

$$\frac{\bar z}{z} = \frac{-iy}{iy} = -1 \;\longrightarrow\; -1$$

Two approaches, two different answers, so the limit does not exist. One counterexample path pair is enough — you never have to check them all.

Definition: Continuity

$f$ is continuous at $z_0$ if $f(z_0)$ is defined, the limit exists, and $\displaystyle\lim_{z \to z_0} f(z) = f(z_0)$. Equivalently, $f$ is continuous exactly when both $u$ and $v$ are continuous as real functions of $(x,y)$.

Sums, products, quotients (where the denominator is nonzero) and compositions of continuous functions are continuous, exactly as in real calculus. Every polynomial in $z$ is continuous everywhere.

Differentiability and the Cauchy–Riemann Equations

Definition: Derivative
$$f'(z_0) = \lim_{\Delta z \to 0} \frac{f(z_0 + \Delta z) - f(z_0)}{\Delta z}$$

provided this limit exists — meaning it gives the same value however $\Delta z \to 0$.

That last clause is a severe demand. Let $\Delta z$ approach $0$ first horizontally and then vertically, and insist the two answers agree, and you are forced into a pair of partial differential equations.

Theorem: The Cauchy–Riemann Equations

If $f = u + iv$ is differentiable at $z_0$, then at that point

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

and the derivative is then $\;f'(z) = \dfrac{\partial u}{\partial x} + i\dfrac{\partial v}{\partial x}$.

One direction only

Cauchy–Riemann is necessary, not by itself sufficient. Satisfying the equations at a point does not guarantee differentiability there. Add the hypothesis that the four partial derivatives are continuous in a neighbourhood, and then it does: that is the converse theorem, and it is the version you use in practice.

Definition: Analytic, Entire

$f$ is analytic at $z_0$ if it is differentiable at every point of some open disc around $z_0$ — differentiable at the point is not enough, it must be differentiable near it.

$f$ is analytic in a domain $D$ if it is analytic at every point of $D$, and entire if it is analytic on the whole plane.

Example 4

Show that $f(z) = z^2$ is entire, and find $f'(z)$.

$u = x^2 - y^2$, $v = 2xy$. The partials are

$$u_x = 2x, \quad u_y = -2y, \quad v_x = 2y, \quad v_y = 2x$$

Check: $u_x = 2x = v_y$ ✓ and $u_y = -2y = -v_x$ ✓, at every point, and all four partials are continuous everywhere. So $f$ is entire, and

$$f'(z) = u_x + iv_x = 2x + 2iy = 2z$$

which is the answer real calculus would have guessed.

Example 5 — a continuous function that is nowhere differentiable

Show that $f(z) = \bar{z}$ is differentiable nowhere.

$\bar z = x - iy$, so $u = x$ and $v = -y$.

$$u_x = 1, \qquad v_y = -1$$

The first Cauchy–Riemann equation demands $u_x = v_y$, i.e. $1 = -1$, which is false everywhere. There is no point at which $\bar z$ is differentiable.

Yet $\bar z$ is perfectly continuous. In the complex world, continuity is cheap and differentiability is expensive.

Example 6 — differentiable at one point, analytic nowhere

Where is $f(z) = |z|^2$ differentiable? Where is it analytic?

$|z|^2 = x^2 + y^2$, so $u = x^2 + y^2$ and $v = 0$.

$$u_x = 2x, \quad v_y = 0 \;\Longrightarrow\; 2x = 0 \;\Longrightarrow\; x = 0$$ $$u_y = 2y, \quad -v_x = 0 \;\Longrightarrow\; 2y = 0 \;\Longrightarrow\; y = 0$$

Both equations hold only at the single point $z = 0$, so that is the only place $f$ can be differentiable (and it is).

But analyticity needs differentiability on a whole disc around the point, and every disc around $0$ contains points where Cauchy–Riemann fails. So $f$ is differentiable at one point and analytic nowhere. This example is the reason the definition of "analytic" insists on a neighbourhood.

Harmonic Functions

Definition: Harmonic

A real function $\phi(x,y)$ with continuous second partials is harmonic in a domain $D$ if it satisfies Laplace's equation there:

$$\frac{\partial^2 \phi}{\partial x^2} + \frac{\partial^2 \phi}{\partial y^2} = 0$$

You met this equation in Chapter 6 as the steady-state heat equation: the temperature distribution that has stopped changing.

Theorem

If $f = u + iv$ is analytic in a domain $D$, then both $u$ and $v$ are harmonic in $D$.

The proof is two lines of Cauchy–Riemann. Differentiate $u_x = v_y$ with respect to $x$, and $u_y = -v_x$ with respect to $y$:

$$u_{xx} = v_{yx}, \qquad u_{yy} = -v_{xy}$$

Adding, and using the equality of mixed partials $v_{xy} = v_{yx}$:

$$u_{xx} + u_{yy} = v_{yx} - v_{xy} = 0$$
Definition: Harmonic Conjugate

If $u$ and $v$ are both harmonic in $D$ and satisfy the Cauchy–Riemann equations, then $v$ is called a harmonic conjugate of $u$, and $f = u + iv$ is analytic in $D$.

Example 7

Show $u = x^3 - 3xy^2$ is harmonic, and find a harmonic conjugate.

Harmonic? $u_x = 3x^2 - 3y^2$, so $u_{xx} = 6x$. And $u_y = -6xy$, so $u_{yy} = -6x$.

$$u_{xx} + u_{yy} = 6x - 6x = 0 \;\checkmark$$

Find $v$. The first Cauchy–Riemann equation gives

$$v_y = u_x = 3x^2 - 3y^2$$

Integrate with respect to $y$, remembering the constant of integration is a function of $x$:

$$v = 3x^2y - y^3 + h(x)$$

Now use the second equation, $v_x = -u_y = 6xy$:

$$v_x = 6xy + h'(x) = 6xy \;\Longrightarrow\; h'(x) = 0 \;\Longrightarrow\; h = C$$
$$\boxed{v = 3x^2y - y^3 + C}$$

And the function we have built is an old friend: $u + iv = x^3 - 3xy^2 + i(3x^2y - y^3) = z^3$.

Not every nice-looking function is harmonic

Take $u = x^2 + y^2$. Then $u_{xx} + u_{yy} = 2 + 2 = 4 \ne 0$. It is smooth, symmetric and perfectly pleasant — and it is not harmonic, so it is not the real part of any analytic function. Compare $x^2 - y^2$, where the signs do cancel.

Worked Examples

Click a problem to open the full solution.

Example A: Find $u$ and $v$ for $f(z) = z^2 + 3z$ ▼

Solution

Step 1: Substitute $z = x + iy$.

$$z^2 + 3z = \left(x^2 - y^2 + 2ixy\right) + 3(x + iy)$$

Step 2: Collect real and imaginary parts.

$$= \left(x^2 - y^2 + 3x\right) + i\left(2xy + 3y\right)$$ $$\boxed{u = x^2 - y^2 + 3x, \qquad v = 2xy + 3y}$$

Step 3: Check with Cauchy–Riemann. $u_x = 2x + 3$ and $v_y = 2x + 3$ ✓; $u_y = -2y$ and $-v_x = -2y$ ✓. The function is entire, with $f'(z) = (2x+3) + i(2y) = 2z + 3$.

Example B: Is $f(z) = e^{-y}(\cos x + i\sin x)$ analytic? ▼

Solution

Step 1: Read off $u$ and $v$. $u = e^{-y}\cos x$, $v = e^{-y}\sin x$.

Step 2: The four partials.

$$u_x = -e^{-y}\sin x, \qquad u_y = -e^{-y}\cos x$$ $$v_x = e^{-y}\cos x, \qquad v_y = -e^{-y}\sin x$$

Step 3: Test. $u_x = -e^{-y}\sin x = v_y$ ✓ and $u_y = -e^{-y}\cos x = -v_x$ ✓, everywhere, with all partials continuous. So $f$ is entire.

Step 4: The derivative.

$$f'(z) = u_x + iv_x = -e^{-y}\sin x + ie^{-y}\cos x = i\,e^{-y}(\cos x + i \sin x) = i f(z)$$
Recognise it: a function equal to $i$ times its own derivative’s partner like this is $f(z) = e^{iz}$. Indeed $e^{iz} = e^{i(x+iy)} = e^{-y}e^{ix}$, which is exactly what we were given.
Example C: Where does $\displaystyle\lim_{z\to 0}\frac{\operatorname{Re}(z)}{z}$ go wrong? ▼

Solution

Along the real axis ($z = x$): $\dfrac{\operatorname{Re}(x)}{x} = \dfrac{x}{x} = 1$.

Along the imaginary axis ($z = iy$): $\operatorname{Re}(iy) = 0$, so the quotient is $\dfrac{0}{iy} = 0$.

$$\boxed{\text{The limit does not exist}}$$

A trap worth naming: both one-variable limits exist and are finite. It is not that anything blew up — it is that the two routes simply disagree. This is why you may never conclude a complex limit exists by checking a single direction.

📝 Exam-Style Practice Problems

These problems are similar in style and difficulty to past exam questions. Click each problem to reveal the step-by-step solution.

Practice 1: Show $u = e^x\cos y$ is harmonic and find $f(z)$ with $\operatorname{Re} f = u$ ▼

Solution

Step 1: Laplace's equation.

$$u_x = e^x\cos y, \quad u_{xx} = e^x\cos y, \quad u_y = -e^x\sin y, \quad u_{yy} = -e^x\cos y$$ $$u_{xx} + u_{yy} = e^x\cos y - e^x\cos y = 0 \;\checkmark$$

Step 2: Build $v$ from the first CR equation. $v_y = u_x = e^x\cos y$, so integrating in $y$:

$$v = e^x \sin y + h(x)$$

Step 3: Use the second CR equation. $v_x = -u_y = e^x\sin y$. But from Step 2, $v_x = e^x\sin y + h'(x)$, so $h'(x) = 0$ and $h$ is a constant.

Step 4: Assemble.

$$f = e^x\cos y + i\,e^x\sin y = e^x(\cos y + i \sin y) = e^x e^{iy}$$ $$\boxed{f(z) = e^{z}}$$
Worth pausing on: we were handed one real function of two variables and recovered a complex function completely, up to a constant. Harmonic functions do not come alone — each one is half of an analytic function, and the other half is almost forced.
Practice 2: For what values of $a$ is $u = ax^2 - y^2 + 2xy$ harmonic? ▼

Solution

Step 1: Second partials.

$$u_x = 2ax + 2y \;\Longrightarrow\; u_{xx} = 2a$$ $$u_y = -2y + 2x \;\Longrightarrow\; u_{yy} = -2$$

Step 2: Impose Laplace.

$$u_{xx} + u_{yy} = 2a - 2 = 0 \;\Longrightarrow\; \boxed{a = 1}$$

Step 3: Check what we get. With $a = 1$, $u = x^2 - y^2 + 2xy$. The $x^2 - y^2$ part is $\operatorname{Re}(z^2)$ and the $2xy$ part is $\operatorname{Im}(z^2)$, so

$$u = \operatorname{Re}\left(z^2\right) + \operatorname{Im}\left(z^2\right) = \operatorname{Re}\left((1 - i)z^2\right)$$

which confirms it is the real part of an analytic function.

Practice 3: Show $f(z) = z\,\bar{z}$ is differentiable only at the origin ▼

Solution

Step 1: Simplify first. $z\bar z = |z|^2 = x^2 + y^2$, which is entirely real, so $u = x^2 + y^2$ and $v = 0$.

Step 2: First CR equation.

$$u_x = 2x, \quad v_y = 0 \;\Longrightarrow\; 2x = 0 \;\Longrightarrow\; x = 0$$

Step 3: Second CR equation.

$$u_y = 2y, \quad -v_x = 0 \;\Longrightarrow\; 2y = 0 \;\Longrightarrow\; y = 0$$

Step 4: Conclude. Both hold only at $z = 0$. Since the partials are continuous there, $f$ is differentiable at the origin, with $f'(0) = u_x + iv_x = 0$.

$$\boxed{\text{Differentiable only at } z = 0, \text{ analytic nowhere}}$$
Do not say it is analytic at $0$. Analyticity requires differentiability on an entire disc around the point, and every disc around $0$ is full of points where CR fails.

Practice Problems

Problem 1

Find $u$ and $v$ for $f(z) = z^3$.

$(x+iy)^3 = x^3 + 3ix^2y + 3i^2xy^2 + i^3y^3 = \left(x^3 - 3xy^2\right) + i\left(3x^2y - y^3\right)$.

$$u = x^3 - 3xy^2, \qquad v = 3x^2y - y^3$$
Problem 2

Verify the Cauchy–Riemann equations for $f(z) = z^3$ and find $f'(z)$.

$u_x = 3x^2 - 3y^2$ and $v_y = 3x^2 - 3y^2$ ✓.   $u_y = -6xy$ and $-v_x = -6xy$ ✓.

$$f'(z) = u_x + iv_x = 3x^2 - 3y^2 + i(6xy) = 3\left(x^2 - y^2 + 2ixy\right) = 3z^2$$
Problem 3

Is $v = 2xy$ a harmonic conjugate of $u = x^2 - y^2$?

Both are harmonic ($2 - 2 = 0$ and $0 + 0 = 0$), and $u_x = 2x = v_y$ ✓ with $u_y = -2y = -v_x$ ✓.

Yes — and $u + iv = z^2$. Note the order matters: $u$ is not a harmonic conjugate of $v$, because $v + iu$ is not analytic.

Multiple-Choice Check

Test your understanding with these multiple-choice questions. Click a choice to see if you're correct.

Q1: For $f(z) = z^2 + 3z$, the real part $u(x,y)$ is

Q2: $\displaystyle\lim_{z \to 0}\frac{\bar z}{z}$

Q3: The function $f(z) = |z|^2$ is differentiable

Q4: The Cauchy–Riemann equations are

Q5: Which function is harmonic?

Q6: A harmonic conjugate of $u = x^3 - 3xy^2$ is

Next: Exponential and Logarithmic Functions

You now know what makes a complex function well behaved. The next section applies that machinery to the most important function in the subject, $e^z$ — and then tries to invert it, which turns out to be far more interesting than inverting $e^x$ ever was.

Continue to 7.6: Exponential & Logarithmic Functions →