Click to See Complete Forum and Search --> : Imaginary Numbers... and Quadratics


Sam Finch
Dec 31st, 2000, 12:45 PM
Complex Numbers



The thing that most poeple find difficult about complex numbers is the words complex and imaginary seem to suggest they're something special, or magical, they're not, they're just numbers, it's just that until now you havn't seen all tha numbers that there are, just a small subset of them. What I'm goinna do is go over the basics of complex number theory, in far more depth than you need, I've gone over probably 4 weeks worth of the A level further maths course in 1 post but work through it slowly and it should make sense, you should hopefully get familiar enough not to be aprihensive about using them, they're just like real numbers, you can add divide even raise complex numbers to the power of other complex numbers, find their sines and cosines in fact anything that can be done with a real number can be done with a complex number.

I'm dealing with them graphicly as well as algebraicly, which makes it a bit easier to understand, do go through it slowly and experiment between what's happaning on the diagram and in the algebra.

hope it helps


OK, let's start with the number line, you'll have to draw your own cos it's hard to do diagrams in text,
just draw a horizontal line on a piece of paper and mark some numbers on it, 0 in the centre +ve numbers to the right and -ve numbers to the left.

If you remember once apon a time you probably used a number line to learn about -ve numbers, to do this you had the line going in 1 direction (starting at 0 and moving to the right) and then you extended the line in the other direction to find more numbers, well we're extending our line again, this time we're making it a plane.


You have at the moment what is basicly an x axis of a graph, so draw a y axis, but where you label points on the y axis ad an i on the end to distinguish them from the real numbers.

so on the x axis we have real numbers and on the y axis we have imaginary numbers (with the i for imaginary) we havn't yet defined a plane of numbers, we've just added a second line.


Before we do anything else to this diagram, what happens if we try to add these new numbers together, what could we define

Ai + Bi

as

well, let's define Ai as A multiplied by i, where i is the point 1i on the y axis of your graph, so this means that

Ai + Bi = (A + B)i (distibutive law)


so we can add imaginary numbers to imaginary numbers, (and obviously real numbers to real numbers) but what happens if we try to add a real number to an imaginary number?

What is A + Bi

seeing as we havn't defined this, nor given it a name, let's just leave it as A + Bi

Going back to the diagram, we need a place for all these new numbers (in the form A + Bi) that's quite easy, let's put the number A + Bi at coordinates (A, B) on our plane. (for any 2 real numbers A and B)


Ok, so we have a whole load of new numbers, which we can add and subtract (A + Bi + C + Di = (A + C) + (B + D)i) Now we should work out how to multiply and divide them.


As you probably know i is defined as the square root of -1 so i*i = -1, so let's look at a simple example

(3 + 4i)(2 - 6i)
multiply this out
= (3*2) + (3*6i) + (4i*2) + (4i*6i)


the 3*2 we can do, it's 6, but what about the other 3 parts?

Well, let's look at 3*6i, add a set of brakets and we get (3*6)i which is 18i

4i*2 is a bit more difficult, let's add some * signs and we get
4*i*2 = 4*2*i (Associative law)
= 8i

and what about the last part, 4i*6i remember that i*i = -1, we get 4*6*-1 = -24

so we get

(3 + 4i)(2 - 6i)

= (3*2) + (3*6i) + (4i*2) + (4i*6i)

= 6 + 18i + 8i - 24
= -18 + 26i

so we can multiply our new numbers, but what's happening on our diagram?

first let's define 2 new terms the modulus of a complex number and the argument.

plot a point on your diagram (3 + 4i) and draw a straight line from the point to the origin.

