## Fractals Generated by Complex Numbers

### Learning Outcomes

• Identify the difference between an imaginary number and a complex number
• Identify the real and imaginary parts of a complex number
• Plot a complex number on the complex plane
• Perform arithmetic operations on complex numbers
• Graph physical representations of arithmetic operations on complex numbers as scaling or rotation
• Generate several terms of a recursive relation
• Determine whether a complex number is part of the set of numbers that make up the Mandelbrot set

You may be familiar with the fractal in the image below.  The boundary of this shape exhibits quasi-self-similarity, in that portions look very similar to the whole. This object is called the Mandelbrot set and is generated by iterating a simple recursive rule using complex numbers.

In this lesson, you will first learn about the arithmetic of complex numbers so you can understand how a fractal like the Mandelbrot set is generated.

## Arithmetic with Complex Numbers

[1]
The numbers you are most familiar with are called real numbers. These include numbers like 4, 275, -200, 10.7, ½, π, and so forth. All these real numbers can be plotted on a number line. For example, if we wanted to show the number 3, we plot a point:

To solve certain problems like $x^{2}=–4$, it became necessary to introduce imaginary numbers.

### Imaginary Number i

The imaginary number i is defined to be $i=\sqrt{-1}$.

Any real multiple of i, like 5i, is also an imaginary number.

### Example

Simplify $\sqrt{-9}$.

We can separate $\sqrt{-9}$ as $\sqrt{9}\sqrt{-1}$. We can take the square root of 9, and write the square root of $-1$ as i.

$\sqrt{-9}=\sqrt{9}\sqrt{-1}=3i$

A complex number is the sum of a real number and an imaginary number.

### Complex Number

A complex number is a number $z=a+bi$, where

• a and b are real numbers
• a is the real part of the complex number
• b is the imaginary part of the complex number

To plot a complex number like $3-4i$, we need more than just a number line since there are two components to the number. To plot this number, we need two number lines, crossed to form a complex plane.

### Complex Plane

In the complex plane, the horizontal axis is the real axis and the vertical axis is the imaginary axis.

### Example

Plot the number $3-4i$ on the complex plane.

The real part of this number is 3, and the imaginary part is $-4$. To plot this, we draw a point 3 units to the right of the origin in the horizontal direction and 4 units down in the vertical direction.

### Try It

Because this is analogous to the Cartesian coordinate system for plotting points, we can think about plotting our complex number $z=a+bi$ as if we were plotting the point (a, b) in Cartesian coordinates. Sometimes people write complex numbers as $z=x+yi$ to highlight this relation.

### Arithmetic on Complex Numbers

Before we dive into the more complicated uses of complex numbers, let’s make sure we remember the basic arithmetic involved. To add or subtract complex numbers, we simply add the like terms, combining the real parts and combining the imaginary parts.

### Example

Add $3-4i$ and $2+5i$.

Adding $(3-4i)+(2+5i)$, we add the real parts and the imaginary parts.

$3+2-4i+5i$

$5+i$

### Try It

Subtract $2+5i$ from $3-4i$.

In the following video, we present more worked examples of arithmetic with complex numbers.

When we add complex numbers, we can visualize the addition as a shift, or translation, of a point in the complex plane.

### Example

Visualize the addition $3-4i$ and $-1+5i$.

The initial point is $3-4i$. When we add $-1+3i$, we add $-1$ to the real part, moving the point 1 units to the left, and we add 5 to the imaginary part, moving the point 5 units vertically. This shifts the point $3-4i$ to $2+1i$.

### Try It

We can also multiply complex numbers by a real number, or multiply two complex numbers.

### Example

Multiply: $4\left(2+5i\right)$

To multiply the complex number by a real number, we simply distribute as we would when multiplying polynomials.

Distribute and simplify.

$4(2+5i)\\\,\,\,= 4\cdot2+4\cdot5i\\\,\,\,=8+20i$

### Example

Multiply: $(2+5i)(4+i)$.

$\begin{array}{l}\left(2+5i\right)\left(4+i\right)\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\text{Expand.}\\=8+20i+2i+5i^{2}\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\text{Since }i=\sqrt{-1},i^{2}=-1\\=8+20i+2i+5\left(-1\right)\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\text{Simplify.}\\=3+22i\end{array}$

