• No results found

Complex numbers

A linear systems toolbox

2.3 Complex numbers

You may remember from your high school maths that the roots of a quadratic equation given by

ax2+ bx + c = 0 (2.14)

are obtained with recourse to the formula x = −b ±

b2− 4ac

2a . (2.15)

In this case, the roots mean the values of x for which the quadratic is zero. If we take the equation given by

1

2x2+ 3x + 5 = 0, (2.16)

then we find the roots to be x = −3 ±√

9− 10

1 = −3 ±√

−1 (2.17)

as obtained using Equation (2.15). Clearly, we cannot evaluate the root of a negative number, and so we denote the square root of−1 by the letter j, known as the imaginary operator. (Pure mathematicians use the letter i instead, but this is not done in electrical

and electronic engineering because this letter is used as the symbol for current.) Equation (2.17) can therefore be restated as

x = −3 ± j. (2.18)

Similarly, if the quadratic was given by

x2+ 6x + 13 = 0, (2.19)

then the roots would be x = −6 ±√

36− 52

2 = −3 ±√

−16 = −3 ± j4. (2.20)

Any number preceded by the letter j is termed imaginary, and a number that consists of a real and imaginary term is called complex. Although the existence of complex numbers was suspected in ancient times, it was not until the sixteenth century that investigations into their properties and usefulness began in earnest (Gullberg, 1997).

In 1545 Girolamo Cardano used them to divide the number 10 into two parts such that their product was 40. However, he regarded imaginary numbers with deep suspicion, and they were left to languish until 1685, when John Wallis published a treatise in which he proposed the idea, rather obscurely, of representing complex numbers as points on a plane. The treatment was extended further in the eighteenth century independently by Caspar Wessel, Jean Robert Argand and finally Carl Friedrich Gauss, who first explicitly used the phrase ‘complex number’.

The phraseology of complex numbers is a little misleading; they are not partic-ularly complicated to use, and the imaginary operator has very real effects, as we shall see. First, we need to establish a few basic rules of complex number arithmetic.

Consider two complex numbers given by z1= a + jb and z2= c + jd. These may be manipulated algebraically as follows:

Addition and subtraction. This is performed by adding or subtracting the real and imaginary parts separately, that is,

z1+ z2= (a + c) + j(b + d). (2.21)

Multiplication. Assume all quantities are real and use j2= −1 to simplify, that is, z1z2= (a + jb)(c + jd) = (ac − bd) + j(bc + ad). (2.22) Division. Multiply both the numerator and the denominator by the complex conjugate of the denominator. The complex conjugate of a complex number is obtained by changing the sign of the imaginary term. Hence we have

z1

It is worth remembering that the product of a complex number with its conjugate is always a real number, in this case (c2+ d2).

When a complex number is written as a real and imaginary term, that is, a + jb, it is said to be in Cartesian or rectangular form. It can be represented graphically by plotting it on a complex plane, where the horizontal denotes the real axis and the vertical denotes the imaginary axis. Figure 2.8(a) shows various complex numbers plotted in this way. This is also called an Argand diagram (Stroud, 2001). You can use these diagrams to add complex numbers, by constructing a parallelogram as shown and plotting the diagonal. This procedure is clearly vector addition, since each complex number has a magnitude and direction.

Extending this idea further, Figure 2.9 shows that the magnitude is the distance the complex number lies from the origin, and the direction is the angle it subtends to it. Therefore, instead of representing it in Cartesian form, we can represent it in polar

1 2 3 4

Figure 2.8 (a) Complex numbers plotted on the complex plane; ( b) graphical representation of complex number addition

Real

Figure 2.9 A complex number in polar form

form thus:

z = a + jb = r(cos θ + j sin θ),

z = r∠θ, (2.24)

where r is called the magnitude or modulus, often denoted by |z|. The term θ is the phase angle, or argument of the complex number. These identities are obtained as follows:

|z| = r =

a2+ b2 arg(z) = θ = tan−1 b

a

. (2.25)

Do not try to evaluate imaginary numbers like real numbers – you cannot. Think of them instead as phase shift operators. As Figure 2.9 suggests, multiplying a num-ber by j is equivalent to phase shifting it by 90, or π/2 radians. On this point, it is important to remember that in order to calculate the phase angle correctly, you must take into account the quadrant in which the complex number lies. Polar forms of complex numbers are often used because they simplify the process of multipli-cation and division. To multiply complex numbers in polar from, the moduli are multiplied and the phases are added. To divide, the moduli are divided and the phases subtracted thus:

z1z2= r1r2∠θ1+ θ2, z1

z2 = r1

r2∠θ1− θ2. (2.26)

In addition to their Cartesian and polar representations, complex numbers also have an exponential form. In order to prove this, we need to expand on the main points of De Moivre’s theorem, which exploits the fact that exponentials, sines and cosines may be expressed as power series (Steiglitz, 1996). We will not go into the details – lots of books cover this subject. Instead, we will just show the key relationships, which are:

e = cos θ + j sin θ, e−jθ = cos θ − j sin θ,

cos θ = 1

2(e+ e−jθ), sin θ = −j

