next up previous contents index
Next: Sinusoids as geometric series Up: Time shifts Previous: Time shifts   Contents   Index


Complex numbers

Complex numbers are written as:

\begin{displaymath}
Z = a + bi
\end{displaymath}

where $a$ and $b$ are real numbers and $i=\sqrt{-1}$. (In this book we'll use capital letters to denote complex numbers and lowercase for real numbers.) Since a complex number has two real components, we use a Cartesian plane (in place of a number line) to graph it, as shown in Figure 7.1. The quantities $a$ and $b$ are called the real and imaginary parts of $Z$, written as:

\begin{displaymath}
a = \mathrm{re}(Z) ,
\end{displaymath}


\begin{displaymath}
b = \mathrm{im}(Z)
\end{displaymath}

Figure 7.1: A number, $Z$, in the complex plane. The axes are for the real part $a$ and the imaginary part $b$.
\begin{figure}\psfig{file=figs/fig07.01.ps}\end{figure}

If $Z$ is a complex number, its magnitude, written as $\vert Z\vert$, is just the distance in the plane from the origin to the point $(a,b)$:

\begin{displaymath}
\vert Z\vert = \sqrt {({a^2} + {b^2})}
\end{displaymath}

and its argument, written as $\angle(Z)$, is the angle from the positive $a$ axis to the point $(a,b)$:

\begin{displaymath}
\angle(Z) = \mathrm{arctan}
{ \left ( {
b \over a
} \right ) }
\end{displaymath}

If we know the magnitude and argument of a complex number (say they are $r$ and $\theta$, for instance) we can reconstruct the real and imaginary parts:

\begin{displaymath}
a = r \cos (\theta)
\end{displaymath}


\begin{displaymath}
b = r \sin (\theta)
\end{displaymath}

A complex number may be written in terms of its real and imaginary parts $a$ and $b$ (this is called rectangular form), or alternatively in polar form, in terms of $r$ and $\theta$:

\begin{displaymath}
Z = r \cdot \left[ \cos(\theta) + i \sin(\theta) \right ]
\end{displaymath}

The rectangular and polar formulations are equivalent, and the equations above show how to compute $a$ and $b$ from $r$ and $\theta$ and vice versa.

The main reason we use complex numbers in electronic music is because they magically encode sums of angles. We frequently have to add angles together in order to talk about the changing phase of an audio signal as time progresses (or as it is shifted in time, as in this chapter). It turns out that, if you multiply two complex numbers, the argument of the product is the sum of the arguments of the two factors. To see how this happens, we'll multiply two numbers $Z_1$ and $Z_2$, written in polar form:

\begin{displaymath}
{Z_1} = {r_1} \cdot \left [ \cos({\theta_1}) + i \sin({\theta_1}) \right ]
\end{displaymath}


\begin{displaymath}
{Z_2} = {r_2} \cdot \left [ \cos({\theta_2}) + i \sin({\theta_2}) \right ]
\end{displaymath}

giving:

\begin{displaymath}
{Z_1}{Z_2} = {r_1}{r_2} \cdot
{ \left [ {
\cos({\theta_1...
...\theta_2}) -
\sin({\theta_1}) \sin({\theta_2})
} \right . }
\end{displaymath}


\begin{displaymath}
{ \left . {
+ i \left (
\sin({\theta_1}) \cos({\theta_2}) +
\cos({\theta_1}) \sin({\theta_2})
\right )
} \right ] }
\end{displaymath}

Here the minus sign in front of the $\sin({\theta_1}) \sin({\theta_2})$ term comes from multiplying $i$ by itself, which gives $-1$. We can spot the cosine and sine summation formulas in the above expression, and so it simplifies to:

\begin{displaymath}
{Z_1}{Z_2} = {r_1}{r_2}
\cdot \left[ \cos({\theta_1}+{\theta_2})
+ i \sin({\theta_1}+{\theta_2}) \right ]
\end{displaymath}

And so, by inspection, it follows that the product ${Z_1}{Z_2}$ has magnitude ${r_1}{r_2}$ and argument ${\theta_1}+{\theta_2}$.

We can use this property of complex numbers to add and subtract angles (by multiplying and dividing complex numbers with the appropriate arguments) and then to take the cosine and sine of the result by extracting the real and imaginary parts of the result.



Subsections
next up previous contents index
Next: Sinusoids as geometric series Up: Time shifts Previous: Time shifts   Contents   Index
Miller Puckette 2005-04-01