© Springer Nature Switzerland AG 2018
Michael Oberguggenberger and Alexander OstermannAnalysis for Computer ScientistsUndergraduate Topics in Computer Sciencehttps://doi.org/10.1007/978-3-319-91155-7_4

4. Complex Numbers

Michael Oberguggenberger1   and Alexander Ostermann1  
(1)
University of Innsbruck, Innsbruck, Austria
 
 
Michael Oberguggenberger (Corresponding author)
 
Alexander Ostermann

Complex numbers are not just useful when solving polynomial equations but play an important role in many fields of mathematical analysis. With the help of complex functions transformations of the plane can be expressed, solution formulas for differential equations can be obtained, and matrices can be classified. Not least, fractals can be defined by complex iteration processes. In this section we introduce complex numbers and then discuss some elementary complex functions, like the complex exponential function. Applications can be found in Chaps. 9 (fractals), 20 (systems of differential equations) and in Appendix B (normal form of matrices).

4.1 The Notion of Complex Numbers

The set of complex numbers $$\mathbb C$$ represents an extension of the real numbers, in which the polynomial $$z^2 +1$$ has a root. Complex numbers can be introduced as pairs (ab) of real numbers for which addition and multiplication are defined as follows:
$$\begin{aligned} (a,b) + (c,d)= & {} (a + c, b + d),\\ (a,b)\cdot (c, d)= & {} (ac - bd, ad + bc). \end{aligned}$$
The real numbers are considered as the subset of all pairs of the form $$(a, 0), a \in \mathbb R$$. Squaring the pair (0, 1) shows that
$$ (0,1)\cdot (0,1) = (-1,0). $$
The square of (0, 1) thus corresponds to the real number $$-1$$. Therefore, (0, 1) provides a root for the polynomial $$z^2+1$$. This root is denoted by $$\mathrm{i}$$; in other words
$$ \mathrm{i}^2 = -1. $$
Using this notation and rewriting the pairs (ab) in the form $$a + \mathrm{i}b$$, one obtains a computationally more convenient representation of the set of complex numbers:
$$ \mathbb C= \{a + \mathrm{i}b\;;\; a \in \mathbb R, b \in \mathbb R\}. $$
The rules of calculation with pairs (ab) then simply amount to the common calculations with the expressions $$a+\mathrm{i}b$$ like with terms with the additional rule that $$\mathrm{i}^2 = -1$$:
$$\begin{aligned} (a + \mathrm{i}b) + (c + \mathrm{i}d)= & {} a + c + \mathrm{i}(b+d),\\ (a + \mathrm{i}b) (c + \mathrm{i}d)= & {} ac + \mathrm{i}bc + \mathrm{i}ad + \mathrm{i}^{2} bd\\= & {} ac - bd + \mathrm{i}(ad + bc). \end{aligned}$$
So, for example,
$$\begin{aligned} (2 + 3\mathrm{i}) (-1 + \mathrm{i}) = -5 - \mathrm{i}. \end{aligned}$$

Definition 4.1

For the complex number $$z = x + \mathrm{i}y$$,
$$ x = {{\text {Re}}}\,z,\quad y = {{\text {Im}}}\, z $$
denote the real part and the imaginary part of z, respectively. The real number
$$ |z| = \sqrt{x^2 + y^2} $$
is the absolute value (or modulus) of z, and
$$ \bar{z} = x - \mathrm{i}y $$
is the complex conjugate to z.
A simple calculation shows that
$$ z \bar{z} = (x + \mathrm{i}y) (x - \mathrm{i}y) = x^2 + y^2 = |z|^2, $$
which means that $$z \bar{z}$$ is always a real number. From this we obtain the rule for calculating with fractions
$$ \frac{u+\mathrm{i}v}{x+\mathrm{i}y} = \left( \frac{u+\mathrm{i}v}{x+\mathrm{i}y}\right) \left( \frac{x-\mathrm{i}y}{x-\mathrm{i}y}\right) = \frac{(u+\mathrm{i}v)(x-\mathrm{i}y)}{x^2 + y^2} = \frac{ux + vy}{x^2+y^2} + \mathrm{i}\frac{vx - uy}{x^2+y^2}\,. $$
It is achieved by expansion with the complex conjugate of the denominator. Apparently one can therefore divide by any complex number not equal to zero, and the set $$\mathbb C$$ forms a field.

