#
1.3

Complex Numbers

## Imaginary Numbers

In the space of real numbers, the negative numbers do not have a defined square root, because any real number (positive or negative) multiplied by itself will have a positive product.

However, we can arbitrarily define a value called $j$ to represent the square root of -1. Note that in electrical engineering we use $j$ to avoid clashing with the use of the letter $i$ for current, and because it’s more distinct when written down.

This is now an “imaginary” number.

These imaginary numbers do not themselves have physical meaning: I can eat 3 slices of pizza, but I can’t eat $3 j$ slices of pizza. However, we’ll show that complex numbers form a self-consistent area of mathematics, and that their close connection to circles, trigonometry (sines and cosines), and sine waves makes them a powerful and convenient tool for tracking both the magnitude and phase of a sine wave as it propogates through any system.

## Complex Numbers and 2D Vectors

By adding real and imaginary numbers we can have complex numbers. Instead of imaginging the number line as a single line from $-\infty$ to $+\infty$ , we can imagine the space of complex numbers as being a two-dimensional plane: on the x-axis are the real numbers, and on the y-axis are the imaginary. Any point on the 2D plane is now a complex number:

If you’ve worked with the idea of unit vectors before (such as $\hat{x} \hat{y} \hat{z} \ \text{or} \ \hat{i} \hat{j} \hat{k}$ ), then in some sense we can imagine this as a space defined by two unit vectors, $\hat{1}$ and $\hat{j}$ . Of course, we don’t normally write $\hat{1}$ at all, but we can imagine that it’s there.

We can define basic operations on complex numbers $z = a + b j$ by thinking about them as two-dimensional vectors:

## Multiplication and Rotations

Multiplication is a more complicated case, but we can expand the product and work term by term to get the correct result:

If we consider the special case of multiplying by $j$ :

Interestingly, we find when multiplying by $j$ , the real and imaginary parts of $z_1$ have swapped, and the real part gets a negative sign too.

This maps geometrically to a rotation by 90 degrees counterclockwise around the origin, assuming we’ve drawn the real numbers on the x-axis and the imaginary numbers on the y-axis. If this is not clear, draw a two-dimensional plane with any point $(a,b)$ labeled. Then, plot the point $(-b, a)$ .

Multiplication by $j$ a second time (i.e. multiplying $z_1$ by $j$ twice) maps geometrically to two 90 degree rotations, for a total of rotation 180 degrees around the origin:

Similarly, multiplication by $-j$ corresponds to 90 degree clockwise rotation. In either direction, this series of rotations is periodic, because $j^4 = (-1)^2 = 1$ .

## Complex Conjugate

The complex conjugate $\bar{z}$ of a complex number $z$ is defined as the value with negative imaginary part:

The complex conjugate is important because it multiplies with the original complex number to a purely real number:

## Division

Using the complex conjugate and multiplication definitions, we can define the divison of complex numbers as well:

Notice that for two purely real numbers (i.e. $b = 0 \ \text{and} \ d = 0$ ), this simplifies to ordinary division: $\frac {z_1} {z_2} = \frac {a} {c}$ . The real numbers are a subset of the complex numbers.

## Phase Angle and Magnitude

As previously mentioned, complex numbers can be though of as part of a two-dimensional vector space, or imagined visually on the x-y (Re-Im) plane. These graphical interpretations give rise to two other geometric properties of a complex number: magnitude and phase angle.

The magnitude of a complex number is defined just like it is in three-dimensional vector spaces, as the overall length of the vector from the origin:

The phase angle is defined graphically from the x-y plane interpretation: it is the counterclockwise angle from the positive x-axis to the vector represented by the complex number. The phase of a positive real number is 0 degrees, and that of a negative real number is 180 degrees or $\pi$ radians. In general, the phase is defined as:

