# Two Variable Functions

Shodor > Interactivate > Discussions > Two Variable Functions

Student: So I was told that to understand fractal I need to know something about complex numbers. What are they?

Mentor: The idea of complex numbers took many years to become accepted. We have a rule in mathematics that we can only take the square root of positive numbers. But there are also lots of negative numbers.

Student: So, complex numbers have to do with the square root of negative numbers?

Mentor: Exactly. The easiest way to think of complex numbers is as an ordered pair of numbers. Remember how to plot ordered pairs? We use the first as the horizontal movement and the second as the vertical movement.

Student: I know this. For example, plotting (1,3) would give: Mentor: Good! To look at fractals we need to be able to work with functions of these pairs of numbers. These functions can be described as "machines." You may remember that before, we would put a number into a function "machine" and it would return a number to us. This time, an ordered pair goes in and an ordered pair comes out. Basic Operations of addition, subtraction, multiplication and division are revised for this new situation as:

 Addition of two pairs (+) Component-wise, i.e., (a,b) + (c,d) = (a+c,b+d) Subtraction of two pairs (-) Component-wise, i.e., (a,b) - (c,d) = (a-c,b-d) Multiplication by a number (*) Component-wise, i.e., x * (a,b) = (x*a,x*b) Division by a number (/) Component-wise, i.e., (a,b) / x = (a/x,b/x)

Mathematicians refer to the set of all real number ordered pairs along with these operations as the vector space of 2-vectors or R 2 . Vector spaces are important structures in the study of linear algebra.

Notice that multiplication and division of pairs are not in this list. They are not defined "component-wise" as the others above.

 Multiplication of pairs (*) (a,b) * (c,d) = (ac - bd, ad + bc) Division of pairs (/) (a,b) / (c,d) = ( (ac+bd)/(c^2+d^2) , (bc-ad)/(c^2+d^2) )

These definitions for the basic operations may seem weird, but they make perfect sense from triangle geometry, as you will see later in calculus! For the fractals that we will study here, we only need to know how to square a pair -- which is multiplying the pair by itself. Can you figure out a rule for squaring?

Student: Let's see; we want to multiply (a,b)*(a,b) using the rule in the table.

 Squaring pairs (^2) (a,b) ^2 = (aa - bb, ab + ab)

Mentor: Good! Can you fix it up a little? aa = a^2, and the other terms can be redone.

Student: How's this?

 Squaring pairs (^2) (a,b) ^2 = (a^2 - b^2, 2ab)

Mentor: Very good. Ok, let's try some simple functions. First, to make writing these down easier, we will use Z to represent a pair (a,b). Here is a list of functions. You try to put the ordered pairs (0,0) and (1,-1) in them:

1. f(Z) = Z^2
2. f(Z) = Z + (0,1.5)
3. f(Z) = Z^2 + (2,1)

Student: Ok:

1. f(0,0) = (0,0)^2 = (0^2 - 0^2, 2*0*0) = (0,0) f(1,-1) = (1,-1)^2 = (1^2 - (-1)^2, 2*1*(-1)) = (0,-2)
2. f(0,0) = (0,0) + (0,1.5) = (0+0, 0+1.5) = (0,1.5) f(1,-1) = (1,-1) + (0, 1.5) = (1+0, -1+1.5) = (1,0.5)
3. f(0,0) = (0,0)^2 + (2,1) = (0,0) + (2,1) = (2,1) f(1,-1) = (1,-1)^2 + (2,1) = (0,-2) + (2,1) = (2,-1)

Mentor: Those are correct. Now you know the basics of using two variable -- or complex -- functions.

Student: Wait, how are these complex? I don't see anything here about the square root of negative numbers.

Mentor: Let's start with a little history lesson. For centuries after algebra was invented, mathematicians thought that equations like X^2 + 1 = 0 had no solutions. After all, when you square something, you get a positive number. How can you add a positive number to another positive number, like 1, and get 0?

In the sixteenth century, Girolamo Cardano -- an Italian mathematician who worked a lot with cubic equations -- called the solution to that equation the square root of -1, and then said this was just a symbol to represent a useless quantity. Around the same time, Rafael Bombelli -- who was studying cubic equations, too -- invented the operations we saw above for complex numbers. In the seventeenth century, Rene Descartes -- imaginary number.

Almost a century later, Leonhard Euler started using the symbol i, and complex numbers were commonly written as

a + b i.

where a and b were real numbers, and a was called the real part of the number and b the imaginary part. At the end of the eighteenth century, Jean-Robert Argand popularized the idea that complex numbers a + b i could be written and graphed as ordered pairs like we did above. Since then, huge numbers of uses have been discovered. Today, every engineer and physicist needs a firm understanding of complex numbers for their work.

Student: So, I can write them either as a + b i or as (a,b)?

Mentor: Right! Look at the operations again. Now do they make more sense?

Student: The first do, but what about squaring?

Mentor: Think about how you would have to multiply

(a + b i) * (a + b i)

The distributive property says that this equals

(a + b i) * a + (a + b i) * b i.

We have to distribute again:

a*a + a*b i + a*b i + b i * b i.

We can simplify this if we remember that i *i is -1!

a^2 + 2ab i + b^2 (-1) = a^2 - b^2 + 2ab i.

Student: Which is the same as (a^2 - b^2, 2ab) in the pair form.

Mentor: You got it! 