Experiment 4.2

Type in MATLAB: z = complex(2,3) (equivalently z = 2+3*i or z = 2+3*j) as well as w = complex(-1,1) and try out the commands z * w, z/w as well as real(z), imag(z), conj(z), abs(z).

Clearly every negative real x has two square roots in $$ \mathbb C$$, namely $$\mathrm{i}\sqrt{|x|}$$ and $$-\mathrm{i}\sqrt{|x|}$$. More than that the fundamental theorem of algebra says that $$\mathbb C$$ is algebraically closed. Thus every polynomial equation
$$ \alpha _n z^n + \alpha _{n-1} z ^{n-1}\, \cdots \, + \alpha _1 z + \alpha _0 = 0 $$
with coefficients $$\alpha _j \in \mathbb C,\; \alpha _n \ne 0$$ has n complex solutions (counted with their multiplicity).

Example 4.3

(Taking the square root of complex numbers)   The equation $$z^2 = a+\mathrm{i}b$$ can be solved by the ansatz
$$ (x + \mathrm{i}y)^2 = a + \mathrm{i}b $$
so
$$ x^2 - y^2 = a,\ 2 xy = b. $$
If one uses the second equation to express y through x and substitutes this into the first equation, one obtains the quartic equation
$$ x^4-ax^2-b^2/4 = 0. $$
Solving this by substitution $$t=x^2$$ one obtains the two real solutions. In the case of $$b=0$$, either x or y equals zero depending on the sign of a.
The complex plane. A geometric representation of the complex numbers is obtained by identifying $$z = x + \mathrm{i}y \in \mathbb C$$ with the point $$(x, y) \in \mathbb R^2$$ in the coordinate plane (Fig. 4.1). Geometrically $$|z| = \sqrt{x^2+y^2}$$ is the distance of point (xy) from the origin; the complex conjugate $$\bar{z} = x - \mathrm{i}y$$ is obtained by reflection in the x-axis.
images/215236_2_En_4_Chapter/215236_2_En_4_Fig1_HTML.gif
Fig. 4.1

Complex plane

The polar representation of a complex number $$z = x + \mathrm{i}y$$ is obtained like in Application 3.​4 by
$$ r= |z|,\qquad \varphi = \arg \, z. $$
The angle $$\varphi $$ to the positive x-axis is called argument of the complex number, whereupon the choice of the interval $$- \pi < \varphi \le \pi $$ defines the principal value $${{\text {Arg}}}\, z$$ of the argument. Thus
$$ z = x + \mathrm{i}y = r (\cos \varphi + \mathrm{i}\sin \varphi ). $$
The multiplication of two complex numbers $$z = r(\cos \varphi + \mathrm{i}\sin \varphi )$$, $$w = s (\cos \psi + \mathrm{i}\sin \psi )$$ in polar representation corresponds to the product of the absolute values and the sum of the angles:
$$ zw = rs \big (\!\cos (\varphi + \psi ) + \mathrm{i}\sin (\varphi + \psi )\big )\,, $$
which follows from the addition formulas for sine and cosine:
$$\begin{aligned} \sin (\varphi + \psi )= & {} \sin \varphi \cos \psi + \cos \varphi \sin \psi ,\\ \cos (\varphi + \psi )= & {} \cos \varphi \cos \psi - \sin \varphi \sin \psi , \end{aligned}$$
see Proposition 3.​3.

4.2 The Complex Exponential Function