2 (e− e−jθ).

(2.27)

By combining the identities given in Equation (2.24) and the upper line of Equation (2.27), we obtain a very compact representation of a complex number:

z = r e. (2.28)

When are the three representations of complex numbers – Cartesian, polar and exponential – used in DSP? Recourse is made to the Cartesian form when coding

digital filters based on the z-transform; the polar form is employed when we wish to combine the responses of a set of linear systems; the exponential form is used in the formulation and analysis of the Fourier transform (Lynn, 1986).

Example 2.1

If z1= (3 + j6) and z2= (2 − j7), then obtain the following:

(a) z1+ z2, (b) z1× z2, (c) z1/z2,

(d) The magnitude and phase of the answer to part (c).

Solution 2.1

A word of advice: if you have not got one already, buy yourself a calculator that can handle complex numbers – they really are worth it. You can just enter additions, multiplications and divisions directly, without having to worry about rearranging the terms. As long as you understand what is going on, there isn’t any merit in algebraic donkeywork!

2.4 Calculus

Calculus is the branch of mathematics that deals with infinitesimal quantities;

although infinitesimals were addressed by the ancient Greeks, little progress was made on this subject in Europe until the sixteenth century (Gullberg, 1997). The founders of modern calculus are generally regarded to be Isaac Newton and Gottfried Wilhelm von Leibniz, who independently (and about the same time, between 1665 and 1684) developed the techniques we use today. Calculus comes in two basic forms: differ-entiation, also known as differential calculus, and integration, or integral calculus.

We will see later why calculus is important to the subject of DSP. Because it deals with infinitesimals, calculus is applied to continuous systems. However, there are equivalent methods for discrete signals; for differentiation we have differencing, and for integration we have summation. In the discussion below, we will use x to represent x(t).

P

Figure 2.10 (a) The differential of a curve at point P and (b) its approximation

2.4.1 Differentiation

Take a look at the curve shown in Figure 2.10(a), which shows x as a function of t given by x = f (t). We want to calculate the gradient, or slope, of the curve at point P, which has coordinates given by (t, x). This gradient is the same as slope of the tangent of the curve, indicated by the straight line AB. Now, we can approximate the slope of the tangent by drawing a chord that intersects the curve at point P and point Q; this is shown in Figure 2.10(b). If the coordinates of Q are given by (t + δt, x + δx), then the gradient of the chord PQ is given by

Gradient of chord AB= change in x

change in t = (x + δx) − x (t + δt) − t =δx

δt. (2.29)

We can make this approximation ever more accurate by making δt ever smaller, hence moving the point Q closer to P, until we achieve complete accuracy when δt is infinitesimal (Croft and Davidson, 1999). This is the differential of the function f (t) at point P, and we can say that

The term dx/dt denotes the differential coefficient, or derivative, of x. Bear in mind that the notation f(t) is also widely used. Over the years, mathematicians have obtained the derivatives for a wide range of functions, and there are standard tables available that supply formulae and solutions. Here, we will concentrate on the ones we will encounter most often in this book, and these are provided in Table 2.4. If we need any others, we will note them at the time.

Differentiation of a product. If x is a product of two functions of t, for example, x = u(t)v(t), then we use the product rule to obtain the differential. This rule is given by:

dx dt = udv

dt + vdu

dt. (2.31)

Table 2.4 Some common functions and their derivatives (adapted from Bird and May, 1981)

x or f (t) dx/dt or f(t)

k 0

t 1

ktn kntn−1

ekt k ekt

ln kt 1/t

sin(ωt) ω cos(ωt)

cos(ωt) −ω sin(ωt)

tan(ωt) ω sec2(ωt)

Quotient rule. If x is the quotient of two functions of t, that is, x = u(t)/v(t), then we use the quotient rule to obtain the differential. This is given by:

dx

dt =v(du/dt) − u(dv/dt)

v2 . (2.32)

Chain rule. If x is a function of a function, for example, x = (2 + 4t)4, then we use dx

dt =dx du ×du

dt, (2.33)

where in this case, u = (2 + 4t) and x = u4.

Higher derivatives. If we differentiate the first derivative, we obtain the second deriva-tive. If we differentiate this, we get the third derivative, and so on. The order, n, of the derivative is represented by dnx/dtn, or by the functional notation with the number of dashes corresponding to the order, for example, f(t) represents the third derivative.

Example 2.2

Obtain the derivatives of the following functions:

(a) x = 5t3+ 7 t43

t4− 6, (b) x = ln 4t + 4(sin 2t − cos 9t), (c) x = 4 e−2t(sin 5t − cos 8t), (d) x = t e2t

2 cos t.

Solution 2.2

(a) x = 5t3+ 7t−4− t4/3− 6 dx

dt = 15t2− 28t−5−4

3t1/3= 15t2−28 t5 −4

3

3

t.

(b) x = ln 4t + 4 sin 2t − 4 cos 9t dx

dt = 1

t + 8 cos 2t + 36 sin 9t.

(c) x = 4 e−2tsin 5t − 4 e−2tcos 8t.

Each term is a product of functions of t. Using the product rule for the first term, which we will call x1, we obtain