### Try It

Multiply $3-4i$ and $2+3i$.

To understand the effect of multiplication visually, we’ll explore three examples.

### Example

Visualize the product $2(1+2i)$.

Multiplying we’d get

\begin{align}&2\cdot1+2\cdot2i\\&=2+4i\\\end{align}

Notice both the real and imaginary parts have been scaled by 2. Visually, this will stretch the point outwards, away from the origin.

### Example

Visualize the product $i\left(l+2i\right)$.

Multiplying, we’d get

\begin{align}&i\cdot1+i\cdot2i\\&=i+2{{i}^{2}}\\&=i+2(-1)\\&=-2+i\\\end{align}

In this case, the distance from the origin has not changed, but the point has been rotated about the origin, 90° counter-clockwise.

### Try It

Multiply $3-4i$ and $2+3i$.

### Example

Visualize the result of multiplying $1+2i$ by $1+i$. Then show the result of multiplying by $1+i$ again.

Multiplying $1+2i$ by $1+i$,

$-4+2i$

\begin{align}&(1+2i)(1+i)\\&=1+i+2i+2{{i}^{2}}\\&=1+3i+2(-1)\\&=-1+3i\\\end{align}

Multiplying by $1+i$ again,

\begin{align}&(-1+3i)(1+i)\\&=-1-i+3i+3{{i}^{2}}\\&=-1+2i+3(-1)\\&=-4+2i\\\end{align}

If we multiplied by $1+i$ again, we’d get $–6–2i$. Plotting these numbers in the complex plane, you may notice that each point gets both further from the origin, and rotates counterclockwise, in this case by 45°.

In general, multiplication by a complex number can be thought of as a scaling, changing the distance from the origin, combined with a rotation about the origin.

### Try It

The following video presents more examples of how to visualize the results of arithmetic on complex numbers.

In the following video, we present more worked examples of arithmetic with complex numbers.

## Generating Fractals with Complex Numbers

### Complex Recursive Sequences

Some fractals are generated with complex numbers.  The Mandlebrot set, which we introduced briefly at the beginning of this module, is generated using complex numbers with a recursive sequence. Before we can see how to generate the Mandelbrot set, we need to understand what a recursive sequence is.

### Recursive Sequence

A recursive relationship is a formula which relates the next value, ${{z}_{n+1}}$, in a sequence to the previous value, ${{z}_{n}}$. In addition to the formula, we need an initial value, ${{z}_{0}}$.

The sequence of values produced is the recursive sequence.

### Example

Given the recursive relationship ${{z}_{n+1}}={{z}_{n}}+2,\quad{{z}_{0}}=4$, generate several terms of the recursive sequence.

We are given the starting value, ${{z}_{0}}=4$. The recursive formula holds for any value of n, so if $n = 0$, then ${{z}_{n+1}}={{z}_{n}}+2$ would tell us ${{z}_{0+1}}={{z}_{0}}+2$, or more simply, ${{z}_{1}}={{z}_{0}}+2$.

Notice this defines ${{z}_{1}}$ in terms of the known ${{z}_{0}}$, so we can compute the value:

${{z}_{1}}={{z}_{0}}+2=4+2=6$.

Now letting $n = 1$, the formula tells us ${{z}_{1+1}}={{z}_{1}}+2$, or ${{z}_{2}}={{z}_{1}}+2$. Again, the formula gives the next value in the sequence in terms of the previous value.

${{z}_{2}}={{z}_{1}}+2=6+2=8$

Continuing,

${{z}_{3}}={{z}_{2}}+2=8+2=10\\{{z}_{4}}={{z}_{3}}+2=10+2=12$

### Try It

The previous example generated a basic linear sequence of real numbers. The same process can be used with complex numbers.

### Example

Given the recursive relationship ${{z}_{n+1}}={{z}_{n}}\cdot{i}+(1-i),\quad{{z}_{0}}=4$, generate several terms of the recursive sequence.

We are given ${{z}_{0}}=4$. Using the recursive formula:

