3. Complex Numbers

The imaginary unit, denoted $i$, is defined as a solution to the quadratic equation

$$z^2 + 1 = 0.$$

In other words, $i = \sqrt{-1}$. As we know, the above equation lacks any real number solutions. For this concept to make sense, we must extend our pre-established notions about what numbers are.

We will let the imaginary unit take part in the usual arithmetic operations of addition and multiplication, treating it as an algebraic quantity that can participate on the same footing as real numbers. It is one of the most profound discoveries of mathematics that this seemingly arbitrary idea gives rise to powerful computational methods with applications in numerous fields.

Complex algebra

Any complex number $z$ can be written as

$$z = x + i y,$$

where $x$ and $y$ are real numbers that are respectively called the real part and the imaginary part of $z$. The real and imaginary parts are also denoted as $\mathrm{Re}(z)$ and $\mathrm{Im}(z)$, where $\mathrm{Re}$ and $\mathrm{Im}$ can be regarded as functions mapping a complex number to a real number.

The set of complex numbers is denoted by $\mathbb{C}$. We can define algebraic operations on complex numbers (addition, subtraction, products, etc.) by following the usual rules of algebra and setting $i^2 = -1$ whenever it shows up.

Example
Let $z = x + i y$, where $x, y \in \mathbb{R}$. What are the real and imaginary parts of $z^2$?
$$\begin{align}z^2 &= (x+iy)^2 \\&= x^2 + 2x(iy) + (iy)^2 \\&= x^2 - y^2 + 2ixy\end{align}$$
Hence,
$$\mathrm{Re}(z^2) = x^2 -y^2, \;\;\; \mathrm{Im}(z^2) = 2xy.$$

We can also perform power operations on complex numbers, with one caveat: for now, we'll only consider integer powers like $z^2$ or $z^{-1} = 1/z$. Non-integer powers, such as $z^{1/3}$, introduce vexatious complications which we'll postpone for now (we will figure out how to deal with them when studying branch points and branch cuts).

Another useful fact: real coefficients (and only real coefficients) can be freely moved into or out of $\textrm{Re}(\cdots)$ and $\textrm{Im}(\cdots)$ operations:

$$\left\{\begin{array}{l}\mathrm{Re}(\alpha z + \beta z') = \alpha \, \mathrm{Re}(z) + \beta\, \mathrm{Re}(z')\\ \mathrm{Im}(\alpha z + \beta z') = \alpha \, \mathrm{Im}(z) + \beta\, \mathrm{Im}(z')\end{array}\right.\qquad\mathrm{for}\;\alpha, \beta \in \mathbb{R}.$$

As a consequence, if we have a complex function of a real variable, the derivative of that function can be calculated from the derivatives of the real and imaginary parts, as shown in the following example:

Example
If $z(t)$ is a complex function of a real input $t$, then $$\mathrm{Re}\left[\frac{dz}{dt}\right] = \frac{d}{dt} \mathrm{Re}\left[z(t)\right], \;\;\textrm{and}\;\;\; \mathrm{Im}\left[\frac{dz}{dt}\right] = \frac{d}{dt} \mathrm{Im}\left[z(t)\right].$$ This can be proven using the definition of the derivative: $$\begin{align}\mathrm{Re}\left[\frac{dz}{dt}\right] &= \;\; \mathrm{Re}\left[\lim_{\delta t \rightarrow 0} \frac{z(t+\delta t) - z(t)}{\delta t}\right] \\&= \lim_{\delta t \rightarrow 0} \left[\frac{\mathrm{Re}[z(t+\delta t)] - \mathrm{Re}[z(t)]}{\delta t}\right] \\&= \frac{d}{dt} \mathrm{Re}\left[z(t)\right].\end{align}$$
The $\mathrm{Im}[\cdots]$ case works out similarly. Note that the infinitesimal quantity $\delta t$ is real; otherwise, this wouldn't work.

Some examples of manipulating complex numbers in Python are given below.


In [1]:
## Programming note: in Python, complex numbers are
## represented by the notation [x]+[y]j, where x and y
## are numbers.

z = 1.5+0.4j
print('z     = ', z)
print('Re(z) = ', z.real)   # Real part
print('Im(z) = ', z.imag)   # Imaginary part

# You can also write the imaginary unit as 1j:
u = 1j
print('u     = ', u)

## Algebra on complex numbers is handled with the usual notation (+, -, *, etc.):
print('u     = ', u)
print('u + z = ', u + z)
print('u * z = ', u * z)
print('u / z = ', u / z)


z     =  (1.5+0.4j)
Re(z) =  1.5
Im(z) =  0.4
u     =  1j
u     =  1j
u + z =  (1.5+1.4j)
u * z =  (-0.4+1.5j)
u / z =  (0.16597510373443983+0.6224066390041494j)

Conjugates and Magnitudes

For each complex number $z = x + iy$, its complex conjugate is a complex number whose imaginary part has the sign flipped:

$$z^* = x - i y.$$

Conjugation obeys two important properties:

$$\begin{aligned}(z_1 + z_2)^* &= z_1^* + z_2^* \\ (z_1 z_2)^* &= z_1^* z_2^*.\end{aligned}$$
Example
Let us prove that $(z_1 z_2)^* = z_1^* z_2^*$. First, let $z_1 = x_1 + i y_1$ and $z_2 = x_2 + i y_2$. Then,
$$\begin{align}(z_1 z_2)^* &= \left[(x_1+iy_1)(x_2+iy_2)\right]^* \\ &= \left[\left(x_1 x_2 - y_1 y_2\right) + i\left(x_1y_2+y_1x_2\right)\right]^* \\ &= \left(x_1 x_2 - y_1 y_2\right) - i\left(x_1y_2+y_1x_2\right) \\ &= \left(x_1 - i y_1\right)\left(x_2 - i y_2\right) \\&= z_1^* z_2^* \end{align}$$

For a complex number $z = x + i y$, the magnitude of the complex number is

$$|z| = \sqrt{x^2 + y^2}.$$

This is a non-negative real number. A complex number and its conjugate have the same magnitude: $|z| = |z^*|$. Also, we can show that complex magnitudes have the property

$$|z_1 z_2| = |z_1| \, |z_2|.$$

This property is similar to the "absolute value" operation for real numbers, hence the similar notation.

As a corollary, taking a power of a complex number raises its magnitude by the same power:

$$|z^n| = |z|^n \;\;\;\textrm{for}\;\;n \in \mathbb{Z}.$$

In [2]:
## Here is how to compute magnitudes and conjugates in Python:

z = 1.5+0.4j
print('z = ', z)

## The magnitude operation is handled by the built-in `abs` function:
print('|z|   = ', abs(z))

## To calculate the conjugate, use the `numpy.conj` function:
from numpy import conj
print('z^*   = ', conj(z))


z =  (1.5+0.4j)
|z|   =  1.5524174696260025
z^*   =  (1.5-0.4j)

Euler's formula

Euler's formula is an extremely important result which states that

$$e^{iz} = \cos(z) + i \sin(z).$$

To prove this, recall the definition of the exponential:

$$\exp(z) = 1 + z + \frac{z^2}{2!} + \frac{z^3}{3!} + \frac{z^4}{4!} + \frac{z^5}{5!} + \frac{z^6}{6!} + \cdots$$

Previously, we assumed the input to the exponential to be a real number. But since complex numbers can be added and multiplied using the same rules of algebra as real numbers, we can adopt the same series formula as the definition of the complex exponential, a function that takes complex inputs and gives complex outputs. When the input happens to be real, the complex exponential gives the same result as the original real exponential.

Plugging $iz$ as the input to the complex exponential function gives

$$\begin{align}\exp(iz) &= 1 + (iz) + \frac{(iz)^2}{2!} + \frac{(iz)^3}{3!} + \frac{(iz)^4}{4!} + \frac{(iz)^5}{5!} + \frac{(iz)^6}{6!} + \cdots \\&= 1 + iz - \frac{z^2}{2!} - i \frac{z^3}{3!} + \frac{z^4}{4!} + i \frac{z^5}{5!} - \frac{z^6}{6!} + \cdots \\& = \left(1 - \frac{z^2}{2!} + \frac{z^4}{4!} - \frac{z^6}{6!} + \cdots\right) + i\left(z - \frac{z^3}{3!} + \frac{z^5}{5!} - \frac{z^7}{7!} + \cdots\right).\end{align}$$

Now, compare the two terms in parentheses to the series expansions for the cosine and sine functions. We can define the complex cosine and complex sine functions using the corresponding complex series:

$$\begin{aligned}\cos(z) &= 1 - \frac{z^2}{2!} + \frac{z^4}{4!} - \frac{z^6}{6!} + \cdots \\ \sin(z) &= z - \frac{z^3}{3!} + \frac{z^5}{5!} - \frac{z^7}{7!} + \cdots\end{aligned}$$

These are perfect matches for the real and imaginary parts of the complex exponential! Hence,

$$e^{iz} = \cos(z) + i \sin(z).$$

One important consequence of Euler's formula is that

$$\left|e^{i\theta}\right| = \sqrt{\cos^2(\theta) + \sin^2(\theta)} = 1 \qquad \mathrm{for}\; \theta \in \mathbb{R}.$$

Another consequence is that

$$e^{i\pi} = -1,$$

which is a formula that relates two transcendental constants $e = 2.7182818285\dots$ and $\pi = 3.141592654\dots$, by means of the imaginary unit. (We saw a different relationship between these two constants when solving the Gaussian integral.)


In [5]:
## Note: the 'exp' function from Numpy can handle complex numbers.
from numpy import exp, sin, cos
theta = 0.75
print('theta        = ', theta)
print('exp(i*theta) = ', exp(1j*theta))
print('cos(theta)   = ', cos(theta))
print('sin(theta)   = ', sin(theta))


theta        =  0.75
exp(i*theta) =  (0.7316888688738209+0.6816387600233341j)
cos(theta)   =  0.7316888688738209
sin(theta)   =  0.6816387600233341

The complex plane

A convenient way to conceptualize a complex number is to think of it as a point on a two-dimensional plane, called the complex plane. The real and imaginary parts are the horizontal and vertical Cartesian coordinates in the plane. The horizontal ($x$) and vertical ($y$) coordinate axes are called the "real axis" and the "imaginary axis", respectively.

Polar representation

If we think of a complex number as a point on the complex plane, its position can also be represented using polar coordinates instead of Cartesian coordinates. For a complex number $z = x + i y$, we can introduce polar coordinates $r$ and $\theta$ (both real numbers), such that

$$r = \sqrt{x^2 + y^2}, \;\;\; \theta = \tan^{-1}(y/x).$$

Conversely,

$$x = r\cos\theta, \;\;\; y = r\sin\theta.$$

These are the usual formulas for performing a change of coordinate between two-dimensional Cartesian coordinates and polar coordinates, as shown below. The radial coordinate is the magnitude of the complex number: $r = |z|$. The azimuthal coordinate $\theta$ is called the argument of the complex number, which is also denoted by $\mathrm{arg}(z)$.

Note, by the way, that the complex zero, $z = 0$, has zero magnitude and undefined argument.

Using Euler's formula, we can write

$$\begin{align}z &= r\cos(\theta) + i r\sin(\theta)\\&= r \left[\cos(\theta) + i \sin(\theta)\right] \\&= r \, e^{i\theta}.\end{align}$$

Therefore, whenever we can manipulate a complex number into a form $A e^{iB}$, where $A$ and $B$ are real numbers, then $A$ is the magnitude and $B$ is the argument. This is used in the following example:

Example
For $z \in \mathbb{C}$, it can be shown that the magnitude and argument of $\exp(z)$ are:$$\displaystyle\left|\exp(z)\right| = e^{\mathrm{Re}(z)}, \quad \mathrm{arg}\left[\exp(z)\right] = \mathrm{Im}(z).$$
Proof: Let $z = x + i y$, where $x, y \in \mathbb{R}$; then $$e^{z} = e^{x + i y} = e^x \, e^{iy}.$$ By inspection, the magnitude of this complex number is $e^x$, and its argument is $y$.

In [1]:
## Verify the above example numerically:
from scipy import exp, angle

z = 1.5+0.4j
print('z           = ', z)
print('|exp(z)|    = ', abs(exp(z)))
print('exp[Re(z)]  = ', exp(z.real))
print('arg[exp(z)] = ', angle(exp(z)))
print('Im(z)]      = ', z.imag)


z           =  (1.5+0.4j)
|exp(z)|    =  4.48168907034
exp[Re(z)]  =  4.48168907034
arg[exp(z)] =  0.4
Im(z)]      =  0.4

