Application Center - Maplesoft

# An introduction to complex numbers

You can switch back to the summary page by clicking here.

Complex_Number.mws

> restart: with(plots):

```Warning, the name changecoords has been redefined
```

Complex numbers, an introduction
(by P.H. Stikker)

Introduction

History

Diophantus (ca 250 a.d.) was one of the first mathematicians to discover that the set of real numbers wasn't sufficient.
Pacioli wrote in 1494 in his book 'Summa de Arithmetica' that the equation
was unsolvable unless is greater than or equal to 4c.
Cardano wrote in his book 'Ars Magna' (1545) the equation
is insolvable, because the solutions are 'imaginary'.
Cardano did use the root of a negative number to solve another problem.

Gauss was the first one to call these expressions 'complex numbers'

The great mathematician Bombelli from Bologna made in 1572 in his book 'Algebra' a theory of imaginary and complex numbers.

The number i

We define i to be the number such that

Maple uses " I " instead of i .
The first mathematician to use this notation was Leonhard Euler (1707 - 1783).

This worksheet

In this worksheet I will explain 5 common ways to write down a complex number. I will not go too much into theory.

Notation 1:

Introduction

Gauss (1777 - 1855) first used the notation .
"a" is called the real part and
"b" is called the imaginary part.
Also Maple knows this:

> Re(2+4*I);

> Im(2+4*I);

The first question is whether a complex number can be written in more than one way using this notation.
The answer is no, which we prove below:

Proof #1

if a + bI = c + dI <=> (a - c) = (d - b)I
The left-hand side is a real number, but then there must also be a real number on the right-hand side, and this is only true if d - b = 0 => d = b, but then on the left side it must be that a = c

The rules

The rule for addition is as follows:

The rule for subtraction is as follows:

The rule for multiplication is as follows

=

The rule for division is as follows:

= = =

Let's see whether Maple does the same thing:

> (5+2*I)+(-3+4*I);

Subtraction

> (5+2*I)-(-3+4*I);

Multiplication

> (5+2*I)*(-3+4*I);

Division

> (5+2*I)/(-3+4*I);

You can check by yourself that this is correct.

Notation 2:

Introduction

Besides writing numbers down as an expression, we can also write them down as a point.
For th complex numbers this can give some problems, but Sir William Rowan Hamilton (1805 - 1865) gave a good way to do this anyway.
He renamed the often called x-axis to Real-axis and the y-axes to Imaginary-axis.

Fortunately Maple does know a way to plot these coordinates, using 'complexplot'

Plotting complex numbers with Maple

> with(plots):

> complexplot(3+4*I,x=-10..10,style=point);

Uhm, the imaginary axis and real axis doesn't seem to intersect nicely at (0;0). Fortunately, there is a way around this problem:

> complexplot([3+4*I],x=-10..10,style=point);

Although I think most Maple users, uses x, in this case the x-axis should be "Real-Axis", and the y-axis should be "Imaginary-axis", also this can easily be done:

> complexplot([3+4*I],x=-10..10,labels=[Real,Imaginary],style=point);

Also complex functions can be plotted by Maple:

> complexplot(x+x*I,x=-10..10,labels=[Real,Imaginary]);

Notation 3:

Introduction

If we can write a complex number as a point in a cartesian coordinate system, there must be a way represent them in a polar coordinate system.
In a polar coordinate system, we represent points by giving the length of a vector and the angle it makes with the positive x-axis.

Transforming

We want to find a way that a point A(x;y) can be transformed in A(r, ).

r is the distance of the vector and phi is the angle with the positive x-axis.
Since we can make a 90 degree triangle using point A(x;y), B(4;0) and O(0;0), r is easily calculated:

and

Also Maple can easily transform a complex number:

> convert(4+3*I,polar);

Let's check if this is okay:

> r:=sqrt(4^2+3^2);

Yes, Maple does it in a correct way.
You can also get just the argument by itself:

> argument(4+3*I);

Plotting polar

As with notation 2, also complex numbers can be easily plotted in polar coordinates by Maple:

> complexplot(x+x*I, x=-30..30,coords=polar,scaling=constrained);

Doing it yourself

Although Maple can plot complex numbers, in below a procedure wich does the same thing, but using in a way the normal plot:

> p:=proc(a,b)
local i,help,pointset:

pointset:=[];

for i from a to b by 0.1 do
help:=subs(x=i,f(x));
pointset:=pointset,[Re(help),Im(help)];
end do:

pointset:=[pointset];
pointset:=subsop(1=NULL, pointset);

pointplot(pointset,style=line,coords=polar,scaling=CONSTRAINED);

end:

> f:=x->x+x*I;

> p(-30,30);

Notation 4:

Since we already looked at the transformation in the previous notation this one shouldn't be hard to understand.

and

Using the triangle from A(x,y), B(4;0) and O(0;0)

We can also deduce:

x and y are a, and b in a + b*I, so substitution gives:

Rearrangement gives then:

Notation 5:

The formula of Euler

Euler proved that :

Therefore any complex number can be written down as:

The proof

We know that the function F(x) = has the following characteristics:

(1) f(0) = 1

(2) f(x1 + x2) = f(x1) * f(x2) or

(3) f(x) > 0, in particular f(x) <> 0

Let's check these conditions with Maple:

> f:=x->exp(x);

The first one:

> f(0);

Correct, the second one:

> f(a+b);

> f(a)*f(b);

Not the same yet, so let's try:

> simplify(%);

Correct, and now the last one:

> solve(f(x)=0);

If z = x + yI, than is E(z) =

For all real values from z it is true that: Im(z) = y = 0, so:
z = x => E(x) =

