Complex Numbers: A Simple Guide
1. Introduction 2. Polar Form 3. Arithmetic 4. Powers 5. Functions 6. Conclusion 6i. Complex Calculator
Introduction
Despite the name, complex numbers are not much harder to understand than real numbers.
A complex number is simply a point on a 2-dimensional plane. It's a pair of two real numbers.
We write the x and y coordinates of a complex number in Cartesian form:
Let z = x + iy where x and y are real numbers.
The x value is the "real" component, Re(z), and the y value is the "imaginary" component, Im(z).
Complex numbers are an extension of real numbers. When the imaginary component is zero, it's just a real number, as usual, on the real number line. Arithmetic, functions, calculus, and other operations are extended for complex numbers, but they work the same as usual if your complex numbers are all real.
They arise naturally as the solution to problems, such as the roots of the polynomial x2 + 1 = 0. Any real number squared is positive, so there is no solution possible on the real number line. Complex numbers were invented to do the impossible.
Let's pretend you found a solution. Imagine there is a number whose square is negative. Call this imaginary value i and define it by the simple equation:
i =
Mathematics is a logical deduction. You start by supposing something is true, and then you follow the logic to see if it makes sense. Complex numbers do make sense, and coexist nicely with real numbers, filling gaps and unanswered questions. Although the solution to x2 = −1 doesn't exist among the real numbers, it exists somewhere else! By supposing it exists and studying its properties, you discover an entire world.
Polar Form
A complex number is a 2D point, and you can represent a point in different forms. Instead of Cartesian coordinates, x + iy, the other common system is polar coordinates. The point is represented as a distance from the origin, r, and an angle counter-clockwise from the real axis, θ. We can easily convert between Cartesian coordinates and polar coordinates using trigonometry:
x = rcos(θ), y = rsin(θ)
We write the r and θ coordinates of a complex number in polar form:
z = reiθ where r and θ are real numbers.
Yes, you read that right! It's an exponential power of the Euler number (pronounced "oiler"), e = 2.71828.... He discovered a fascinating connection between complex exponentiation and rotation. This is Euler's Formula:
eiθ = cos(θ) + isin(θ)
View Derivation...
Leonhard Euler (1707 - 1789), discovered a fact that connects e and π, to conveniently express the polar form of a complex number. Recall that you can calculate the exponential function using an infinite series.
ex =
Now use it to calculate eiπ
eiπ = 1 + iπ +
Remember that i2 = −1. Substitute that wherever possible.
The series terms suddenly look very familiar.
eiπ = 1 + iπ −
Observe the series expansion for sin(π) and cos(π):
cos(π) = 1 −
sin(π) = π −
They're the same terms, just interleaved together, with an i in front of the sin(π) terms.
Therefore:
eiπ = cos(π) + isin(π) = −1
More generally, it works for any angle θ. This is Euler's Formula:
eiθ = cos(θ) + isin(θ)
It represents a point on the unit circle. We multiply by r to specify the radius, and it produces exactly the same formula as if you substituted for x + iy with the trigonometry shown above the graph:
reiθ = rcos(θ) + irsin(θ)
You'll find it useful to think of complex numbers as rotations. This will be used in exponential arithmetic of complex numbers.
Arithmetic
Arithmetic operations, like addition and multiplication, are extended into the complex plane. Real numbers are a subset of complex numbers (where the imaginary part is zero), and complex arithmetic produces the same results as usual when the numbers are real.
Complex numbers also have a conjugate, which is defined by the equation:
Geometrically, the conjugate reflects the point vertically. Real numbers are equal to their conjugate, since they have no vertical component.
You can extract the real or imaginary part of a number using the conjugate:
Re(z) = x = z + z 2
=
=
= x
Im(z) = y = z − z 2i
=
=
=
= y
The reason for the Cartesian form of x + iy will now make sense. Most arithmetic operations work exactly as usual! Just treat i as an unknown value, and use algebra to put the answer back into that form. When you multiply two complex numbers, just pretend you're multiplying two polynomials. Use the equation i2 = −1 to substitute when needed to reduce the equations back into Cartesian form.
Let z = x + iy and w = a + ib
Addition: z + w = (x + a) + i(y + b)
z + w
= (x + iy) + (a + ib)
= x + a + iy + ib
= (x + a) + i(y + b)
Subtraction: z − w = (x − a) + i(y − b)
z − w
= (x + iy) − (a + ib)
= x − a + iy − ib
= (x − a) + i(y − b)
Multiplication: zw = ax − by + i(ay + bx)
zw
= (x + iy)(a + ib)
= ax + i2by + iay + ibx
= ax + −by + iay + ibx
= ax − by + i(ay + bx)
Absolute Value: |z| = x2 + y2
This is the Pythagorean theorem, which gets the length of the hypotenuse of the triangle formed by the x and y components.
Argument: Arg(z) = atan2(y, x)
atan2(y, x) is a standard computer code function for calculating the argument, since the trigonometric tan−1() function has inconvenient discontinuities:
if y = 0 and x > 0, then θ = 0
if y = 0 and x < 0, then θ = π
if y > 0 then θ =
if y < 0 then θ =
Derivation:
x = rcos(θ), y = rsin(θ)
θ = tan−1(
Then account for the discontinuities.
Reciprocal: 1 z = z |z|2 = x − iy x2 + y2 where z ≠ 0
z
= (x + iy)
=
=
=
= 1
Division: w z = (ax + by) + i(bx − ay) x2 + y2 where z ≠ 0
= w
= (a + ib)
=
=
=
Certain operations can also be calculated easily in polar form:
Let z = reiθ and w = ρeiφ
Absolute Value: |z| = r
This is the magnitude of a number, which is just the radius.
Argument: Arg(z) = θ
This is the angle of a number, wrapped to the range (π, π]
Multiplication: zw = rρei(θ + φ)
zw
= reiθρeiφ
= rρeiθeiφ
= rρeiθ + iφ
= rρei(θ + φ)
Reciprocal: 1 z = 1 r e−iθ where z ≠ 0
=
=
=
Division: w z = ρ r ei(φ − θ) where z ≠ 0
=
=
=
=
Use this graph to experiment with different operations to understand how they work. Type a math expression of z and w, and it will graph the result. Drag the points z and w to change them. Use the function Conj(z) for
Powers
The complex exponential operator is defined based on the polar form of a number. Euler's formula already defines powers of e, and we can use that to define powers of any complex number:
z = x + iy = reiθ
Raising e to any complex power is simple:
ez = ex + iy = exeiy
The real part becomes the typical exponential function (here ex acts as the radius in Euler's Formula), and the imaginary part is the angle of rotation around the unit circle. eiy. Notice the trajectory lines on the graph. If you slide z vertically, the result of ez would spin around a circle. If you slide z horizontally, the result shoots out exponentially along a line.
Raising z to an integer power is also simple. This is known as de Moivre's Formula:
zn = rneinθ = rn(cos(nθ) + isin(nθ)) where n is an integer
However, z raising to a fractional or complex power is not so clean. Complex exponentiation is a multivalued function, which means there are often multiple or even infinitely many solutions. We can either write a solution set, or define the function over a limited range where the its output is unique but the function is no longer continuous.
The complex natural logarithm is defined by reversing Euler's formula using algebra:
log(z) = log(r) + i(θ + 2πk) where k is any integer, and log(r) is the real natural log.
log(z)
= log(reiθ)
= log(r) + log(eiθ)
= log(r) + i(θ + 2πk)
This is a multivalued function, because rotation by any multiple of 2π is identical, so they are all possible solutions. There is no unique continuous complex log function. To make it a single-valued function, we define θ to be in the range (−π, π]. This range is called the principal branch and is the most commonly used. It is discontinuous on the negative real axis (x ≤ 0).
This line is called the branch cut, and you can define other logarithm functions where the branch cut is in a different place. It can be any curve going from the origin out to infinity. This is the boundary where the angle jumps by 2π.
The principal branch logarithm, denoted with a capital letter, is defined by:
Log(z) = log(r) + iθ where θ ∈ (-π, π]Therefore, to raise z to a complex power, we take the log and use Euler's formula.
Let z = reiθ and w = a + ib
zw = raei(blog(r) + (a + ib)(θ + 2πk)) where k is any integer
zw
= (elog(z))w
= ewlog(z)
= e(a + ib)(log(r) + i(θ + 2πk)) where k is any integer
= ealog(r) + iblog(r) + i(a + ib)(θ + 2πk)
= raei(blog(r) + (a + ib)(θ + 2πk))
Notice that when w is a real number, it simplifies (almost) to the integer power equation:
za = raeia(θ + 2πk) where k is any integer
It's still multivalued though. (If w is an integer, then k disappears because 2π remains a factor, and therefore does nothing to affect the polar location.) When you take the square root, which is z1/2, then it cancels the 2 in the +2πk term, making it +πk. There are two solutions for the square root, which is to be expected since the square root of a real number has two solutions. For example,
In complex arithmetic, z1/n has n solutions where n is an integer. They are equally spaced around a circle whose radius is r1/n. This symmetry means that the sum of all complex root solutions is zero.
Click to place the z point, and it will calculate all the root solutions for the specified power. The green point is the principal branch solution. Notice the discontinuity when the green suddenly flips to a different point.
Root Power:
If you raise z to an irrational power, like ze, then everything* will be a solution for θ. The values of k will no longer have π as a factor, so as you increase k, the solutions will randomly scatter and fill in the entire circle!
* Almost everything. Any non-zero interval, no matter how small, will have infinitely many solutions in it. But because k is an integer, there will only be a countable infinity of solutions, dense on the circle, but skipping infinitely many more irrational numbers that will never be solutions.
Functions
Real functions can also be extended to the complex number system.
cos(z) = eiz + e−iz 2
=
=
=
= cos(z)
sin(z) = eiz − e−iz 2i
=
=
=
= sin(z)
tan(z) = sin(z) cos(z) = eiz − e−iz i(eiz + e−iz)
=
=
=
= sin(z)
cosh(z) = cos(iz) = ez + e−z 2
cos(iz)
=
=
=
sinh(z) = −isin(iz) = ez − e−z 2
−isin(iz)
= −i
= −
=
cos−1(z) = −ilog(z ± i1 − z2 )
Let w = cos−1(z)
⇒ z = cos(w)
⇒ z =
⇒ 2z = eiw + e−iw
⇒ 2z = eiw +
⇒ 2z(eiw) = (eiw)2 + 1
⇒ (eiw)2 − 2z(eiw) + 1 = 0
⇒ eiw =
⇒ eiw =
⇒ eiw = z ±
⇒ eiw = z ±
⇒ eiw = z ± i
⇒ iw = log(z ± i
⇒ w =
⇒ w =
⇒ w =
⇒ w = −ilog(z ± i
⇒ cos−1(z) = −ilog(z ± i
sin−1(z) = −ilog(iz ± 1 − z2 )
Let w = sin−1(z)
⇒ z = sin(w)
⇒ z =
⇒ 2iz = eiw − e−iw
⇒ 2iz = eiw −
⇒ 2iz(eiw) = (eiw)2 − 1
⇒ (eiw)2 − 2iz(eiw) − 1 = 0
⇒ eiw =
⇒ eiw =
⇒ eiw = iz ±
⇒ eiw = iz ±
⇒ iw = log(iz ±
⇒ w =
⇒ w =
⇒ w =
⇒ w = −ilog(iz ±
⇒ sin−1(z) = −ilog(iz ±
tan−1(z) = 1 2i log(1 + iz 1 − iz )
Let w = tan−1(z)
⇒ z = tan(w) =
⇒ z =
⇒ iz(eiz + e−iz) = eiz − e−iz
⇒ izeiz +
⇒ (izeiz +
⇒ ize2iz + iz = e2iz − 1
⇒ ize2iz + iz = e2iz − 1
⇒ 1 + iz = e2iz − ize2iz
⇒ 1 + iz = e2iz(1 − iz)
⇒ 1 + iz = e2iz(1 − iz)
⇒ e2iz =
⇒ 2iz = log(
⇒ z =
Here's a 3D projection of the complex sin() function. Notice how if you rotate the graph to look down on it, you see the familiar real sin() function. The rest of the graph is a complex extension of that function.
Nearly every property and identity for the real functions remains true for these complex versions. In fact, many common trigonometric identities can be derived from these definitions with just a few lines of complex math! For example:
sin2(z) + cos2(z) = 1
sin2(z) + cos2(z) = 1
1 = 1
However, there are a few differences in behavior of the complex functions. Most importantly, sin() and cos() are unbounded. Their magnitude can grow infinitely large; it is not clamped between -1 and 1.
Conclusion
Here's something you can make by repeatedly squaring and adding complex numbers, with a simple iterated equation.
Zn+1 = Zn2 + C
This is the Mandelbrot set, one of the most famous fractals. Its boundary is an infinitely long maze of swirls and snowflakes!
Here's a close-up image of the boundary where C is near −0.5183335 + i0.5221748

(Click to open in the Mandelbrot viewer.)
Complex Number Calculator
Type an expression, click "Calculate", and it will display the answer in both Cartesian and polar form.
Examples:
Cartesian:
Here is my open-source JavaScript library, used for calculating all the complex math on this page:
⇓ Complex.js
References:
Complex Analysis
Theodore Gamelin (2001)