However, the naive $\tan^{-1}$ definition does obscure the fact that a complex number with negative real part and negative imaginary part lies in the 3rd quadrant: the range of $tan^{-1}$ is $\big[ -\frac{\pi}{2} , +\frac{\pi}{2} \big]$ which is only $\pi$ radians or 180 degrees wide – it covers only half of the phase space. (In computer programming, the “atan2” function accounts for these multi-quadrant issues and gives a full $2\pi$ range of output by checking the sign of numerator and denominator before proceeding. You should do the same when working by hand.)

Although we have previously defined a complex number in terms of a Cartesian two-dimensional plane with orthogonal real and imaginary parts, an alternative polar interpretation is easy, useful, and suggested by the phase and magnitude. As long as we’re careful to have specified the phase angle with a full $2\pi$ range, we can directly map any complex number with Cartesian representation $z = (a, b)$ to a polar representation $(r, \theta)$ , where $r=|z|$ and $\theta = \phi(z)$ . To map back and forth between the two representations, note that:

## Operations on Polar Complex Numbers

While some operations like addition and subtraction are easiest in the Cartesian representation $a + b j$ , other operations are actually simpler in the polar representation $(r, \theta)$ . In particular, multiplication and division become quite simple:

In multiplication, the two radius (or magnitude) values multiply, and the two phase angles add. (As an exercise, you may wish to prove this to yourself on paper.)

This is useful because many electronic systems like amplifiers and filters can be though of as working multiplicatively: a filter may reduce the input magnitude by a factor $\frac {1} {10}$ and apply a phase delay of -90 degrees. By tracking both the magnitude and phase, we can consider this filter as effectively being like multiplying the input signal by a complex number $z_{\text{filter}} = (r=\frac{1}{10}, \theta=-\frac{\pi}{2}) = -\frac{1}{10} j$ . For a quick hint of what’s to come, here’s a simple RC low-pass filter that behaves like this complex number (at least, it does at the particular frequency we’ve specified):

Exercise Click the circuit, then click “Simulate”, and “Run Time-Domain Simulation.” Observe the output signal is about a tenth as tall as the input, and the sine wave of the output is (very roughly) 90 degrees behind the input.

In division, it’s quite similar:

In division, the magnitudes are divided, and the phase angles are subtracted. (Again, you may wish to prove this as an exercise.)

## Euler’s Formula and Polar Complex Numbers

The polar representation of complex numbers is closely connected to one of the most beautiful expressions in mathematics. First, we start by observing that

The $r$ is just a scaling factor, but the other term is actually very interesting: the angle $\theta$ traces out a unit circle on the complex number plane. Again, if the complex number notation is unfamiliar, just observe that if we had two axes with unit vectors $\hat{x} \hat{y}$ then the vector equation

traces out a unit circle on the x-y plane.

It turns out that there is a more compact representation of the complex plane unit circle, and it’s an incredible piece of mathematics called Euler’s Formula:

If you haven’t seen this before, this may seem cryptic, but it is incredibly powerful. The natural base constant $e$ raised to any imaginary number produces a complex number with unit magnitude and angle varying with the parameter.

Taking this as a given for the moment, this lets us write the complex number $z$ very simply:

Any complex number can be written in this form, where $r$ and $\theta$ are real numbers specifying the magnitude and phase of the complex number.

Importantly, from this definition, the rules about multiplication and division of complex numbers are very easy to work with. Since for any exponents $e^A e^B = e^{(A+B)}$ and $\frac{e^A} {e^B} = e^{(A-B)}$ :

It’s reasonable to ask what it even means to raise a number to an imaginary number. Exponentiation of any base $b^n$ is clear enough when $n$ is a positive integer: multiplying $b$ by itself $n$ times. When $n$ is not an integer, it’s stranger: $n=\frac {1} {2}$ implies a square root, for example. But any exponentiation can be transformed to one in base $e$ , the base of the natural logarithm:

So far we’ve only shown that any real exponentiation can be made into a natural exponent and a natural logarithm. But for a computer to evaluate any (non-integer) exponent or any natural logarithm, we have to find a way to express these operations in terms of basic arithmetic: addition, multiplication, division, etc. Fortunately, we have something called the Taylor series expansion of $e^x$ :