Geometrical interpretation of complex operations

Using the complex plane, we can give useful geometric interpretations to the basic operations on complex numbers:

  • Addition of two complex numbers can be interpreted as the addition of two coordinate vectors. If $z_1 = x_1 + i y_1$ and $z_2 = x_2 + i y_2$, then $$z_1 + z_2 = \left(x_1 + x_2\right) + i\left(y_1 + y_2\right).$$ Hence, the point corresponding to $z_1 + z_2$ is obtained by adding the two coordinate vectors corresponding to $z_1$ and $z_2$. From this, we can geometrically prove a useful inequality relation between complex numbers, called the "triangle inequality": $$|z_1 + z_2| \le |z_1| + |z_2|.$$
  • Complex multiplication can be interpreted as a scaling together with a rotation. If $z_1 = r_1e^{i\theta_1}$ and $z_2 = r_2e^{i\theta_2}$, then $$z_1 z_2 = \left(r_1 r_2\right) \,\exp[i(\theta_1 + \theta_2)].$$ Hence, the point corresponding to $z_1 \, z_2$ is obtained by scaling the $z_1$ coordinate vector by a factor of $|z_2|$, and rotating it by an angle of $\theta_2$ around the origin. In particular, multiplication by $e^{i\theta}$ is equivalent to a rotation by angle $\theta$.
  • Complex conjugation is equivalent to reflection about the real axis. It moves a point from the upper half of the complex plane to the lower half, or vice versa.

