# 2.1: Review of Complex Numbers and Arithmetic

- Page ID
- 7628

We will find many uses in system dynamics for analysis with complex numbers and variables. It is instructive first to imagine how complex numbers might have been developed historically. It seems likely that they appeared first in solutions for roots of polynomial equations. To see how, let us examine the 2^{nd} degree polynomial, the standard quadratic equation, and its solutions. The quadratic equation is

\[a z^{2}+b z+c=0\label{eqn:2.1}\]

where \(z\) is the unknown and \(a\), \(b\), and \(c\) are known constants. The standard solution for roots \(z\) is

\[z=-\frac{b}{2 a} \pm \frac{1}{2 a} \sqrt{b^{2}-4 a c}\label{eqn:2.2}\]

Provided that \(b^{2}-4 a c \geq 0\), the solution via Equation \(\ref{eqn:2.2}\) can be calculated easily. But suppose the constants have values such that \(b^{2}-4 a c<0\), so that Equation \(\ref{eqn:2.2}\) indicates the square root of a negative number. That must have seemed strange to early mathematicians. Nevertheless, Equation \(\ref{eqn:2.2}\) is the correct solution **regardless** of the sign of \(b^{2}-4 a c\), which you can verify simply by substituting Equation \(\ref{eqn:2.2}\) back into Equation \(\ref{eqn:2.1}\). So it was necessary to recognize the existence of the square root of a negative number and to invent notation and terminology for describing such a number.

For \(b^{2}-4 a c<0\), we can write

\[\sqrt{b^{2}-4 a c}=\sqrt{(-1)\left(4 a c-b^{2}\right)}=\sqrt{-1} \times \sqrt{4 a c-b^{2}} \equiv j \sqrt{4 a c-b^{2}}\]

in which we define the *unit imaginary number* as \(j \equiv \sqrt{-1}\). Perhaps early mathematicians used the adjective “imaginary” because such a number seemed unreal to them. With this definition, we can write Equation \(\ref{eqn:2.2}\) in the form

\[z=-\frac{b}{2 a} \pm j \frac{1}{2 a} \sqrt{4 a c-b^{2}}\]

This is called a *complex* number, which is the sum of a normal, or *real* number and an imaginary number (\(j\) times a real number being a general imaginary number).

If \(x\) and \(y\) are reals, then any complex number can be written in the *rectangular* form:

\[z=x+j y, \quad \text{with real part} \quad x \equiv \operatorname{Re}(z), \quad \text{and imaginary part} \quad y \equiv \operatorname{Im}(z)\label{eqn:2.3}\]

This form is called “rectangular” because it expresses the complex number in terms of its rectangular, or Cartesian components, \(x\) and \(y\). Equation \(\ref{eqn:2.3}\) is similar mathematically to a two-dimensional vector **v** expressed in terms of Cartesian components and unit vectors \(\mathbf{1}_{\mathbf{x}}\) and \(\mathbf{1}_{\mathbf{y}}\): \(\mathbf{v}=v_{x} \mathbf{1}_{\mathbf{x}}+v_{y} \mathbf{1}_{\mathbf{y}}\). Therefore, we can represent a complex number \(z=x+j y\) graphically in the Cartesian form similar to that used for two-dimensional vectors, as shown in Figure \(\PageIndex{1}\).

From Figure \(\PageIndex{1}\), we can infer another useful way to represent a complex number. By defining the *magnitude* (*length*, *absolute value*, *modulus*) of \(z\) as the positive number

\[r=\sqrt{x^{2}+y^{2}}\label{eqn:2.4}\]

we can write

\[z=x+j y=r\left(\frac{x}{r}+j \frac{y}{r}\right)=r(\cos \theta+j \sin \theta)\label{eqn:2.5}\]

In Equation \(\ref{eqn:2.5}\), we employ the standard trigonometric functions of angle \(\theta\) originating on the positive real axis and defined positive in the counterclockwise (CCW) sense, Figure \(\PageIndex{1}\). Angle \(\theta\) is often called the *argument* of \(z\). The general definition is

\[\theta=\tan ^{-1}\left(\frac{y}{x}\right)\label{eqn:2.6}\]