${{z}_{1}}={{z}_{0}}\cdot{i}+(1-i)=4\cdot{i}+(1-i)=1+3i\\{{z}_{2}}={{z}_{1}}\cdot{i}+(1-i)=(1+3i)\cdot{i}+(1-i)=i+3{{i}^{2}}+(1-i)=i-3+(1-i)=-2\\{{z}_{3}}={{z}_{2}}\cdot{i}+(1-i)=(-2)\cdot{i}+(1-i)=-2i+(1-i)=1-3i\\{{z}_{4}}={{z}_{3}}\cdot{i}+(1-i)=(1-3i)\cdot{i}+(1-i)=i-3{{i}^{2}}+(1-i)=i+3+(1-i)=4\\{{z}_{5}}={{z}_{4}}\cdot{i}+(1-i)=4\cdot{i}+(1-i)=1+3i$

Notice this sequence is exhibiting an interesting pattern—it began to repeat itself.

### Try It

In the following video we show more worked examples of how to generate the terms of a recursive, complex sequence.

### Mandelbrot Set

The Mandelbrot Set is a set of numbers defined based on recursive sequences.

### Mandelbrot Set

For any complex number c, define the sequence ${{z}_{n+1}}={{z}_{n}}^{2}+c,\quad{{z}_{0}}=0$

If this sequence always stays close to the origin (within 2 units), then the number c is part of the Mandelbrot Set. If the sequence gets far from the origin, then the number c is not part of the set.

### Example

Determine if $c=1+i$ is part of the Mandelbrot set.

We start with ${{z}_{0}}=0$. We continue, omitting some detail of the calculations

${{z}_{1}}={{z}_{0}}^{2}+1+i=0+1+i=1+i\\{{z}_{2}}={{z}_{1}}^{2}+1+i={{(1+i)}^{2}}+1+i=1+3i\\{{z}_{3}}={{z}_{2}}^{2}+1+i={{(1+3i)}^{2}}+1+i=-7+7i\\{{z}_{4}}={{z}_{3}}^{2}+1+i={{(-7+7i)}^{2}}+1+i=1-97i$

We can already see that these values are getting quite large. It does not appear that $c=1+i$ is part of the Mandelbrot set.

### Example

Determine if $c=0.5i$ is part of the Mandelbrot set.

We start with ${{z}_{0}}=0$. We continue, omitting some detail of the calculations

${{z}_{1}}={{z}_{0}}^{2}+0.5i=0+0.5i=0.5i\\{{z}_{2}}={{z}_{1}}^{2}+0.5i={{(0.5i)}^{2}}+0.5i=-0.25+0.5i\\{{z}_{3}}={{z}_{2}}^{2}+0.5i={{(-0.25+0.5i)}^{2}}+0.5i=-0.1875+0.25i\\{{z}_{4}}={{z}_{3}}^{2}+0.5i={{(-0.1875+0.25i)}^{2}}+0.5i=-0.02734+0.40625i$

While not definitive with this few iterations, it does appear that this value is remaining small, suggesting that 0.5i is part of the Mandelbrot set.

### Try It

Determine if $c=0.4+0.3i$ is part of the Mandelbrot set.

If all complex numbers are tested, and we plot each number that is in the Mandelbrot set on the complex plane, we obtain the shape to the right.[2]

The boundary of this shape exhibits quasi-self-similarity, in that portions look very similar to the whole.

Watch the following video for more examples of how to determine whether a complex number is a member of the Mandelbrot set.

In addition to coloring the Mandelbrot set itself black, it is common to the color the points in the complex plane surrounding the set. To create a meaningful coloring, often people count the number of iterations of the recursive sequence that are required for a point to get further than 2 units away from the origin. For example, using $c=1+i$ above, the sequence was distance 2 from the origin after only two recursions.

For some other numbers, it may take tens or hundreds of iterations for the sequence to get far from the origin. Numbers that get big fast are colored one shade, while colors that are slow to grow are colored another shade. For example, in the image below[3], light blue is used for numbers that get large quickly, while darker shades are used for numbers that grow more slowly. Greens, reds, and purples can be seen when we zoom in—those are used for numbers that grow very slowly.

The Mandelbrot set, for having such a simple definition, exhibits immense complexity. Zooming in on other portions of the set yields fascinating swirling shapes.