We have studied functions that take real inputs and give complex outputs (e.g., complex solutions to the damped harmonic oscillator, which are complex functions of time). For such functions, the derivative with respect to its real input is much like the derivative of a real function of real inputs. It is equivalent to taking the derivatives of the real and imaginary parts, separately:
$$\frac{d\psi}{dx} = \frac{d\mathrm{Re}(\psi)}{dx} + i \frac{d\mathrm{Im}(\psi)}{dx}.$$Now consider the more complicated case of a function of a complex variable:
$$f(z) \in \mathbb{C}, \;\;\mathrm{where}\;\; z \in \mathbb{C}.$$At one level, we could just treat this as a function of two independent real inputs: $f(x,y)$, where $z = x + i y$. However, in doing so we would be disregarding the mathematical structure of the complex input—the fact that $z$ is not merely a collection of two real numbers, but a complex number that can participate in algebraic operations. This structure has important implications for the differential calculus of complex functions.
The concept of a continuous complex function makes use of an "epsilon-delta definition", similar to the definition for functions of real variables:
A complex function $f(z)$ is continuous at $z_0 \in \mathbb{C}$ if, for any $\epsilon > 0$, we can find a $\delta > 0$ such that $$\big|\, z - z_0 \,\big| < \delta \;\;\; \Rightarrow \;\;\; \big|\, f(z) - f(z_0) \,\big| < \epsilon.$$
Here, $\big|\cdots\big|$ denotes the magnitude of a complex number. If you have difficulty processing this definition, don't worry; it basically says that as $z$ is varied smoothly, there are no abrupt jumps in the value of $f(z)$.
If a function is continuous at a point $z$, we can define its complex derivative as
$$f'(z) = \frac{df}{dz} = \lim_{\delta z\rightarrow 0} \frac{f(z+\delta z) - f(z)}{\delta z}.$$This is very similar to the definition of the derivative for a function of a real variable. However, there's a complication which doesn't appear in the real case: the infinitesimal $\delta z$ is a complex number, not just a real number, yet the above definition does not specify the argument of $\delta z$. The choice of the argument of $\delta z$ is equivalent to the direction in the complex plane in which $\delta z$ points, as shown in the following figure:
In principle, we might get different results from the above formula when we plug in different infinitesimals $\delta z$, even in the limit where $\delta z \rightarrow 0$ and even though $f(z)$ is continuous.
Example |
Consider the function $f(z) = z^*$. According to the formula for the complex derivative, $$\lim_{\delta z \rightarrow0} \frac{f(z+\delta z) - f(z)}{\delta z} = \lim_{\delta z \rightarrow0} \frac{z^*+\delta z^* - z^*}{\delta z} = \lim_{\delta z \rightarrow0} \frac{\delta z^*}{\delta z}.$$ But if we plug in a real $\delta z$, we get a different result than if we plug in an imaginary $\delta z$: $$\begin{aligned}\delta z \in \mathbb{R} \;\; &\Rightarrow \frac{\delta z^*}{\delta z} = 1.\\ \delta z \in i \cdot \mathbb{R} &\Rightarrow \frac{\delta z^*}{\delta z} = -1.\end{aligned}$$ |
In [1]:
## Verify the above example numerically:
from numpy import conj
def f(z):
return conj(z)
z = 1.0+0j
dz = 1e-8; df_dz = (f(z+dz) - f(z)) / dz
print("derivative with real dz = {}".format(df_dz))
dz = 1e-8j; df_dz = (f(z+dz) - f(z)) / dz
print("derivative with imag dz = {}".format(df_dz))
We can deal with this complication by regarding the complex derivative as well-defined only if the above definition gives the same answer regardless of the argument of $\delta z$. If a function satisfies this property at a point $z$, we say that the function is complex-differentiable at $z$.
The preceding example showed that $f(z) = z^*$ is not complex-differentiable for any $z \in \mathbb{C}$. On the other hand, the following example shows that the function $f(z) = z$ is complex-differentiable for all $z \in \mathbb{C}$:
Example |
The function $f(z) = z$ is complex differentiable for any $z \in \mathbb{C}$, since $$\lim_{\delta z \rightarrow0} \frac{f(z+\delta z) - f(z)}{\delta z} = \lim_{\delta z \rightarrow0} \frac{z+\delta z - z}{\delta z} = \lim_{\delta z \rightarrow0} \frac{\delta z}{\delta z} = 1.$$ The reason the result doesn't depend on the argument of $\delta z$ is that the derivative formula simplifies to the fraction $\delta z / \delta z$, which is equal to 1 for any $|\delta z| > 0$. Note that we simplify the fraction to 1 before taking the limit $\delta z \rightarrow 0$. We can't take the limit first, because $0/0$ is undefined. |
If a function $f(z)$ is complex-differentiable for all points $z$ in some domain $D\subset \mathbb{C}$, then $f(z)$ is said to be analytic in $D$.
The concepts of analyticity and complex-differentiability are closely related. It's mainly a matter of terminology: we speak of a function being complex-differentiable at a given point, and we speak of a function being analytic in a given domain.
Example |
As shown in the preceding section, $f(z) = z$ is complex-differentiable for any point $z \in \mathbb{C}$. Thence, $f(z) = z$ is analytic in $\mathbb{C}$. |
A function's domain of analyticity is often described spatially, in terms of the complex plane. For example, we might say that a function is analytic "everywhere in the complex plane", which means the entire domain $\mathbb{C}$. Or we might say that a function is analytic "in the upper half of the complex plane", meaning for all $z$ such that $\mathrm{Im}(z) > 0$.
There is an important class of functions which are analytic over the entire complex plane, or most of the complex plane. These are functions generated from algebraic formulas which do not contain $z^*$, and involve $z$ in some "simple" combination of operations like addition, multiplication, and integer powers.
For example, we have seen that the function $f(z) = z$ is analytic in $\mathbb{C}$. Likewise, $f(z) = \alpha z + \beta$, where $\alpha, \beta$ are complex constants, is analytic everywhere in $\mathbb{C}$. This can be proven in a similar fashion:
$$\begin{align}f'(z) &= \lim_{\delta z\rightarrow 0} \frac{[\alpha\,(z+\delta z) + \beta] - [\alpha z + \beta]}{\delta z} \\&= \lim_{\delta z\rightarrow 0} \frac{\alpha \delta z}{\delta z} \\&= \alpha.\end{align}$$We can also show that $f(z) = z^n$, with $n \in \mathbb{N}$, is analytic everywhere in $\mathbb{C}$:
$$\begin{aligned}f'(z) &= \lim_{\delta z\rightarrow 0} \frac{(z+\delta z)^n - z^n}{\delta z} \\&= \lim_{\delta z\rightarrow 0} \frac{(z^n + n z^{n-1} \delta z + \cdots) - z^n}{\delta z} \\&= n z^{n-1}.\end{aligned}$$Note that these derivatives have exactly the same algebraic formulas as the corresponding real derivatives. This is no coincidence: to derive the complex derivatives, we take the same series of algebra steps used for deriving the real derivatives.
From the discussion so far, it is evident that complex polynomials are analytic everywhere in $\mathbb{C}$. Likewise, functions that are defined in terms of power series, including the complex exponential and complex sines and cosines, are analytic everywhere in $\mathbb{C}$. Functions involving reciprocals (negative integer powers), such as $f(z) = z^{-1}$ or $f(z) = z^{-2}$, are analytic everywhere except at points where $f(z)$ becomes singular (i.e., the denominator goes to zero). (We will prove this later, by using the Cauchy-Riemann equations.)
More generally, whenever a function involves $z$ in some combination of integer polynomials, reciprocals, or functions with power series expansions—and does not involve $z^*$ in an irreducible way—then the function is analytic everywhere except at the singular points. Moreover, the formula for the complex derivative is the same as the corresponding formula for real derivatives.
Example |
The function $$f(z) = \frac{1}{\cos(z)}$$ is analytic everywhere in $\mathbb{C}$, except for values of $z$ such that $\cos(z) = 0$. With a bit of work (try it!), one can show that these $z$ occur at isolated points along the real line, at $z = (m+1/2)\pi$ where $m \in \mathbb{Z}$, and nowhere else in the complex plane. The complex derivative is $$f'(z) = \frac{\sin(z)}{[\cos(z)]^2}.$$ The easiest way to prove these statements is to use the Cauchy-Riemann equations, which are discussed below. |
One proviso should be kept in mind. For non-integer powers, $z^a$ where $a\notin \mathbb{Z}$, the situation is more complicated because the operation is multi-valued. We'll postpone the discussion of these special operations until the discussion on branch points and branch cuts.
In the following Python example, we look at the complex derivative of the function
$$f(z) = \sin(z),$$which is analytic everywhere in $\mathbb{C}$. The derivative can be estimated numerically as
$$\frac{\delta f}{\delta z} = \frac{\sin(z + \delta z) - \sin(z)}{\delta z}$$for $\delta z$ with very small magnitude. Note that these are complex numbers, since the sine and cosine functions give complex outputs when the input $z$ is complex.
We observe that the numerical results are insensitive to the choice of $\delta z$ (including real and imaginary values), so long as $|\delta z|$ is small. In the limit where $|\delta z| \rightarrow 0$, the value should become independent of $\mathrm{arg}(z)$, and approach the limiting value of the complex derivative:
$$\frac{df}{dz} = \lim_{|\delta z| \rightarrow 0} \frac{\delta f}{\delta z} = \cos(z).$$
In [1]:
from scipy import sin, cos, exp
## Value of sin(z) for a particular (arbitrary) choice of z:
z = 0.75+0.3j
print('z = ', z)
print('sin(z) = ', sin(z))
print('')
## Calculate the derivative for different choices of dz:
dz_1 = 1e-8 # Real dz
dz_2 = 1e-8j # Imaginary dz
dz_3 = 1e-8*exp(0.4j) # dz with an arbitrarily chosen arg
print('derivative_1 = ', (sin(z+dz_1) - sin(z))/dz_1)
print('derivative_2 = ', (sin(z+dz_2) - sin(z))/dz_2)
print('derivative_3 = ', (sin(z+dz_3) - sin(z))/dz_3)
print('cos(z) = ', cos(z))
The Cauchy-Riemann equations are a pair of real partial differential equations that provide an alternative way to understand complex derivatives. Their importance comes from the following theorem:
Let $f$ be a complex function that can be written as the sum of real and imaginary parts, $$f(z = x + iy) \;=\; u(x,y) + i v(x,y),$$ where $u(x,y)$ and $v(x,y)$ are real functions of two real inputs. Then $f$ is complex-differentiable at a given $z$ if and only if the following equations are both well-defined and true: $$\begin{aligned} \frac{\partial u}{\partial x} &= \;\;\, \frac{\partial v}{\partial y} \\ \frac{\partial u}{\partial y} &= -\frac{\partial v}{\partial x}.\end{aligned}$$
The two partial differential equations in the above line are the Cauchy-Riemann equations. "Well-defined", in the context of this theorem, means that the functions $u(x,y)$ and $v(x,y)$ must have valid partial derivatives, i.e. they must be differentiable (in the real sense) at that point in both the $x$ and $y$ directions.
We will now prove the first part of the above "if and only if" statement, which states that $f$ being complex-differentiable implies the Cauchy-Riemann equations. The proof of the converse is left as an exercise.
Suppose the function $f$ is complex-differentiable at some point $z$. Following from the definition of complex differentiability, there exists a derivative $f'(z)$ defined as
$$f'(z) = \lim_{\delta z \rightarrow 0} \frac{f(z+\delta z) - f(z)}{\delta z},$$whose value is independent of the argument that we take for the infinitesimal $\delta z$. If we take this to be real, i.e. $\delta z = \delta x \in \mathbb{R}$, the expression for the derivative can be written as
$$\begin{aligned}f'(z) &= \lim_{\delta x \rightarrow 0} \frac{f(x+\delta x + i y) - f(x + i y)}{\delta x} \\ &= \lim_{\delta x \rightarrow 0} \frac{\left[u(x+\delta x, y) + iv(x+\delta x, y)\right] - \left[u(x, y) + i v(x,y)\right]}{\delta x}\\ &= \lim_{\delta x \rightarrow 0} \frac{\left[u(x+\delta x, y) - u(x,y)\right] + i \left[v(x+\delta x, y)-v(x,y)\right]}{\delta x} \\ &= \left[ \lim_{\delta x \rightarrow 0} \frac{u(x+\delta x, y) - u(x,y)}{\delta x}\right] + i \left[ \lim_{\delta x \rightarrow 0} \frac{v(x+\delta x, y) - v(x,y)}{\delta x}\right]\end{aligned}$$On the last line, the quantities in square brackets are the real partial derivatives of $u$ and $v$ (with respect to $x$). Therefore those partial derivatives are well-defined, and
$$f'(z) = \frac{\partial u}{\partial x} + i \frac{\partial v}{\partial x}.$$On the other hand, we could also take an infinitesimal displacement in the imaginary direction, by setting $\delta z = i \delta y$ where $\delta y \in \mathbb{R}$. Then the expression for the derivative is
$$\begin{aligned}f'(z) &= \lim_{\delta y \rightarrow 0} \frac{f(x+ i y + i\delta y) - f(x + i y)}{i\delta y} \\ &= \lim_{\delta y \rightarrow 0} \frac{\left[u(x, y+\delta y) + iv(x, y+\delta y)\right] - \left[u(x, y) + i v(x,y)\right]}{i\delta y}\\ &= \lim_{\delta y \rightarrow 0} \frac{\left[u(x, y+\delta y) - u(x,y)\right] + i \left[v(x, y+\delta y)-v(x,y)\right]}{i\delta y} \\ & = -i\frac{\partial u}{\partial y} + \frac{\partial v}{\partial y}\end{aligned}$$Since $f(z)$ is complex-differentiable, these two expressions must be equal, so
$$\frac{\partial u}{\partial x} + i \frac{\partial v}{\partial x} = -i\frac{\partial u}{\partial y} + \frac{\partial v}{\partial y}.$$Noting that $u$ and $v$ are real functions, we can take the real and imaginary parts of the above equation separately. This yields a pair of real equations,
$$\frac{\partial u}{\partial x} = \frac{\partial v}{\partial y}, \;\;\; \frac{\partial v}{\partial x} = -\frac{\partial u}{\partial y}.$$These are precisely the Cauchy-Riemann equations. As a corollary, we also obtain a set of convenient expressions for the complex derivative of $f(z)$:
$$\begin{aligned}\mathrm{Re}\left[f'(z)\right] &= \frac{\partial u}{\partial x} = \frac{\partial v}{\partial y} \\ \mathrm{Im}\left[f'(z)\right] &= \frac{\partial v}{\partial x} = -\frac{\partial u}{\partial y}.\end{aligned}$$
In [13]:
## We can verify the above results numerically, for the sine function:
from scipy import sin, cos, exp
z = 0.75+0.3j # Arbitrarily chosen value of z
print('z = ', z)
print('sin(z) = ', sin(z))
print('')
dx = dy = 1e-8
## Derivatives of u and v w.r.t. x
df_dx = (sin(z+dx) - sin(z))/dx
du_dx = df_dx.real
dv_dx = df_dx.imag
## Derivatives of u and v w.r.t. y
df_dy = (sin(z+1j*dy) - sin(z))/dy
du_dy = df_dy.real
dv_dy = df_dy.imag
print('du/dx = ', du_dx)
print('dv/dy = ', dv_dy)
print('du/dy = ', du_dy)
print('dv/dx = ', dv_dx)
The central message of the Cauchy-Riemann equations is that when dealing with analytic functions, the real and imaginary parts of complex numbers cannot be regarded as independent quantities, but are closely intertwined. There are two complementary ways to think about this:
These constraints have profound implications for the mathematical discipline of complex analysis, one of the most important being Cauchy's integral theorem, which we will encounter when studying contour integration.
Often, the easiest way to prove that a function is analytic in a given domain is to prove that the Cauchy-Riemann equations are satisfied.
Example |
We can use the Cauchy-Riemann equations to prove that the function $$f(z)=1/z$$is analytic everywhere, except at $z = 0$. Let us write the function as $$f(x+iy) = \frac{1}{x+iy} = \frac{x-iy}{x^2+y^2}.$$ Hence the real and imaginary component functions are $$u(x,y) = \frac{x}{x^2+y^2}, \;\;v(x,y) = - \frac{y}{x^2+y^2}.$$ Except at the point $x = y = 0$, these functions are differentiable, and their partial derivatives satisfy: $$\begin{aligned}\frac{\partial u}{\partial x} &= \frac{-x^2+y^2}{(x^2+y^2)^2}\!\!\!\!\!\! &=& \;\;\;\frac{\partial v}{\partial y} \\ \frac{\partial v}{\partial x} &= \; \frac{2xy}{(x^2+y^2)^2} &=& -\frac{\partial u}{\partial y}.\end{aligned}$$ |
More generally, we can use the Cauchy-Riemann equations to prove the following facts about analytic functions:
The proofs for these can be obtained by direct substitution into the Cauchy-Riemann equations, and are left as exercises.