dx1

dt = (4 e−2t)(5 cos 5t) + (sin 5t)(−8e−2t)

= 20 e−2tcos 5t − 8 e−2tsin 5t.

Using the product rule for the second term we call x2yields dx2

dt = (−4 e−2t)(−8 sin 8t) + (cos 8t)(8 e−2t)

= 32 e−2tsin 8t + 8 e−2tcos 8t.

Combing these identities gives dx

dt = (4 e−2t)(5 cos 5t + 2 cos 8t − 2 sin 5t + 8 sin 8t).

(d) The function x = t e2t/2 cos t is a quotient, with the numerator as a product of two functions. If we say that u = t e2t and v = 2 cos t, then by the product rule, du/dt = e2t(1 + 2t). Also, dv/dt = −2 sin t. Using the quotient rule, we obtain

dx

dt =e2t(1 + 2t)2 cos t − (t e2t)(−2 sin t)

4 cos2t =e2t[(1 + 2t) cos t + t sin t]

2 cos2t .

2.4.2 Integration

Integral calculus, or integration, is often taught as the reverse process to differentia-tion; this is why it is normally introduced after we have learned how to differentiate.

In other words, if we have a derivative of a function, by applying the laws of integration we can recover the original function. Given a general function x = ktn, then the rule

Table 2.5 Some common functions and their indefinite integrals (adapted from Bird and May, 1981)

x or f (t) Indefinite integral, f (t) dt

k kt + c

t t2

2 + c

ktn ktn+1

n + 1 + c k

t k ln t + c

ekt 1

kekt+ c

sin(ωt) −1

ωcos(ωt) + c

cos(ωt) 1

ωsin(ωt) + c

sin A cos B Use the rule: sin A cos B =12[sin(A + B) + sin(A − B)]

sin A sin B Use the rule: sin A sin B = −12[cos(A + B) − cos(A − B)]

cos A cos B Use the rule: cos A cos B = −12[cos(A + B) + cos(A − B)]

for integration is



ktndt = ktn+1

n + 1+ c. (2.34)

So where has the constant, c, come from? Well, if you think about it for a moment, differentiating, say, x = 3t + 2 would yield 3. If we now integrate back again using Equation (2.34), we obtain 3t + c (remember, 3 can also be written 3t0, since any number raised to a zero power gives 1). Since information was irretrievably lost in the differentiation process, we have ended up with an undefined constant in our solution. Therefore, this is called an indefinite integral. In contrast, definite integrals yield a numerical value for the constant, and can only be obtained if the limits of integration are known (Weltner et al., 1986). Before we deal with this subject, take a look at Table 2.5, which lists some common functions and their associated integrals.

Again, there are lots of mathematical recipe books that provide tables with dozens of functions and their integrals, but these are the ones that are of most interest to us.

Definite integrals. If we wish to integrate a function over some limited range – from a to b, for example – then we substitute t for these values once the integral has been obtained, and subtract the function with the lower limit from the one with the higher limit. In this case, the constant disappears.

Example 2.3

Obtain the integral of 4t3, given that the limits are a = 4 and b = 7.

Solution 2.3

 7

4 4t3dt = [t4]74= 2401 − 256 = 2145.

Algebraic substitution. If a function is not in a standard form, it is often possible by means of substitution to obtain an expression that is more easily integrated. Usually, u is set equal to f (t) such that f (u) du is a standard integral.

Integration by parts. If the function to be integrated is the product of two functions of the independent variable (here t), then we call one term u and the other term dv, where dv is the differential of v. Hence

x(t) = u dv. (2.35)

We integrate using the integration by parts rule, which is given by



When integrating by parts, care should be taken when deciding which term becomes u and which becomes v. The rule to follow is that u should reduce to a constant and repeated differentiation, and dv reduces to a standard integral (Bird and May, 1981).

Example 2.4

(c)

 2

(8t + 12)dt =

 1

(4t + 6)dt.

Since the above integral is not in standard form, we make an algebraic substitution, whereby

1 4t sin 2t dt contains a product of two functions. Therefore, we use integration by parts, in this case being 3

14t sin 2t dt = 3

2.4.3 Calculus and linear systems

Calculus is widely used in science and engineering, so it is important to be comfortable about using it. For instance, differentiation is used when we wish to calculate rates of change. If you differentiate a function that describes displacement over time, then you obtain a velocity curve. If in turn you differentiate this, then you get an acceleration curve. Differentiation is also used for locating maximum and minimum points of a continuous function. In contrast, integration is applied when we want to find the area under a curve or the volume of a function rotated about an axis between certain limits (hence our discussions earlier about definite and indefinite integrals).

All this may seem a bit general and tangential to what we are dealing with. What about its role with linear systems? Here, differentiation is manifest most significantly through the differential equation, which is the fundamental way of describing how linear systems behave. Integration appears in many guises, for example, in the form of

the convolution integral, which encapsulates how a linear system generates an output signal by modifying an input signal with its impulse response. Integration also lies at the heart of the Fourier transform, which essentially takes a signal and correlates it with a set of sinusoids of ascending frequency.