## Fundamentals of Fractals 1: Introduction to Complex Numbers This series aims to teach you the basics of programming fractals. Let’s start with introducing Complex Numbers, which is a topic within algebra and the fundamental for everything that is related to fractals. In the next tutorial, we will move more towards the theory of fractals.

z=x+yi
All complex numbers are represented by the form x+yi, where x and y are real numbers (positive, negative or zero), and the symbol for the set of complex numbers is C. This can be represented in a two dimensional coordinate system, the complex plane (C): Say we have the function z = x+yi. In this function, x is what we call the real (R) part of z, and y is called the imaginary(i) part of z. In other words, in our graph above, the x axis is the real axis, and the y axis is the imaginary axis. A real number 8 is a function of the complex plane where y = 0 and x = 8. The formula z = x + yi = 8 + 0*i = 8, z = 8 shows us this.

Let’s take a look at the complex plane between -4+3i to 4-3i, filling out every function on the grid. The imaginary i
Let’s take a closer look at this imaginary i: So what’s happening here? We take the square root of a negative number? But that’s not possible! Sure, but this is where the i comes in. Everyone knows that i isn’t real, so that’s why it’s imaginary. It brings a few handy things to us, one is that it makes it possible to take the square root of a negative number: in other words, i2 = –1! But.. wait, can’t i be –1 and 1 then? That’s correct, and that’s what gives us the benefits of being able to take the square root of negative number. But, it will also require you to keep this in mind when dealing with the imaginary number.

Let’s take an example. We all know that the square root of 25 is 5. Lets see what the square root of –25 is: It is very simple to add or subtract two complex numbers together. Say we got two complex numbers where one is z=-3+2i and another is w=4+3i, and we want to add these together (z+w):  As you can se, the result will be a parallelogram from origo. Multiplication of Complex Numbers
Multiplying complex numbers is a bit more complex than addition/subtraction.
The general rule of multiplying complex numbers: If yi*vi = 3i2, it’s result will be –3.
(x + yi)(u + vi) = (xu – yv) + (xv + yu)i

The product of (1+2i)(3+4i) is: (3 + 4i + 6i + 8i2) = (3 + 1oi –8) = (-5+10i)

If you want to multiply a complex number by a real number u, the general rule is: Simply multiply both parts of the complex number by the real number.

The power of i
The last thing I want to cover is the power of i. As we know, our imaginary number got some strange behaviors, and this accounts the power of i as well: Let’s continue with the 8 first: This is just a brief introduction to complex numbers, but enough to get you started with fractals.

Any feedback and sources of confusion/mistakes are very welcome, see you next time! This entry was posted in DirectX11, Math, Tutorial and tagged . Bookmark the permalink.

### 1 Response to Fundamentals of Fractals 1: Introduction to Complex Numbers

1. Espen says:

Thanks, very informing! (especially for those of us who didn’t take math in school and all of a sudden finds himself needing it for graphics programming..)

This site uses Akismet to reduce spam. Learn how your comment data is processed.