A complex function $w = f(z)$ takes a complex number and returns one. Since $z = x + iy$ carries two real numbers and so does $w = u + iv$, a complex function is really a pair of real functions of two variables, the kind you studied in multivariable calculus. Splitting $f$ into $u$ and $v$ is the first move in almost every computation of this course.
🔑 Key idea
Write $f(z) = u(x, y) + i\,v(x, y)$, where $u = \operatorname{Re} f$ and $v = \operatorname{Im} f$ are real-valued. For example, for $f(z) = z^2$,
$$z^2 = (x + iy)^2 = (x^2 - y^2) + i(2xy), \qquad u = x^2 - y^2, \quad v = 2xy.$$
💡 Why it works
Substitute $z = x + iy$ and expand, using $i^2 = -1$. Every term is either real or a real number times $i$; collect the real terms into $u$ and the coefficients of $i$ into $v$. The imaginary part is a real function: in $x^2 - y^2 + 2xy\,i$, the imaginary part is $2xy$, the number that multiplies $i$. With a quotient, multiply the top and bottom by the conjugate of the bottom first, so the denominator becomes real.
One way to see a complex function: color each point $z$ by the direction of $f(z)$ (red for positive real values, then yellow, green, cyan, blue, magenta going counterclockwise), with brighter rings as $|f(z)|$ grows. For $z^2$ the colors go around twice as you circle $0$, because squaring doubles angles. Drag the probe to read $f(z)$.
Worked examples
✏️ Worked example: A polynomial
Find $u$ and $v$ for $f(z) = z^2 + 3iz$.
$z^2 = x^2 - y^2 + 2ixy$.
$3iz = 3i(x + iy) = 3ix + 3i^2y = -3y + 3ix$.
Collect: real part $u = x^2 - y^2 - 3y$; coefficient of $i$: $v = 2xy + 3x$.
Answer: $u = x^2 - y^2 - 3y$, $v = 2xy + 3x$
✏️ Worked example: A quotient
Find $u$ and $v$ for $f(z) = \dfrac{1}{z}$, $z \ne 0$.
Multiply the top and bottom by $\overline{z} = x - iy$: $\dfrac{1}{x + iy} = \dfrac{x - iy}{x^2 + y^2}$.
✏️ Worked example: A function that uses the conjugate
Find $u$ and $v$ for $f(z) = z\overline{z} + \overline{z}$.
$z\overline{z} = x^2 + y^2$ and $\overline{z} = x - iy$.
$f = (x^2 + y^2 + x) + i(-y)$.
$u = x^2 + y^2 + x$ and $v = -y$. Formulas like this one are perfectly good functions of $x$ and $y$, but in the next unit we will see that they are not complex differentiable.
Answer: $u = x^2 + y^2 + x$, $v = -y$
⚠️ Common mistake
Keeping the $i$ inside $v$. From $z^2 = x^2 - y^2 + 2ixy$, some people write $v = 2ixy$. But $v$ is the imaginary part, a real number: $v = 2xy$. A check that always works: $u$ and $v$ should both be real whenever $x$ and $y$ are; no $i$ may appear in either of them.
Evaluating $f$ at a point needs no splitting at all: $f(1 + 2i)$ for $f(z) = z^2 + 3iz$ is $(1 + 2i)^2 + 3i(1 + 2i) = (-3 + 4i) + (-6 + 3i) = -9 + 7i$. As a check, the formulas from the first example give $u(1, 2) = 1 - 4 - 6 = -9$ and $v(1, 2) = 4 + 3 = 7$.
Practice
Pass with 3 right answers, the last 2 in a row. Each right answer earns 1 XP.