Home >Science  >  FFT: Complex Numbers

Complex Numbers

The beauty of physics and mathematics is that everything is somehow related to everything else, and that there are so many ways of looking at the same thing, each providing new insights. Take for instance the Fourier transform. The physics of a harmonic oscillator is described by a differential equation whose solutions are trigonometric functions. A sound wave may excite a given harmonic oscillator by periodically pushing and pulling at it. When we digitize the sound, we turn it into an N-dimensional vector. The amount of excitation this sound impairs on a particular oscillator is calculated by taking the scalar product of this vector with a special basis vector in N dimensions. This basis vector is a result of sampling a trigonometric function that describes the movement of the oscillator.

Trigonometric functions are easy to understand but difficult to handle. Fortunately, there is a better language to describe the solutions to a harmonic oscillator--complex numbers. But before we get there, let's look more closely at the differential equations that describe oscillating and non-oscillating motions.

Of Rabbits and Exponentials

A population of rabbits has this peculiar property that the more rabbits there are the more they multiply. The rate of growth of the population at any moment of time is proportional to its size. In mathematics, the rate of growth is described by a derivative. The larger the derivative, the faster something grows.

Let's denote the population of rabbits at time t by p(t). Its derivative is denoted by dp(t)/dt. What we have just have said about the law of population growth of rabbits can be written in the form of a differential equation:

dp(t)/dt = α*p(t)

where α is some proportionality constant. There is a function in mathematics that can be used to solve this equation, it's called the exponential. It is defined as e to the power of t, with e being the special number called "the base of the natural logarithms" and approximately equal to 2.71828. The derivative of the exponential function, et, is equal to the function itself:

det/dt = et

It's a function which: the bigger it is, the faster it grows.

Our population of rabbits will therefore grow exponentially, that is, it will follow an exponential function:

p(t) = A*eαt

with A being the size of the population at t=0 (remember that e0 = 1). The parameter α is called the exponent of the exponential function.

Notice that the second derivative (the derivative of the derivative) of the exponential function is still equal to the function itself. If we include an arbitrary exponent, we get:

d2eαt/dt2 = α2eαt

In other words, taking the second derivative of the exponential function is equivalent to multiplying it by the square of the exponential. In general, it's a very useful thing to know when solving differential equations: the n-th derivative of the exponential function is equal to the function itself multiplied by the n-th power of its exponential.

Now back to our oscillator. Remember the differential equation it fulfilled?

d2x(t)/dt2 = -ω2x(t)

Darn! We are so close! If it weren't for this minus sign, we could solve this equation using an exponential. All we need is a special number, call it i, whose square would be equal to minus one. We could then write:

x(t) = A*eiωt

with the understanding that (iω)2 = -ω2.

The Imaginary Unit

It turns out that mathematicians have thought of numbers whose squares are negative. I will not go into all the (very interesting) mathematical subtleties here. The important thing is how one performs calculations on such numbers.

It is enough to take it at face value that there is such an entity called the imaginary unit, i (engineers often call it j), whose only interesting property is that its square is -1. In other words, i is the square root of -1. Now that you've suspended your disbelief, you can do all kinds of calculations using complex numbers of the form

z = x + iy

where x and y are regular (real) numbers. The x number is called the real part, and thy y number the imaginary part of z. For instance, you can add two such numbers, z and w,

z + w = (x + iy)+(v + iu) = x + v + i(y + u)

or multiply them,

z * w = (x + iy)(v + iu) = xv + iyv + ixu + (i*i)yu
= xv - yu +i(yv + xu)

Just like this! Notice that the results of arithmetic operations on complex numbers are again complex numbers.

In order to see how division works, let's first introduce an operation called complex conjugation. The complex conjugate of z is z* = (x - iy). We just flip the sign in front of i. When you multiply a complex number by its complex conjugate, you always get a real positive number. Check this out:

z z* = (x + iy)(x - iy) = x2 + iyx - ixy -(i*i)y2 = x2 + y2

The square root of this number, sqrt (x2 + y2) is called the modulus of a complex number.

Dividing by a complex number z is equivalent of multiplying it by its complex conjugate divided by modulus square. Indeed, try multiplying z by this:

z*/(z z*)

and you will get 1. Therefore this is indeed the inverse of z.

Now back to our differential equations. The solution of the harmonic oscillator using complex numbers is indeed:

x(t) = A*eiωt

Let's look at the properties of the complex exponential with an imaginary exponent. First of all, its modulus is one, because

eit(eit)* = eite-it = eit-it = e0 = 1

No magic here: complex conjugation flips the sign in front of i, the multiplication of powers with the same base is equivalent to the summing of the exponents, and finally, anything to the power of zero is equal to one.

And here's the tour de force: eit is a complex number, so, by definition, it must be of the form x + iy. So what are the values of x and y? Guess what, they are the good old trigonometric functions:

eit = cos(t) + i sin(t)

Do you see that the modulus of this complex number is one? (Hint: it's a simple trigonometric identity based on the Pythagorean theorem.)

We have made a full circle (there's a subtle pun in here). We knew that the solutions to the equation of the harmonic oscillator could be expressed in terms of trigonometric functions. On the other hand, we were able to solve this equation using a complex exponential. Now we see that this single exponential describes both the sine and the cosine oscillations in one compact package. It's the same physics, but the new notation is a lot easier, once you get used to it.

Trigonometry Made Simple

Remember this identity?

sin (a + b) = sin (a) cos (b) + cos (a) sin (b)

We used it in our discussion of the harmonic oscillator. Frankly, I can never remember those trigonometric identities. But with complex numbers they are trivial to derive. For instance, you know that

ei(a + b) = eiaeib

Using our exponential/trigonometric equivalence, we get

ei(a + b) = cos (a+b) + i sin (a+b)

and

eiaeib = (cos (a) + i sin (a)) (cos (b) + i sin (b))
= cos (a) cos (b) - sin (a) sin (b)
+ i (sin (a) cos (b) + cos (a) sin (b))

Comparing these two, we get two separate trigonometric identities for the price of one.

cos (a + b) = cos (a) cos (b) - sin (a) sin (b)

sin (a + b) = sin (a) cos (b) + cos (a) sin (b)

since both the real parts and the imaginary parts have to be independently equal.

Finally, since they are described by pairs of real numbers, complex numbers can be viewed as 2-dimensional vectors. A complex number with modulus one is equivalent to a unit vector. In particular, a complex exponential, eit, can be seen as a unit vector at an angle t from the x-axis, see Fig. This angle is called the phase of the complex number.

complex exponential on a unit circle

Fig. A complex number of modulus one and phase t represented as a vector on a unit circle


In general, any complex number, z = x + i y can be represented as the modulus r times the complex exponential of the phase φ,

z = r e.

Using this representation, the most general solution of a harmonic oscillator, A*eiωt + φ can be viewed as a vector moving around a circle of radius A with constant angular speed ω. The initial phase, φ, defines the starting point of the movement.


Next ButtonNext: Digital Fourier Transform