An important tool for the representation of complex numbers and functions, but also for the real trigonometric functions, is given by the complex exponential function. For $$z = x + \mathrm{i}y$$ this function is defined by
$$ \mathrm{e}^z = \mathrm{e}^x (\cos y + \mathrm{i}\sin y). $$
The complex exponential function maps $$\mathbb C$$ to $$\mathbb C\setminus \{0\}$$. We will study its mapping behaviour below. It is an extension of the real exponential function; i.e. if $$z = x \in \mathbb R$$, then $$\mathrm{e}^z =\mathrm{e}^x$$. This is in accordance with the previously defined real-valued exponential function. We also use the notation $$\exp (z)$$ for $$\mathrm{e}^z$$.
The addition theorems for sine and cosine imply the usual rules of calculation
$$ \mathrm{e}^{z+w} = \mathrm{e}^z\mathrm{e}^w,\quad \mathrm{e}^0 = 1,\quad (\mathrm{e}^z)^n = \mathrm{e}^{nz}, $$
valid for $$z, w \in \mathbb C$$ and $$n\in \mathbb Z$$. In contrast to the case when z is a real number, the last rule (for raising to powers) is generally not true, if n is not an integer.
Exponential function and polar coordinates. According to the definition the exponential function of a purely imaginary number $$\mathrm{i}\varphi $$ equals
$$\begin{aligned} \mathrm{e}^{\mathrm{i}\varphi }= & {} \cos \varphi + \mathrm{i}\sin \varphi ,\\ |\mathrm{e}^{\mathrm{i}\varphi }|= & {} \textstyle \sqrt{\cos ^2\varphi + \sin ^2\varphi } \; = \; 1. \end{aligned}$$
Thus the complex numbers
$$ \{\mathrm{e}^{\mathrm{i}\varphi }\;;\; - \pi < \varphi \le \pi \} $$
lie on the unit circle (Fig. 4.2).
images/215236_2_En_4_Chapter/215236_2_En_4_Fig2_HTML.gif
Fig. 4.2

The unit circle in the complex plane

For example, the following identities hold:
$$ \mathrm{e}^{\mathrm{i}\pi /2} = \mathrm{i},\quad \mathrm{e}^{\mathrm{i}\pi } = -1,\quad \mathrm{e}^{2 \mathrm{i}\pi } = 1,\quad \mathrm{e}^{2k \mathrm{i}\pi } = 1\ (k \in \mathbb Z). $$
Using $$r = |z|$$, $$\varphi = {\text {Arg}}\, z$$ results in the especially simple form of the polar representation
$$ z = r \mathrm{e}^{\mathrm{i}\varphi }. $$
Taking roots is accordingly simple.

Example 4.4

(Taking square roots in complex polar coordinates)   If $$z^2 = r \mathrm{e}^{\mathrm{i}\varphi }$$, then one obtains the two solutions $$\pm \sqrt{r}\,\mathrm{e}^{\mathrm{i}\varphi /2}$$ for z. For example, the problem
$$ z^2 = 2\mathrm{i}= 2\,\mathrm{e}^{\mathrm{i}\pi /2} $$
has the two solutions
$$ z = \sqrt{2}\,\mathrm{e}^{\mathrm{i}\pi /4} = 1 + \mathrm{i}$$
and
$$ z = -\sqrt{2}\,\mathrm{e}^{\mathrm{i}\pi /4} = -1 - \mathrm{i}. $$
Euler’s formulas. By addition and subtraction, respectively, of the relations
$$\begin{aligned} \mathrm{e}^{\mathrm{i}\varphi }= & {} \cos \varphi + \mathrm{i}\sin \varphi ,\\ \mathrm{e}^{-\mathrm{i}\varphi }= & {} \cos \varphi - \mathrm{i}\sin \varphi , \end{aligned}$$
one obtains at once Euler’s formulas
$$\begin{aligned} \cos \varphi= & {} \frac{1}{2} \big (\mathrm{e}^{\mathrm{i}\varphi } + \mathrm{e}^{-\mathrm{i}\varphi }\big ),\\ \sin \varphi= & {} \frac{1}{2 \mathrm{i}} \big (\mathrm{e}^{\mathrm{i}\varphi } - \mathrm{e}^{-\mathrm{i}\varphi }\big ). \end{aligned}$$
They permit a representation of the real trigonometric functions by means of the complex exponential function.

4.3 Mapping Properties of Complex Functions

