We've updated our
Privacy Policy effective December 15. Please read our updated Privacy Policy and tap

Study Guides > Mathematics for the Liberal Arts Corequisite

Generating Fractals With Complex Numbers

Learning Outcomes

  • 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

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.

superscripts and subscripts in math notation

You've seen frequent examples of superscripts used in math notation in the form of exponents. Ex. x2,x3,2n,x^{2}, x^{-3}, 2{^n}, \cdots. But what do those subscripts mean? Subscripts in math notation are usually used to denote a number of items. For example, if we have a list of data entries in the form of numbers, we could refer to the 1st such entry, the 2nd such entry, and so on ... all the way up to the very last one. If there are an unspecified number of entries, we might say we have nn such entries. Let the individual numbers be represented by xx. Then we may list the entries as x1,x2,x3,x_1, x_2, x_3, \cdots. We refer to the very first such number in a list as the "zeroth" term, x0x_0. Sometimes we let an arbitrary term in the list be referred to as the "nth" term, xnx_n. Then we can refer to the next term in line as xn+1x_{n+1} or the previous term in line at xn1x_{n-1}.

Recursive Sequence

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

Example

Given the recursive relationship zn+1=zn+2,z0=4{{z}_{n+1}}={{z}_{n}}+2,\quad{{z}_{0}}=4, generate several terms of the recursive sequence. We are given the starting value, z0=4{{z}_{0}}=4. The recursive formula holds for any value of n, so if n=0n = 0, then zn+1=zn+2{{z}_{n+1}}={{z}_{n}}+2 would tell us z0+1=z0+2{{z}_{0+1}}={{z}_{0}}+2, or more simply, z1=z0+2{{z}_{1}}={{z}_{0}}+2. Notice this defines z1{{z}_{1}} in terms of the known z0{{z}_{0}}, so we can compute the value:

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

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

z2=z1+2=6+2=8{{z}_{2}}={{z}_{1}}+2=6+2=8

Continuing,

z3=z2+2=8+2=10z4=z3+2=10+2=12{{z}_{3}}={{z}_{2}}+2=8+2=10\\{{z}_{4}}={{z}_{3}}+2=10+2=12

Try It

[ohm_question]5816[/ohm_question]
The previous example generated a basic linear sequence of real numbers. The same process can be used with complex numbers.

Arithmetic on Imaginary units

When working through the example below, recall that i2=1i^{2}=-1. i=1i=\sqrt{-1} i2=(1)2=1i^{2}=\left(\sqrt{-1}\right)^{2} = -1.

Example

Given the recursive relationship zn+1=zni+(1i),z0=4{{z}_{n+1}}={{z}_{n}}\cdot{i}+(1-i),\quad{{z}_{0}}=4, generate several terms of the recursive sequence. We are given z0=4{{z}_{0}}=4. Using the recursive formula:

z1=z0i+(1i)=4i+(1i)=1+3iz2=z1i+(1i)=(1+3i)i+(1i)=i+3i2+(1i)=i3+(1i)=2z3=z2i+(1i)=(2)i+(1i)=2i+(1i)=13iz4=z3i+(1i)=(13i)i+(1i)=i3i2+(1i)=i+3+(1i)=4z5=z4i+(1i)=4i+(1i)=1+3i{{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

[ohm_question]131230[/ohm_question]
In the following video we show more worked examples of how to generate the terms of a recursive, complex sequence. https://youtu.be/lOyusyTsLTs

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 zn+1=zn2+c,z0=0{{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.

Multiplying complex numbers

To generate the Mandelbrot set you'll need to multiply complex numbers. Recall that multiply (a+bi)2(a + bi)^2 uses the same technique as squaring a binomial such as (a+b)2(a + b)^{2}, with the added condition that i2=1i^{2}=-1. When squaring binomials, you can follow the pattern (a+b)2=a2+2ab+b2(a+b)^{2} = a^2 + 2ab + b^2. When squaring complex numbers, follow a similar pattern that takes into account the fact that i2=1i^{2}=-1. (a+bi)2=a2+2abi+(bi)2=a2+2abi+b2(i2)=a2+2abi+b2(1)=a2+2abib2\begin{aligned} (a+bi)^{2} &= a^2 + 2abi + \left(bi\right)^2 \\ & =a^2+2abi+b^2(i^2) \\ & =a^2+2abi+b^2(-1) \\ & =a^2+2abi-b^2 \\ \end{aligned}. In the example below, the omitted details may be added using this pattern. (1+i)2+1+i=1+2i+(i2)+1+i=1+2i+(1)+1+i=1+2i1+1+i=1+3i\begin{aligned} (1+i)^{2} +1+i&= 1+2i+(i^2) +1+i\\ & =1+2i+(-1) +1+i\\ & =1+2i-1 +1+i\\ & =1+3i \end{aligned}.

Example

Determine if c=1+ic=1+i is part of the Mandelbrot set. We start with z0=0{{z}_{0}}=0. We continue, omitting some detail of the calculations

z1=z02+1+i=0+1+i=1+iz2=z12+1+i=(1+i)2+1+i=1+3iz3=z22+1+i=(1+3i)2+1+i=7+7iz4=z32+1+i=(7+7i)2+1+i=197i{{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+ic=1+i is part of the Mandelbrot set.

Example

Determine if c=0.5ic=0.5i is part of the Mandelbrot set. We start with z0=0{{z}_{0}}=0. We continue, omitting some detail of the calculations

z1=z02+0.5i=0+0.5i=0.5iz2=z12+0.5i=(0.5i)2+0.5i=0.25+0.5iz3=z22+0.5i=(0.25+0.5i)2+0.5i=0.1875+0.25iz4=z32+0.5i=(0.1875+0.25i)2+0.5i=0.02734+0.40625i{{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.3ic=0.4+0.3i is part of the Mandelbrot set.

Answer: z1=z02+0.4+0.3i=0+0.4+0.3i=0.4+0.3iz2=z12+0.4+0.3i=(0.4+0.3i)2+0.4+0.3iz3=z22+0.5i=(0.25+0.5i)2+0.5i=0.1875+0.25iz4=z32+0.5i=(0.1875+0.25i)2+0.5i=0.02734+0.40625i{{z}_{1}}={{z}_{0}}^{2}+0.4+0.3i=0+0.4+0.3i=0.4+0.3i\\{{z}_{2}}={{z}_{1}}^{2}+0.4+0.3i={{(0.4+0.3i)}^{2}}+0.4+0.3i\\{{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

A shaded fractal shown on a graph.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.[footnote]http://en.wikipedia.org/wiki/File:Mandelset_hires.png[/footnote] 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. https://youtu.be/ORqk5jAFpWg 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+ic=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 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. This zoom GIF file on the Wikipedia Mandelbrot Set entry illustrates what it looks like to zoom in.  

Additional Resources

A much more extensive coverage of fractals can be found on the Fractal Geometry site. This site includes links to several Java software programs for exploring fractals. If you are impressed with the Mandelbrot set, check out this TED talk from 2010 given by Benoit Mandelbrot on fractals and the art of roughness.

Licenses & Attributions