Are the characteristics (1) and (2) also valid for the function E?
(1) E(0) =
= 1

(2) E(z1) * E(z2) =

=

=

(3) E(z) <> 0

For a (pure) imaginary number z it is valid that: Re(z) = x = 0

So: E(Iy) = =>

Often we write instead of y

Some other procedures

Showing all notations

The procedure in below is made to show every type of notation of a complex number:

> complexnotation:=proc()
local cartpoint,polarpoint,t,g:

cartpoint:=[Re(f),Im(f)];
polarpoint:=convert(f,polar);
t:=sqrt((Re(f))^2+(Im(f))^2)*(cos(arctan(Im(f)/Re(f)))+I*sin(arctan(Im(f)/Re(f))));
g:=sqrt((Re(f))^2+(Im(f))^2)*exp(I*(arctan(Im(f)/Re(f)))):

print(`the complex number:`);
print(f);
print(`can also be written as:`);
print(``);
print(`as a cartesian point`);
print(cartpoint);
print(``);
print(`as a polar point`);
print(polarpoint);
print(``);
print(`in r(cos(phi)+I*(sin(phi))`);
print(t);
print(``);
print(`in r*exp(I*phi)`);
print(g);
print(``);
print(`In a complex coordinate system the point can be represented as follows:`);
pointplot([Re(f),Im(f)],labels=[Real,Imaginary]);
end:

> f:=4+2*I:

> complexnotation();

Showing the triangle

In below a small procedure, showing the triangle mentioned earlier.

> showtriangle:=proc()
local vectorl,pointp,vectorp,j,k:
vectorl:=x->(a/b)*x:
j:=subs(a=Im(f),%):
k:=subs(b=Re(f),%):

if Re(f)>0 then
vectorp:=plot(k,0..Re(f),color=blue,filled=true):
pointp:=pointplot([Re(f),Im(f)],labels=[Real,Imaginary]):
display(vectorp,pointp);
else
vectorp:=plot(k,Re(f)..0,color=blue,filled=true):
pointp:=pointplot([Re(f),Im(f)],labels=[Real,Imaginary]):
display(vectorp,pointp);
end if:
end:

> f:=4+3*I;

> showtriangle();

>

Maple and i

The problem

Let's say we wanted to plot the function of the third root of x. If you didn't have much Maple knowledge you would try:

> f:=x->x^(1/3);

> plot(f(x),x=-10..10);

But unfortunately, this is only the positive side. Where are the negative values? (-8)^(1/3) = -2, anyone with some mathematical knowledge knows this.

Solution 1

The problem arises as soon as x<0. You could therefore split the complete function into two parts:
First a function and a graph for only values from x>0:

> f:=x->(x)^(1/3);

> plot(f(x),x=-30..30);

The second part should be for x < 0. We will do this by first making x positive again, and than multiply the outcome by -1:

> g:=x->-1*((-1*x)^(1/3));

> plot(g(x),x=-30..0);

Now we make both plots as a variable for Maple, and display them in one plot:

> pf:=plot(g(x),x=-30..0):

> gf:=plot(f(x),x=0..30):

> with(plots):

> display(pf,gf);

Solution 2

Fortunately, there is an easier way, using a Maple command called surd:

> surd(x,3);

> plot(surd(x,3),x=-30..30);

Why doesn't Maple plot it straight away?

Introduction

The whole problem lies in the fact that Maple works with complex numbers. Although working with these numbers is for us often more complicated, for Maple it is easier and more precise.

It tries to find an answer to the problem: .

Although -2 seems an easy answer, Maple finds:

> (-8)^(1/3);

> evalf(%);

To solve the problem above, Maple follows a different method than that we should choose if our complex number skills aren't very good

"De Moivre"

De Moivre found:

De Moivre:

n

The general solution method for becomes:

First, rewrite c to:

So:

=>

for k= 0, 1, 2, ... , n-1 we find all (different) complex solutions.

The example

Let's see how this goes in our example

We wanted to solve:

First change it to polar coordinates:

> convert(-8,polar);

so: r = 8 and n=3, gives:

> 8^(1/3)*exp((Pi/3+2*k*Pi/3)*I);

> z1 := simplify (subs (k=0, %));

> z2 := simplify (subs (k=1, %%));

> z3 := simplify (subs (k=2, %%%));

"z1" is the principal root of -8 and therefore Maple with give this answer.

Also via the modulus-argument notation the problem can be found.
In the next paragraph I have done this

A different way

With help from the Euler formulaEuler formula we can now change f(n):

> (8)^(1/3)*(cos((Pi+2*k*Pi)/3)+I*sin((Pi+2*k*Pi)/3));

> z1 := simplify (subs (k=0, %));

> z2 := simplify (subs (k=1, %%));

> z3 := simplify (subs (k=2, %%%));

Once again the same solutions.

A third solution

With use of complex number theory, we can also plot the function. We will have to use a pointplot once again, but the procedure is nicer.

.

> with(plots):

> g:=proc(a,b,c)
local i,j,k,l,m,n,z1,p,q,r,inputset:

inputset:=[];

for j from a to 0 by c do

for i from 0 to b-1 by 1 do
p:=abs(j)+1;
z1:= simplify(subs(k=i,p^(1/b)*exp((Pi/b+2*k*Pi/b)*I)));
if Im(z1)=0 then
inputset:=inputset,[j,z1];
end if:
end do:
end do:

q:=plot((x)^(1/b),x=a..(-1*a),style=line):

inputset:=[inputset];
inputset:=subsop(1=NULL,inputset);
r:=pointplot(inputset,style=line,thickness=0,color=red):
display(q,r);
end:

> g(-27,3,0.1);