In this section we study the mapping properties of complex functions. More precisely, we ask how their effect can be described geometrically. Let
$$ f: D \subset \mathbb C\rightarrow \mathbb C: z \mapsto w = f(z) $$
be a complex function, defined on a subset D of the complex plane. The effect of the function f can best be visualised by plotting two complex planes next to each other, the z-plane and the w-plane, and studying the images of rays and circles under f.

Example 4.5

The complex quadratic function maps $$D = \mathbb C$$ to $$\mathbb C: w = z^2$$. Using polar coordinates one obtains
$$ z = x + \mathrm{i}y = r\,\mathrm{e}^{\mathrm{i}\varphi }\quad \Rightarrow \quad w = u + \mathrm{i}v = r^2\mathrm{e}^{2\mathrm{i}\varphi }. $$
From this representation it can be seen that the complex quadratic function maps a circle of radius r in the z-plane onto a circle of radius $$r^2$$ in the w-plane. Further, it maps half-rays
$$ \{z = r\mathrm{e}^{\mathrm{i}\psi }:r > 0\} $$
with the angle of inclination $$\psi $$ onto half-rays with angle of inclination $$2\psi $$ (Fig. 4.3).
images/215236_2_En_4_Chapter/215236_2_En_4_Fig3_HTML.gif
Fig. 4.3

The complex quadratic function

Particularly important are the mapping properties of the complex exponential function $$w = \mathrm{e}^z$$ because they form the basis for the definition of the complex logarithm and the root functions. If $$z = x + \mathrm{i}y$$ then $$\mathrm{e}^z = \mathrm{e}^x(\cos y + \mathrm{i}\sin y)$$. We always have that $$\mathrm{e}^x > 0$$; furthermore $$\cos y + \mathrm{i}\sin y$$ defines a point on the complex unit circle which is unique for $$-\pi < y \le \pi $$. If x moves along the real line then the points $$\mathrm{e}^x(\cos y + \mathrm{i}\sin y)$$ form a half-ray with angle y, as can be seen in Fig. 4.4. Conversely, if x is fixed and y varies between $$-\pi $$ and $$\pi $$ one obtains the circle with radius $$\mathrm{e}^x$$ in the w-plane. For example, the dotted circle (Fig. 4.4, right) is the image of the dotted straight line (Fig. 4.4, left) under the exponential function.

From what has just been said it follows that the exponential function is bijective on the domain
$$ D = \{z = x+\mathrm{i}y\;;\; x \in \mathbb R, -\pi < y \le \pi \} \rightarrow B = \mathbb C\setminus \{0\}. $$
It thus maps the strip of width $$2\pi $$ onto the complex plane without zero. The argument of $$\mathrm{e}^z$$ exhibits a jump along the negative u-axis as indicated in Fig. 4.4 (right). Within the domain D the exponential function has an inverse function, the principal branch of the complex logarithm. From the representation $$w = \mathrm{e}^z = \mathrm{e}^x\mathrm{e}^{\mathrm{i}y}$$ one derives at once the relation $$x = \log |w|$$, $$y = {\text {Arg}}\, w$$. Thus the principal value of the complex logarithm of the complex number w is given by
$$ z = {{\text {Log}}}\,w = \log |w| + \mathrm{i}{{\text {Arg}}}\, w $$
and in polar coordinates
$$ {\text {Log}}\left( r\,\mathrm{e}^{\mathrm{i}\varphi }\right) = \log r + \mathrm{i}\varphi ,\quad -\pi < \varphi \le \pi , $$
respectively.
images/215236_2_En_4_Chapter/215236_2_En_4_Fig4_HTML.gif
Fig. 4.4

The complex exponential function

With the help of the principal value of the complex logarithm, the principal values of the nth complex root function can be defined by $$\root n \of {z} = \exp \left( \frac{1}{n}{\text {Log}}(z)\right) .$$

Experiment 4.6

Open the applet 2D visualisation of complex functions and investigate how the power functions $$w = z^n, n \in \mathbb N$$, map circles and rays of the complex plane. Set the pattern polar coordinates and experiment with different sectors (intervals of the argument $$[\alpha ,\beta ]$$ with $$0 \le \alpha < \beta \le 2\pi $$).