Complex numbers have no ordering

One consequence of the fact that complex numbers reside in a two-dimensional plane is that inequality relations are undefined for complex numbers. This is one important difference between complex and real numbers.

Real numbers can be ordered, meaning that for any two real numbers $a$ and $b$, one and only one of the following is true:

$$a < b \;\; \mathrm{OR} \;\; a = b \;\; \mathrm{OR}\;\; a > b.$$

In geometrical terms, these ordering relations exist because the real numbers reside along a one-dimensional line.

But since complex numbers lie in a two-dimensional plane, it is nonsensical to write something like $z_1 < z_2$, where $z_1$ and $z_2$ are complex numbers. (It is, however, valid to write $|z_1| < |z_2|$, since magnitudes are real.)

Complex functions

When deriving Euler's formula, we introduced complex functions that were defined by taking real mathematical functions, like the exponential, and making them accept complex number inputs. Let us take a closer look at how these complex functions behave.

Complex trigonometric functions

The complex sine and cosine functions are defined using the same series expansions as the real cosine and sine functions, except that the inputs $z$ are allowed to be complex:

$$\left\{\begin{array}{l}\displaystyle\sin(z) = z - \frac{z^3}{3!} + \frac{z^5}{5!} - \frac{z^7}{7!} + \cdots\\ \displaystyle\cos(z) = 1 - \frac{z^2}{2!} + \frac{z^4}{4!} - \frac{z^6}{6!} + \cdots,\end{array}\right.\quad\quad z\in \mathbb{C}$$

It is important to note that the outputs of the complex trigonometric functions are complex numbers too.

Some familiar properties of the real trigonometric functions do not apply to the complex versions. For instance, $|\sin(z)|$ and $|\cos(z)|$ are not bounded by 1 when $z$ is not real, as shown in the following example:


In [6]:
from numpy import sin
abs(sin(1j)) # It's larger than one!


Out[6]:
1.1752011936438014

We can also write the complex cosine and sine functions in terms of the exponential:

$$\begin{aligned}\cos(z) &= \;\;\frac{1}{2}\left(e^{iz} + e^{-iz}\right) \\ \sin(z) &= -\frac{i}{2}\left(e^{iz} - e^{-iz}\right).\end{aligned}$$

This is often a convenient step when solving integrals, as shown in the following example.

Example
Consider the real integral
$$I = \int_0^\infty dx \; e^{- x} \, \cos(x).$$
One way to solve this is to use integration by parts, but another way is to use the complex expansion of the cosine function:
$$\begin{align}I &= \int_0^\infty dx \; e^{- x} \,\frac{1}{2}\, \left[e^{ix} + e^{-ix}\right] \\ &= \frac{1}{2} \int_0^\infty dx \; \left[e^{(-1+i)x} + e^{(-1-i)x}\right] \\ &= \frac{1}{2} \left[ \frac{e^{(-1+i) x}}{-1+i} + \frac{e^{(-1 - i) x}}{-1 - i}\right]_0^\infty \\ &= -\frac{1}{2} \left(\frac{1}{-1+i} + \frac{1}{-1 - i}\right) \\ &= \frac{1}{2}.\end{align}$$

Complex trigonometric identities

Euler's formula provides a convenient way to deal with trigonometric functions. Consider the addition formulas

$$\begin{align}\sin(z_1 + z_2) &= \sin(z_1) \cos(z_2) + \cos(z_1)\sin(z_2) \\ \cos(z_1 + z_2) &= \cos(z_1) \cos(z_2) - \sin(z_1)\sin(z_2).\end{align}$$

As discussed previously, the standard proofs for these formulas are geometric: you draw a figure, and solve a bunch of relations between the angles and sides of the various triangles, making use of the Pythagorean formula. But using the Euler formula, we can prove these algebraically. For example,

$$\begin{align}\cos(z_1)\cos(z_2) &= \frac{1}{4}\left(e^{iz_1} + e^{-iz_1}\right) \left(e^{iz_2} + e^{-iz_1}\right)\\&= \frac{1}{4}\left[e^{i(z_1+z_2)} + e^{i(-z_1 + z_2)} + e^{i(z_1 -z_2)} + e^{-i(z_1+z_2)}\right] \\ \sin(z_1)\sin(z_2) &= -\frac{1}{4}\left(e^{iz_1} - e^{-iz_1}\right) \left(e^{iz_2} - e^{-iz_1}\right) \\ &= -\frac{1}{4}\left[e^{i(z_1+z_2)} - e^{i(-z_1 + z_2)} - e^{i(z_1 -z_2)} + e^{-i(z_1+z_2)}\right].\end{align}$$

Thus,

$$\cos(z_1) \cos(z_2) - \sin(z_1)\sin(z_2) = \frac{1}{2}\left[e^{i(z_1+z_2)} + e^{-i(z_1+z_2)}\right] = \cos(z_1 + z_2).$$

As a bonus, these addition formulas now hold for complex inputs as well, not just real inputs.

Hyperbolic functions

Euler's formula also provides us with a link between the trionometric and hyperbolic functions. From the definition of the hyperbolic functions:

$$\sinh(z) = \frac{1}{2}\left(e^{z} - e^{-z}\right), \quad\; \cosh(z) = \frac{1}{2}\left(e^{z} + e^{-z}\right)$$

Compare this to the following formulas for the complex trigonometric functions:

$$\sin(z) = -\frac{i}{2}\left(e^{iz} - e^{-iz}\right), \;\;\; \cos(z) = \;\;\frac{1}{2}\left(e^{iz} + e^{-iz}\right)$$

From this, we can see that the trigonometric and hyperbolic functions are related by

$$\begin{aligned}\sin(z) &= -i \sinh(iz), \quad \cos(z) = \cosh(iz) \\ \sinh(z) &= -i \sin(iz), \quad \cosh(z) = \cos(iz)\end{aligned}$$

Using these relations, we can relate the addition formulas for trignometric formulas to the addition formulas for hyperbolic functions, e.g.

$$\begin{align}\cosh(z_1+z_2) &= \cos(iz_1 + iz_2) \\ &= \cos(iz_1)\cos(iz_2) - \sin(iz_1)\sin(iz_2) \\&= \cosh(z_1)\cosh(z_2) + \sinh(z_1)\sinh(z_2).\end{align}$$

In [6]:
## Note: Python's trigonometric and hyperbolic functions accept
## complex inputs, and handle them correctly.  For example,
from numpy import sin, sinh

z = 1.5+0.2j
val1 = sin(z)
val2 = -1j * sinh(1j*z)

print('sin(z)      = {}'.format(val1))
print('-i sinh(iz) = {}'.format(val2))


sin(z)      = (1.0175114747314913+0.014241945414718512j)
-i sinh(iz) = (1.0175114747314913+0.014241945414718512j)

Trajectories in the complex plane

If we have a function $z(t)$ which takes a real input $t$ and outputs a complex number $z$, it is often useful to plot a curve in the complex plane called the "parametric trajectory" of $z$. Each point on this curve indicates the value of $z$ for a particular value of $t$. We will give a few examples below.

First, consider

$$z(t) = e^{i\omega t}, \quad \omega \in \mathbb{R}.$$

The trajectory is a circle in the complex plane, centered at the origin and with radius 1. To see why, observe that the function has the form $z(t) = r(t)\,e^{i\theta(t)}$, which has magnitude $r(t) = 1$, and argument $\theta(t) = \omega t$ varying proportionally with $t$. If $\omega$ is positive, the argument increases with $t$, so the trajectory is counter-clockwise. If $\omega$ is negative, the trajectory is clockwise.


In [8]:
## Plot the complex plane trajectory of z(t) = exp(i omega t)
%matplotlib inline
from ipywidgets import interact, FloatSlider
from numpy import linspace, sin, cos, pi, exp
import matplotlib.pyplot as plt

def plot_circle(t, omega):
    plt.figure(figsize=(10,5))
    plt.axes().set_aspect('equal', 'datalim')

    phi = linspace(-pi, pi, 50)
    plt.plot(cos(phi), sin(phi), color="grey")  # Plot unit circle as a guide to the eye.

    z = exp(1j * omega * t)
    plt.plot(z.real, z.imag, 'o', color="red", linewidth=4)
    plt.ylim(-1.2, 1.2)
    plt.xlabel('Re(z)'); plt.ylabel('Im(z)');
    plt.show()

interact(plot_circle,
         t     = FloatSlider(min=-5., max=5., step=0.2, value=0.),
         omega = FloatSlider(min=-2., max=2., step=0.2, value=1.));


Next, consider

$$z(t) = e^{(\gamma + i \omega) t},$$

where $\gamma,\omega \in \mathbb{R}.$ For $\gamma = 0$, this reduces to the previous example. For $\gamma \ne 0$, the trajectory is a spiral. To see this, we again observe that this function can be written in the form

$$z(t) = r(t) \;e^{i\theta(t)},$$

where $r(t) = e^{\gamma t}$ and $\theta = \omega t.$ The argument varies proportionally with $t$, so the trajectory loops around the origin. The magnitude increases with $t$ if $\gamma$ is positive, and decreases with $t$ if $\gamma$ is negative. Thus, for instance, if $\gamma$ and $\omega$ are both positive, then the trajectory is an anticlockwise spiral moving outwards from the origin. Try checking how the trajectory behaves when the signs of $\gamma$ and/or $\omega$ are flipping.


In [10]:
## Plot the above complex plane trajectory
%matplotlib inline
from ipywidgets import interact, FloatSlider
from numpy import linspace, exp, sin, cos, pi
import matplotlib.pyplot as plt

def plot_spiral(t,omega, gamma):
    plt.figure(figsize=(10,5))
    plt.axes().set_aspect('equal')
    ## Plot the point z at the specific t
    z = exp((gamma + 1j * omega) * t)
    plt.plot(z.real, z.imag, 'o', color="red", linewidth=4)
    ## Plot the trajectory over a range of t, as a guide to the eye
    t1 = linspace(-30, 30, 1000);  z1 = exp((gamma + 1j * omega) * t1)
    plt.plot(z1.real, z1.imag, color="grey")
    plt.ylim(-5., 5.)
    plt.xlabel('Re(z)'); plt.ylabel('Im(z)')
    plt.show()

interact(plot_spiral,
         t     = FloatSlider(min=-6.0, max=6.0, step=0.1,  value=0.0),
         omega = FloatSlider(min=-2.0, max=2.0, step=0.2,  value=1.0),
         gamma = FloatSlider(min=-0.3, max=0.3, step=0.05, value=0.1));


Finally, consider

$$z(t) = \frac{1}{t + ib}, \quad b \in \mathbb{R}.$$

This trajectory is a circle which passes through the origin, as shown below. The center of the circle is located at $z_0 = -i/(2b)$. Showing this requires a bit of ingenuity, and is left as an exercise. This is an example of something called a Möbius transformation.


In [13]:
## Plot the above complex plane trajectory
%matplotlib inline
from ipywidgets import interact, FloatSlider
from numpy import linspace, exp, sin, cos, pi
import matplotlib.pyplot as plt

def plot_moebius(t, b):
    rlim = 4.0
    plt.figure(figsize=(10,5))
    plt.axes().set_aspect('equal')
    if abs(b) > 1e-6: # Avoid errors for b = 0
        z = 1./(t + 1j * b)
        plt.plot(z.real, z.imag, 'o', color="#e20000", linewidth=4)
        ## Plot overall trajectory via Mobius transform (see Exercises)
        phi = linspace(-pi, pi, 40)
        z0 = -0.5j/b*(1 + exp(1j*phi))
        plt.plot(z0.real, z0.imag, color="#a2a2a2", linewidth=2)
    ## Plot guides to the eye, axis labels, etc.
    plt.plot([-rlim, rlim], [0., 0.], "--", color="grey")
    plt.plot([0., 0.], [-rlim, rlim], "--", color="grey")
    plt.xlabel('Re(z)'); plt.xlim(-rlim, rlim)
    plt.ylabel('Im(z)'); plt.ylim(-rlim, rlim)
    plt.show()

interact(plot_moebius,
         t = FloatSlider(min=-5., max=5.0, step=0.1, value=0.0),
         b = FloatSlider(min=-1.6, max=1.6, step=0.1, value=0.5));


Why complex numbers?

Here are some questions that might have occurred to you:

  • If we extend the concept of numbers to complex numbers, why stop here? Why not extend the concept further, and formulate other abstract number systems that are even more complicated than complex numbers?
  • Integers and real numbers have intuitive connections to the phenomena we experience in everyday life, such as the counting of discrete objects, or measuring lengths and weights. Complex numbers, however, seem like completely abstract concepts. Why should we study them?

As we have seen, complex numbers are appealing mathematical objects because they can be manipulated via the same rules of algebra as real numbers. We can add, subtract, multiply, and divide them (apart from division by zero), without running into any logical inconsistencies. One limitation is that complex numbers cannot be ordered, so complex algebra only involves equations, not inequality relations.

One very important feature possessed by complex numbers and not real numbers is that the complex numbers are algebraically closed. This means that all complex polynomial equations have solutions in $\mathbb{C}$. The set of real numbers, $\mathbb{R}$, lacks this property: there are certain real algebraic equations, like $x^2 + 1 = 0$, which have no solution in $\mathbb{R}$. The "closure" property of $\mathbb{C}$ is called the Fundamental Theorem of Algebra, which gives an idea of its importance. As a consequence, $\mathbb{C}$ cannot be generalized to a more complicated number system via the same route used to extend $\mathbb{R}$ into $\mathbb{C}$.

There do exist number systems more complicated than the complex numbers, which are formulated not by algebraic extension but by discarding one or more of the usual rules of algebra. The quaternions are a system of four-component numbers obeying an algebra that is non-commutative (i.e., $ab = ba$ is not generally true). The octonions are an even more complicated system of eight-component numbers which are not only non-commutative but also non-associative (i.e., $(ab)c = a(bc)$ is not generally true). These and other still-more-complicated number systems have a few applications in physics and other fields, but are overall much less important than $\mathbb{C}$.

One big reason that complex numbers have proven to be so important and useful is that it's easy to formulate a version of calculus for them. The study of smooth complex functions, and their derivatives and integrals, is called complex analysis. We will discuss this subject extensively later in the course. We shall see that complex analysis has important implications for the real calculus; for example, many real integrals can be easily solved by first generalizing them into complex integrals. By contrast, since quaternions and octonions are not commutative, the concept of "derivative" is tricky to define for these number systems, making it harder to formulate a useful calculus with them.

Exercises

  1. Let $z = x + iy$, where $x, y \in \mathbb{R}$. For each of the following expressions, find (i) the real part, (ii) the imaginary part, (iii) the magnitude, and (iv) the complex argument, in terms of $x$ and $y$:
    1. $z^2$
    2. $1/z$
    3. $\exp(z)$
    4. $\exp(iz)$
    5. $\cos(z)$
  2. Prove that $|z_1 z_2| = |z_1|\, |z_2|$, by using (i) the polar representation, and (ii) the Cartesian representation. (Solution)
  3. Prove that $(z_1 z_2)^* = z_1^* z_2^*$, by using (i) the polar representation, and (ii) the Cartesian representation. (Solution)
  4. Identify the problem with this chain of equations: $-1 = i \cdot i = \sqrt{-1}\,\sqrt{-1} = \sqrt{-1 \cdot -1} = \sqrt{1} = 1.$ (Solution)
  5. With the aid of Euler's formula, prove that $$\begin{aligned}\cos(3x) &= 4[\cos(x)]^3 -3\cos(x) \\ \sin(3x) &= 3\sin(x)-4[\sin(x)]^3\end{aligned}$$
  6. For $z_1, z_2 \in \mathbb{C}$ and $\theta \in \mathbb{R}$, show that $\mathrm{Re}\left[z_1 e^{i\theta} + z_2 e^{-i\theta}\right] = A \cos(\theta) + B \sin(\theta)$, for some $A, B \in \mathbb{R}$. Find explicit expressions for $A$ and $B$ in terms of $z_1$ and $z_2$.
  7. In the complex plane, the conjugation operation corresponds to a reflection about the real axis. What operation corresponds to a reflection about the imaginary axis?
  8. Consider the complex function of a real variable $z(t) = 1/(\alpha t + \beta)$, where $\alpha, \beta \in \mathbb{C}$ and $t \in \mathbb{R}$.
    1. For $\alpha = 1$ and $\beta = i$, show that $z(t)$ can be re-expressed as $z(s) = (1+e^{is})/(2i)$, where $s \in (-\pi,\pi)$. Hint: find a real mapping $t(s)$.
    2. Hence, show that the trajectory for arbitrary complex values of $\alpha,\, \beta$ has the form of a circle.
  9. With the help of a computer plotting program, generate complex trajectories for the following functions (for real inputs $t \in\mathbb{R}$). Explain their key features, including the directions of the trajectories:
    1. $\displaystyle z(t) = \left[1+\frac{\cos(\beta t)}{2}\right] \, \exp(it)$, for $\beta = 10$ and for $\beta = \sqrt{5}$.
    2. $\displaystyle z(t) = -it \pm \sqrt{1 - t^2}$.
    3. $\displaystyle z(t) = ae^{it} + be^{-it}$, for $a = 1, b = -2$ and for $a = 1, b = 2$.