It is necessary to recognize Equation \(\ref{eqn:2.6}\) as the *four-quadrant inverse tangent* (or *arctangent*). For example, if \(y\) is positive and \(x\) is negative, then Equation \(\ref{eqn:2.6}\) should give angle \(\theta\) in the second quadrant, \(90^{\circ}<\theta<180^{\circ}\); or, if both \(y\) and \(x\) are negative, then Equation \(\ref{eqn:2.6}\) should give angle \(\theta\) in the 3^{rd} quadrant, \(-180^{\circ}<\theta<-90^{\circ}\) (which also can be written as \(180^{\circ}<\theta<270^{\circ}\)). Unfortunately, the *tan*^{−1} or *arctan* function on hand calculators does **not** calculate the four-quadrant inverse tangent, but only considers the sign of the quotient \(y/x\), and produces a \(\theta\) value in the 1^{st} or 4^{th} quadrants, \(-90^{\circ}<\theta<+90^{\circ}\). So, if you are evaluating Equation \(\ref{eqn:2.6}\) on your hand calculator, **you** need to account for the signs of both y and x, and you need to modify appropriately the answer given by your calculator. If you are evaluating Equation \(\ref{eqn:2.6}\) in MATLAB, then you should use MATLAB’s four-quadrant inverse tangent function, `atan2(y,x)`

.

Equation \(\ref{eqn:2.5}\) is just an intermediate result. To achieve the desired final form, we rewrite Equation \(\ref{eqn:2.5}\) using the well-known Taylor power series expansions for sine, cosine and exponential functions:

\[z=r(\cos \theta+j \sin \theta)=r\left[\left(1-\frac{\theta^{2}}{2 !}+\frac{\theta^{4}}{4 !}-\ldots\right)+j\left(\theta-\frac{\theta^{3}}{3 !}+\frac{\theta^{5}}{5 !}-\ldots\right)\right]\]

\[z=r(\cos \theta+j \sin \theta)=r\left(1+(j \theta)+\frac{(j \theta)^{2}}{2 !}+\frac{(j \theta)^{3}}{3 !}+\frac{(j \theta)^{4}}{4 !}+\frac{(j \theta)^{5}}{5 !}+\ldots\right) \equiv r e^{j \theta}\]

\[z=r e^{j \theta}\label{eqn:2.7}\]

The important result

\[\cos \theta+j \sin \theta=e^{j \theta}\label{eqn:2.8}\]

is known as *Euler’s equation* (after Leonhard Euler, 1707-1783, Swiss mathematician and physicist). See homework Problem 2.1 for other equations closely related to Equation \(\ref{eqn:2.8}\).

A complex number in the form \(z=r e^{j \theta}\) is called the *polar* form because it employs polar coordinates \(r\) and \(\theta\). We can visualize the complex exponential term \(e^{j \theta}\) itself as a clock hand in the complex plane, Figure \(\PageIndex{1}\); the clock hand has unit length, and it is rotated CCW by angle \(\theta\) from the 3 o’clock position. Similarly, the full complex number \(z=r e^{j \theta}\) represents a clock hand of length \(r\) that is rotated CCW by angle \(\theta\) from the 3 o’clock position, so the notation \(z=r \angle \theta\) is often used, where the symbol \(\angle\) stands for “angle.”

We will occasionally need to convert a complex number from rectangular form into polar form using Equations \(\ref{eqn:2.4}\) and \(\ref{eqn:2.6}\). The MATLAB functions `abs`

and `angle`

are especially useful for this task, as is illustrated in Complex-arithmetic Example 2 below.

We also will need to use complex arithmetic, so let’s review (from your mathematics courses) some of the basics, supposing that we have two complex numbers \(z\) and \(w\) expressed in both rectangular and polar forms:

\(z=x+j y=r e^{j \theta}\) and \(w=u+j v=q e^{j \phi}\), where \(x\), \(y\), \(r\), \(\theta\), \(u\), \(v\), \(q\), and \(\phi\) all are real.

**Addition or subtraction, rectangular**: \(z \pm w=(x \pm u)+j(y \pm v)\).

**Addition or subtraction, polar**: \(r e^{j \theta} \pm q e^{j \phi} \equiv Z \equiv R e^{j \Theta}\).

\[Z=r \cos \theta+q \cos \phi \pm j(r \sin \theta+q \sin \phi)\]

\[R=\sqrt{[\operatorname{Re}(Z)]^{2}+[\operatorname{Im}(Z)]^{2}}=\sqrt{r^{2}+q^{2}+2 r q \cos (\theta-\phi)}\]

\[\Theta=\tan ^{-1}[\operatorname{Im}(Z) / \operatorname{Re}(Z)]=\tan ^{-1}[\pm(r \sin \theta+q \sin \phi) /(r \cos \theta+q \cos \phi)]\]

