About the Online Complex Calculator

© 2001 by Karl Hahn
KCT logo (click for Home Page)

The online complex calculator (added Oct 2001) allows you to use your browser to perform calculations of your choice on complex numbers to aid you in doing some of the online exercises and to familiarize you with complex arithmetic. This calculator can only produce numeric results. It cannot graph or solve equations.

The script that implements the calculator is my own creation, so if you discover any bugs in its operation, please let me know by email so that I can fix them.

If you have a math education website and you would like to use the calculator script on that website, please email me for permission and instructions.

Very Brief Tutorial on Complex Arithmetic

You have certainly heard that -1 has no real square root. So renaissance mathematicians invented a square root for -1, saying they could imagine such a thing even though it did not seem to be real to them (this by the way is the origin of the terminology of real and imaginary numbers). Using this invented number that they only imagined to exist, remarkably they were able to establish an entire self-consistent arithmetic around it. In this arithmetic all numbers had square roots -- two of them in fact.

Today attitudes toward complex numbers have changed. Because they turn out to be so useful for solving real-world problems, complex numbers are considered no less real and no more imaginary than the real numbers are. Not only do complex provide a means to solving difficult problems in physics and engineering, but they also have a lot to tell us about the behavior of the real numbers that we could not know without them. If you ever take a course in complex variables, that will become abundantly clear to you. Even investigations into the distribution of prime numbers among the integers take paths that lead through the complex numbers.

In complex arithmetic, each number has a real part and an imaginary part. The real part is just some real number. The imaginary part is some real multiple of that invented number that is the square root of -1, which hereafter we shall call i. So each complex number is given as  a + ib,  where a and b are real numbers. In this example the a part is the real part and the b part is the imaginary part. To add two complex numbers you simply add the real parts to get the real part of the sum and you add the imaginary parts to get the imaginary part of the sum. For multiplication you need to apply the distributive law, remembering that  i × i = -1

   (a + ib)(c + id)  =  ac + i2bd + ibc + iad  =  ac - bd + i(bc + bd)
To do division you use
   a + ib     (a + ib)(c - id)
           =                  
   c + id          c2 + d2
Where dividing the product in the numerator by the real quantity,  c2 + d2  is just dividing both the real and imaginary parts of the numerator by that denominator. I'll leave it as an exercise for you to see why this formula for division works. By the way, the quantity,  c - id,  is called the complement of the quantity,  c + id,  and vice versa.

Several centuries after the discovery of complex numbers, mathematicians found that common functions like ex and trig functions could be extended to complex numbers. The key formula here was discovered by Euler:

   eix  =  cos(x) + isin(x)
All extensions into the complex domain of other transcendental functions follow from this one.

How to use the calculator

You will see two data fields on the calculator screen labeled x and y, each showing both real and imaginary parts. You can enter numbers into each of the parts of x and y by clicking on the appropriate field and typing the numbers you want. Below them are a set of choices for an operation to be performed. For example, one of the choices is x+y. If you select that one and press the DO IT! button, the sum of x and y will appear in the x entries. This is the general form of any operation. The result always appears in the x entries. If an operation, such as +, requires two inputs, they are taken from x and y. If it requires only one input, such as x2, that one input is taken from x.

The abbreviations, re and im stand for real and imaginary respectively.

You can do only one operation with each pressing of the DO IT! button. Each pressing of that button is a cycle of the calculator.

There are four memory cells in the calculator as well, A, B, C, and D, all of which have both real and imaginary parts. On any cycle you can select an operation that copies the contents of the x register into any one of the four memory cells. Likewise on any cycle you can select an operation that copies any of the four memory cells into the y register. This allows you to keep intermediate results on hand for calculations that require a number of cycles.

If the calculator encounters an error such as division by zero, you will see the message, ERROR on last operation, appear just above the x display. All values will be preserved at their pre-error states if that happens.

After any cycle you can return to the values held on previous cycles by using your browser's BACK button.

Most of the functions listed are standard and self-explanatory. There are several special functions that would not apply to real numbers but do apply to complex numbers. You can find the complement of x. You can swap real and imaginary parts of x. But most important, you can convert back and forth between polar and Cartesian forms. The Cartesian form is the standard form we've been talking about above, and it is the form to which most of the functions can be applied. But because the complex numbers have two coordinates, a real part and an imaginary part, you can think of them as points on a plane. These points can also be represented in polar coordinates. If you enter a number into the x entries and convert it to polar form, the real part of the x entry will show the magnitude of the number (that is  magn(a + ib) = sqrt(a2 + b2).  The imaginary part will show the angle, in radians, that the line from the origin to  a + ib  makes with the real axis. For that reason, the conversion functions between degrees and radians apply only to the imaginary part of x.

This means, for example, if you wanted to know the complex number that is 3 units from the origin and at an angle of 50 degrees, you could enter 3 into the x real part, 50 into the x imaginary part, then do conversion from radians to degrees, and finally do a conversion from polar to Cartesian. Try it.

Likewise if you wanted to know the magnitude and angle from the real axis of  4 + i,  enter 4 into the real part of x and 5 into the imaginary part of x. Now convert from Cartesian to polar to see the magnitude in the real part of x and the angle in the imaginary part of x. To see that angle in radians (and preserve the magnitude), simply convert from radians to degrees.


Use your browser's BACK button to return to the calculator

You can email me by clicking this button:

  Use your own emailer     Use form