This is an infinitely long series, but each term is simply a polynomial term in $x$ : easy enough to calculate by multiplying $x$ by itself an integer number of times directly. The terms eventually get smaller and smaller toward 0 because the factorial function in the denominator grows faster than the polynomial in the numerator, so the infinite series converges to a finite value for all inputs.

Other functions like $\sin(x)$ and $\cos(x)$ also have Taylor series expansions as polynomials:

When comparing the Taylor series for $\cos(x)$ and $\sin(x)$ with that for $e^x$ above, you can see there’s something interesting going on: all the $e^x$ terms with even powers of $x^n$ (including $n=0$ ) are contained within the series for $\cos(x)$ , and all the odd power terms are contained within the series for $\sin(x)$ – except for a pattern of alternating minus signs!

Now let’s take a look at the unit imaginary number $j = \sqrt{-1}$ and see what happens when it’s raised to the n-th power:

The idea that multiplication by $j$ is like rotating 90 degrees counterclockwise in the real-imaginary plane is a useful one here. After four rotations, we’re back to where we started.

Now look at just the first and third rows listed here:

If you look at the Taylor series expansion for $\cos(x)$ , it has $(-1)^{\frac{n}{2}}$ in each term, which maps precisely to this sequence for all even values of $n$ . Simply by comparing values, for even values of $n$ , we can write:

Of course we could also have observed that

For the odd terms, we find something similar:

If you look at the Taylor series expansion for $\sin(x)$ , it has $(-1)^{\frac{(n-1)}{2}}$ in each term. This gives us the correct sequence of positive and negative inversions, but are missing the $j$ . (This missing factor of $j$ is OK – we’ll simply multiply by $j$ shortly to bring it back.)

So finally, let’s reassemble everything. Here is the series for $\cos(\theta)$ :

And here’s the series for $j \sin(\theta)$ (we’ve simply multiplied every term by $j$ to fix the “missing” imaginary value from the sequence above):

And the series for $e^{j \theta}$ will proceed similarly:

And so, when we combine $\cos(\theta)$ (providing the even terms) and $j \sin(\theta)$ (providing the odd terms), we find precisely:

This is known as Euler’s formula.

Sometimes this is evaluated at a single point $\theta = \pi$ and written as:

This is famously known as Euler’s identity, and now hopefully you can understand where it comes from: just a special case of Euler’s formula.

## Phasors

As mentioned earlier, complex numbers can be used to represent the magnitude and phase of a sine wave. These two values – magnitude and phase – are all that’s needed to specify any sine wave.

Recalling our earlier example:

At the particular frequency of this example, the filter can be though of as (approximately) multiplying the magnitude of the input sine wave by 0.1, and (approximately) modifying the phase by -90 degrees. (We’re saying “approximately” because we’ve done some rounding to nice values. We’ll discuss how to analyze and design such filters in later chapters, but for now, just take it as a given that this design does approximately that.)

If we look at this purely in the time domain, for our single frequency $f=1000 \text{Hz}$ , we might consider our input $x(t)$ and output $y(t)$ :

This is a simple, linear filter: if we double the magnitude of $x(t)$ , the magnitude of $y(t)$ also doubles. If we change the phase of the input by 20 degrees, we also change the phase of the output by 20 degrees. Yet, perhaps surprisingly, it would be very hard to write a single general algebraic formula that describes the filter transfer function $\frac {y(t)} {x(t)}$ . The amplitude part would factor out easily, but the phase part is trapped inside some sine expressions.

Instead, we can think about our input and output signals as phasors. This means that instead of treating $x(t)$ as a function of time, we just treat it as a single complex number $X$ which represents a sine wave at our particular frequency. The magnitude and phase of $X$ represent that of the sine wave. Similarly, our output is just a single complex number $Y$ . The advantage of doing so is that we can now represent our entire filter (at this frequency) very compactly:

We’re making two big assumptions here in order to work with these complex numbers called phasors:

First, we’re assuming that putting in a sinusoidal wave means we’ll get something shaped like a sinusoidal wave out. (Later we’ll show that this is always true for Linear Time-Invariant (LTI) Systems, but assume it’s true for now.)

Second, we’re assuming that we’re only working at one single particular frequency (for now) – or equivalently we’re assuming that if we put in only a sinusoidal signal at frequency $f$ , we’ll only get a sinusoidal signal at $f$ out. (Again, we’ll show this to be true for LTI systems. Additionally, in the future, we’ll look at how to combine different sinusoids at different frequencies – the key insight to Laplace and Fourier Transforms and the Frequency Domain.)

As long as we’re comfortable with these assumptions, we can now go back and forth between our two representations.

## A Phasor Example

Suppose our input signal is $x(t) = 5 \cos(2 \pi \cdot 1000 t)$ : we can represent this with a phasor of magnitude 5 and phase 0, or

We can apply our filter $(\frac{1}{10} e^{-j \frac{\pi}{2}})$ to find the phasor for our output:

How do we go back and forth from the phasor representation to the time-domain representation?

First, note that we can write the frequency $f=1000 \text{Hz}$ as an angular frequency, often denoted by the greek character $\omega = 2 \pi f$ , so for this example, $\omega = 2 \pi \cdot 1000$ . We do this just because it gets tiring to write $2\pi f$ everywhere!

Now, to go from a phasor $X = 5 e^{j 0}$ to the function $x(t)$ , we just multiply $X$ by $e^{j \omega t}$ and then take the real part of the result:

This complex value $e^{j \omega t}$ is our base complex-valued sinusoid. Note that it keeps track of both a cosine and a sine at the same frequency within its real and imaginary parts, respectively. When we take the real part $\Re{(5 e^{j 0} e^{j \omega t})}$ we find:

This was a particularly simple example because X was purely real. But now let’s find $y(t)$ from our complex phasor Y:

In this case, $Y$ was purely imaginary, and we find that $y(t)$ purely has a $\sin(\omega t)$ term. In general, however, if $Y$ has nonzero real and imaginary parts, then the time-domain $y(t) = \Re { \big( Y \cdot e^{j \omega t} \big) }$ will have both cosine and sine terms.

Note that it’s always possible to write a linear combination of $\cos(x)$ and $\sin(x)$ as only $\cos(x + \theta)$ for some phase angle $\theta$ . In simple 90-degree cases, we may have a simple expression such as:

In more advanced cases for intermediate values, remember that:

So for our example above, we could write:

Here, we’ve shown that while it is very hard to write a general algebraic function for this simple filter that transforms our input sine wave $x(t)$ directly into the output sine wave $y(t)$ , it’s actually quite simple if we think of both input and output as being complex-valued phasors representing the magnitude and phase of the corresponding sinusoid. Applying the filter then becomes simply multiplication by a complex number, which is easy. And we can get back from our complex phasor $Y$ to our time-domain signal $y(t)$ by multiplying by our complex sine wave $e^{j \omega t}$ and then finally taking the real part.

### Summarized:

- Write the input sinusoid $x(t)$ as a complex number $X$ with magnitude and phase corresponding to the input sine wave.
- Multiply $X$ by the complex number representing the effect of the filter at this particular frequency. Magnitudes will multiply and phases will add to get a new complex number $Y$ .
- Convert the complex phasor $Y$ back into a time-domain signal $y(t)$ by multiplying $Y \cdot e^{j \omega t}$ and then taking the real part:

## What’s Next

In the next section, Linear & Nonlinear, we’ll switch gears and talk about linearity and why it’s so useful to understanding and designing systems of all kinds.

**Ultimate Electronics: Practical Circuit Design and Analysis.**CircuitLab, Inc., 2019, ultimateelectronicsbook.com. Accessed . (Copyright © 2019 CircuitLab, Inc.)