**Multiplication, rectangular**: \(z \times w=x u+j(x v+y u)+j^{2}(y v)=(x u-y v)+j(x v+y u)\).

**Multiplication, polar**: \(z \times w=r q e^{j(\theta+\phi)}\).

The *complex conjugate* of is defined as \(z=x+j y=r e^{j \theta}\) is defined as \(\bar{z}=x-j y=r e^{-j \theta}\), so that the product of a complex number and its conjugate is real, and equal to the square of the magnitude: \(z \bar{z}=x^{2}+j(-x y+y x)-j^{2} y^{2}=x^{2}+y^{2}=r^{2}\), or more easily in polar form, \(z \bar{z}=r e^{j \theta} \times r e^{-j \theta}=r^{2} e^{j(\theta-\theta)}=r^{2}\). Suppose that we have the quotient of two complex numbers \(z\) by \(w\), both in rectangular form, and we wish to cast the result into standard rectangular form; it is common practice first to multiply both denominator and numerator by the conjugate of the denominator, thus forming a real denominator:

**Division, rectangular**: \(\frac{z}{w}=\frac{x+j y}{u+j v}=\frac{(x+j y)(u-j v)}{(u+j v)(u-j v)}=\frac{x u+y v}{u^{2}+v^{2}}+j \frac{-x v+y u}{u^{2}+v^{2}}\)

**Division, polar**, \(\frac{z}{w}=\frac{r}{q} e^{j(\theta-\phi)}\)

Example \(\PageIndex{1}\) Complex-arithmetic

Cast the following complex fraction into standard rectangular form, then convert it into polar form: \[z=\frac{3-j 4}{1+j 2}=\frac{(3-j 4)(1-j 2)}{(1+j 2)(1-j 2)}=\frac{3-8+j(-6-4)}{5}=-1-j 2\]

**Solution**

\[r=\sqrt{(-1)^{2}+(-2)^{2}}=2.236\]

\[\theta=\tan ^{-1}\left(\frac{-2}{-1}\right)=-116.6^{\circ} \times \frac{\pi \mathrm{rad}}{180^{\circ}}=-2.034 \mathrm{rad}\]

\[\Rightarrow \quad z=\frac{3-j 4}{1+j 2}=-1-j 2=2.236 e^{j\left(-116.6^{\circ}\right)} \equiv 2.236 \angle(-2.034 \mathrm{rad})\]

Note that when you take \(\tan^{-1}(2)\) on your hand calculator, it gives 63.43°. Because you are really trying to find \(\tan^{-1}(-2/-1)\), you must recognize that the correct angle is in the 3^{rd} quadrant and, therefore, add +180° or –180° to the calculator’s solution in order to obtain the correct result, +243.4° or –116.6°.

Example \(\PageIndex{2}\) Complex-arithmetic

Cast the following complex fraction into standard rectangular form, then convert it into polar form: \[z=\frac{(3-j 2)(4+j)}{2-j 3}-7+j 4=\frac{(14-j 5)(2+j 3)}{(2-j 3)(2+j 3)}-7+j 4=\frac{43+j 32}{13}-7+j 4\]

**Solution**

\[z=\left(\frac{43}{13}-7\right)+j\left(\frac{32}{13}+4\right)=-3.692+j 6.462\]

\[r=\sqrt{(-3.692)^{2}+(6.462)^{2}}=7.442\]

\[\theta=\tan ^{-1}\left(\frac{6.462}{-3.692}\right)=-60.255^{\circ}+180^{\circ}=119.7^{\circ}\]

\[\Rightarrow \quad z=\frac{(3-j 2)(4+j)}{2-j 3}-7+j 4=-3.692+j 6.462=7.442 e^{j 119.7^{\circ}}\]

A solution of Complex-arithmetic Example 2 in terms of MATLAB operations follows:

`>> z=(3-2j)*(4+j)/(2-3j)-7+4j`

`z = -3.6923 + 6.4615i`

`>> r=abs(z),theta=angle(z)`

`r = 7.4421`

`theta = 2.0899`

`>> thetadeg=theta*180/pi`

`thetadeg = 119.7449`

Note that MATLAB prefers, and gives results in terms of the unit imaginary number denoted as \(i\), but it recognizes our notation of \(j\). Note also that the radian is MATLAB’s default unit for angles: if you want a MATLAB angle result in degrees, you must convert from radians; also, if you wish to calculate a trigonometric function of an angle, you must express that angle in radians.