the modulus of a complex number is the length of this line, the argument is the angle this makes with the +ve real axis (in the direction of 1) going clockwise (ie 5 - i has a -ve argument (or a large one close to 2*pi) the argument is measured in radians, not degrees (at this stage you can think in degrees if you want, but you'll need to think in radians when you want to do other things with complex numbers other than just adding, multiplying and dividing)

so, what's the modulus of our point? well, we can use Pythagoras Theorum to get it.

the modulus is sqrt(3^2 + 4^2) = sqrt(25) = 5

with a bit of trigonometry we see that the argument of our complex number is Atan(4/3) (the inverse tangent of the imaginary part / the real part)



so if I have a number with Modulus R and argument R how do I express this in the form A + Bi

well, we can think of our number as a right angled triangle, with angle x and Hypotenuse lenght R, the real part is the adjacent side and the Imaginary part is the Opposite side.

so our number is R*cos(x) + R*sin(x)i = R( cos(x) + i*sin(x) ) (i is on the left of sin(x) because it makes it easier to pronounce)

What's all this got to do with multiplying then? well, let's try to multiply 2 complex numbers in modulus argument form.

R(cos(x) + i*sin(x)) * S(cos(y) + i*sin(y))
= R*S( ( cos(x) + i*sin(x) )( cos(y) + i*sin(y) ) )
= R*S( (cos(x)*cos(y)) + (cos(x)*i*sin(y)) + (i*sin(x)*cos(y)) + (i*sin(x)*i*sin(y)) )

= R*S( ( cos(x)*cos(y) - sin(x)*sin(y) ) + ( cos(x)*sin(y) + sin(x)*cos(y) ) )

now over on the trigonometry tread I posted some trig Identities

sin(A+B) = sin(A)cos(B) + cos(A)sin(B)
cos(A+B) = cos(A)cos(B) - sin(A)sin(B)

have a look at the real and imaginary parts of the complex number in brackets, and we see that we can express the product in this form

R*S( cos(x+y) + i*sin(x+y) )

so to multiply 2 complex numbers we find the product of their modulii and the sum of their arguments and we get our new number.

right, I'll do division and then think of this as a good enough introduction.

we know how to multiply complex numbers in modulus argument form, so to divide them we can do the opposite divide the modulii and subtract the arguments, but this is a lot of work, we have to convert the 2 numbers into modulus argument form, do the maths and the convert back, if we're multiplying we don't need to do any conversions and it's easy.

first we need to define something called the conjugate of a complex number, to get the conjugate of a complex number we negate the imaginary part, ie the conjugate of A + Bi is A - Bi

the conjugate of a complex number is a reflection of it in the real axis, which means it has the same modulus but the negative argument, so multiplying a number by it's conjugate will always give you a real number, the square of the numbers modulus.

so to divide 2 complex numbers, Z and W we can multiply top and bottom by the conjugate of W

NB, I'll use W' to represent the conjugate of W, although really it's denoted by W with a bar over it.

Z/W = (Z * W') / (W * W')

we can multiply Z by W' easily enough and W * W' is very easy and gives us a real number, so we get a complex number divided by a real number, which we can do, just divide both parts by the real number, tada.


I'm gonna stop now, but hopefully that's enough to give you a basic understanding of complex numbers, I've gone through quite a lot, but you should be able to work out the bulk of it, in any case you should be set to do your program, post If you have any more problems

[Digital-X-Treme]
Jan 1st, 2001, 01:41 PM
Thanks for the feedback Sam (especially) and Parksie :):):) It helped a lot. I have just finished coding a seperate program that will find the roots of positive and negative numbers, and it has the option of leaving the answer in surd form or a decimal approximation.

I can now implement this in my quadratic equation program, to give 'imaginary numbers' as solutions, just like my calc does :):):)

Thanks.

paulw
Jan 2nd, 2001, 11:51 AM
Just to be really picky... ALL numbers are imaginary - they are a construct to model real life. i the root of -1 is complex.

Don't get me started on rational and irrational numbers...

Cheers,

P.

samwise
Jan 3rd, 2001, 03:13 PM
The best way to treat an imaginary number (or, a complex number) is to treat it like a regular number.
For example : what is sqrt(i) ??
sqrt(-1) = i
but what about sqrt(i) ??
That is simply a number that when multiplied together, gives i.
That turns out to be

(1/sqrt(2)) + (1/sqrt(2))*i

Actually, there are two numbers that qualify. You can figure out the other one.

Also, what is (4 + 3i) / (2 + 5i) ??
You can divide complex numbers.
A simple way to do it is to multiply the top and bottom by the same number, (2 - 5i). This will turn it into its more familiar format of a + bi.
The answer is 23/29 - (14/29)*i

You can also take the log of a complex number, cosine, sine, tangent, etc etc etc.

Samwise Galenorn

Guv
Jan 4th, 2001, 11:36 AM
I use Type Statements for vectors, points, and complex numbers. Perhaps that is the way to go.Public Type ComplexNumber
RealPart As Double 'Perhaps use shorter names to avoid RPS
ImaginaryPart As Double
End Type
. . .
Dim Result As ComplexNumber
. . .
Result = QuadraticSolver(A, B, C)
. . .
Public Function QuadraticSolver(A As Double, B as Double, _
C As Double) As ComplexNumber
. . .
End Function

Public Function ComplexProduct(X As ComplexNumber, _
Y As ComplexNumber) As ComplexNumber
Dim Result As ComplexNumber

Result.RealPart = X.RealPart * Y.RealPart _
- X.ImaginaryPart * Y.ImaginaryPart
Result.ImaginaryPart = X.RealPart * Y.ImaginaryPart _
+ X.ImaginaryPart * Y.RealPart
ComplexProduct = Result

End Function

If you use this appraoch, most of the messy stuff gets hidden in Functions.

There is probaly some way to use OOPS. You could define a Complex Class with all the arithmetic and other functions. Someday, I am going to investigate this concept. Yonatan & Kovan sent me some explanations about VB Classes, but I have not studied this subject yet.