Experiment 4.7

Open the applet 2D visualisation of complex functions and investigate how the exponential function $$w = \mathrm{e}^z$$ maps horizontal and vertical straight lines of the complex plane. Set the pattern grid and experiment with different strips, for example $$1 \le {{\text {Re}}}\, z \le 2, -2 \le {{\text {Im}}}\, z \le 2$$.

4.4 Exercises

1.
Compute $${{\text {Re}}}\, z$$, $$ {{\text {Im}}}\, z, \bar{z}$$ and |z| for each of the following complex numbers z:
$$ z = 3 + 2\mathrm{i}, \quad z = -\mathrm{i}, \quad z = \frac{1 + \mathrm{i}}{2 - \mathrm{i}}, \quad z = 3 - \mathrm{i}+ \frac{1}{3 - \mathrm{i}}, \quad z = \frac{1 - 2\mathrm{i}}{4 - 3\mathrm{i}}\,. $$
Perform these calculations in MATLAB as well.
2.
Rewrite the following complex numbers in the form $$z = r \mathrm{e}^{\mathrm{i}\varphi }$$ and sketch them in the complex plane:
$$ z = - 1 - \mathrm{i}, \quad z = - 5, \quad z = 3\mathrm{i}, \quad z = 2 - 2\mathrm{i}, \quad z = 1 - \mathrm{i}\sqrt{3}. $$
What are the values of $$\varphi $$ in radian measure?
3.
Compute the two complex solutions of the equation
$$\begin{aligned} z^2 = 2 + 2\mathrm{i}\end{aligned}$$
with the help of the ansatz $$z = x + \mathrm{i}y$$ and equating the real and the imaginary parts. Test and explain the MATLAB commands
$$ \begin{array}{l} {\texttt {roots([2,0,-2\,-\, 2\,*i])}}\\ {\texttt {sqrt(2\,+\, 2\,*i)}} \end{array} $$
4.
Compute the two complex solutions of the equation
$$\begin{aligned} z^2 = 2 + 2\mathrm{i}\end{aligned}$$
in the form $$ z = r \mathrm{e}^{\mathrm{i}\varphi }$$ from the polar representation of $$2+2\mathrm{i}$$.
5.
Compute the four complex solutions of the quartic equation
$$ z^4 - 2z^2 +2 = 0 $$
by hand and with MATLAB (command roots).
6.

Let $$z = x + \mathrm{i}y, w = u + \mathrm{i}v$$. Check the formula $$\mathrm{e}^{z+w} = \mathrm{e}^z\mathrm{e}^w$$ by using the definition and applying the addition theorems for the trigonometric functions.

7.
Compute $$z = {\text {Log}}w$$ for
$$ w = 1+\mathrm{i},\quad w = -5\mathrm{i},\quad w = -1. $$
Sketch w and z in the complex plane and verify your results with the help of the relation $$w = \mathrm{e}^z$$ and with MATLAB (command log).
8.
The complex sine and cosine functions are defined by
$$ \sin z = \frac{1}{2\mathrm{i}}\big (\mathrm{e}^{\mathrm{i}z} - \mathrm{e}^{-\mathrm{i}z}\big ),\quad \cos z = \frac{1}{2}\big (\mathrm{e}^{\mathrm{i}z} + \mathrm{e}^{-\mathrm{i}z}\big ) $$
for $$z\in \mathbb C$$.
(a)

Show that both functions are periodic with period $$2\pi $$, that is $$\sin (z + 2\pi ) = \sin z$$, $$\cos (z+2\pi ) = \cos z$$.

(b)
Verify that, for $$z = x+\mathrm{i}y$$,
$$ \sin z = \sin x\cosh y + \mathrm{i}\cos x \sinh y,\quad \cos z = \cos x\cosh y - \mathrm{i}\sin x \sinh y. $$
(c)

Show that $$\sin z = 0$$ if and only if $$z = k\pi $$, $$k\in \mathbb Z$$, and $$\cos z = 0$$ if and only if $$z = (k +\frac{1}{2})\pi $$, $$k\in \mathbb Z$$.