Complex Adventures


I am currently reading Maths 10011 and the part about the Riemann hypothesis and complex analysis was very interesting. (There were no visualizations so I tried to find some online and of course 3Blue1Brown has a fantastic video about it!2)

However I wanted to try visualize basic complex functions on my own a bit so here are some notes:

Complex functions map complex numbers to complex numbers:

f:CC f : \mathbb{C} \rightarrow \mathbb{C}

A complex number (C\mathbb{C}) is sort of a “two dimensional number”. Usually complex numbers are denoted as

z=a+biz = a + bi

where aa is like the x-coordinate and bb like the y-coordinate of the point (a,b)(a,b). The mysterious ii is the imaginary unit, which simply follows the rule i2=1i^2=-1. Having this nice “flat” form makes it easy to just calculate with it just as with any ordinary other number. So you can add, multiply, subtract, etc. with it.

Just like “normal” functions one can define functions taking complex numbers and spitting out complex numbers, such as

f(z)=z21 f(z) = z^2 - 1

As this maps two dimensional numbers (C\mathbb{C}) to other two dimensional numbers (C\mathbb{C}), one would need four axis to completely plot a complex function. Sadly we live in a three dimensional world. That means we need to find some tricks to visualize complex functions.

One such trick is “domain coloring”3. This maps every complex number to a distinct color. For example the plot for the identity function

f(z)=z f(z) = z

looks like this:

This simply maps each complex number to itself and then assigns a color to it. Complex numbers to the right of the origin are red, to the left cyan, above purple and below green. Big complex numbers are bright and the closer to the origin the darker the color. Finally 0+0i0 + 0i is black.

Now for a more interesting function:

f(z)=z21 f(z) = z^2 - 1

Plotting this function for the real numbers only would give a parabola:

complex function plot

This parabola has two “roots”, that is two points where the function is zero. These are the points where the parabola crosses the x-axis. Looking at the graph one can see that the roots are at x=1x = -1 and x=1x = 1.

Now imagine looking at this graph from the top. In our domain coloring, the roots, which are the points where the parabola is zero, are black.

If we look at the graph for

f(z)=z2 f(z) = z^2

for the real numbers only we get a parabola that crosses the x-axis at x=0x = 0.

complex function plot

Plotting it for the complex plane we get:

This also shows a single black spot at the origin.

Now things get interesting when we look at the function

f(z)=z2+1 f(z) = z^2 + 1

This function has no roots in the real numbers, as the square of any real number is positive.

complex function plot

Plotting it in the complex plane we get:

This still has two black spots! Those spots are located at ii and i-i. As per definition i2=1i^2 = -1 and (i)2=1(-i)^2 = -1 the function is zero at those points:

f(i)=i2+1=1+1=0 f(i) = i^2 + 1 = -1 + 1 = 0

f(i)=(i)2+1=1+1=0 f(-i) = (-i)^2 + 1 = -1 + 1 = 0

If you interpolate between the two functions z21z^2 - 1 and z2+1z^2 + 1 you can get a feel how the roots move around in the complex plane.

For more fun! The number of roots (black spots) of a complex function is dependent on the exponent of zz.

For example the function

f(z)=z31 f(z) = z^3 - 1

has three roots in the complex plane.

By the way the same is true for inverse exponents. For example the function

f(z)=z31 f(z) = z^{-3} -1

has three roots in the complex plane.

Playing around with some interpolation of the exponent shows that the higher the exponent the more black spots the function has:

By the way rotating a function can be done by multiplying it with a complex number, so for example rotating it by 90 degrees can be done by multiplying it with ii.

For making a function rotate with time you can multiply it with eite^{i*t}:

f(z)=zeit f(z) = z * e^{i*t}

Playground:

Footnotes

  1. https://richardelwes.co.uk/mathematics-1001/

  2. https://www.youtube.com/watch?v=sD0NjbwqlYw

  3. https://en.wikipedia.org/wiki/Domain_coloring