Complex Numbers

From PrattWiki
Revision as of 00:27, 13 February 2009 by DukeEgr93 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

In the field of Mathematics, people had to come up with some satisfactory way to deal with the problems that arose when one tried to take the square root of a negative number. Not happy with simply saying ``there isn't one, the mathematicians came up with an object known as a {\bf complex number}. The usefulness of this construct blossomed as engineers and physicists saw applications for what the theorists had developed. The idea is that a number {\bf n} can be made up of two parts: a real part ($\Re\cof{n}$) and an imaginary part ($\Im\cof{n}$). These parts can be plotted - much like $x$ and $y$ coordinates - in what is called the {\it complex plane}.

There are many ways to represent a complex number. Of these, three stand out as being particularly useful. The first is the standard or {\it rectangular} representation: \begin{align*} {\bf n} = \Re\cof{n} + j\Im\cof{n}=n_r + jn_i \end{align*} where $j$ is $\sqrt{-1}$. This gives all the information you need to figure out the number. Now imagine that this is a point plotted in 2D space where the real part is the $x$ coordinate and the imaginary part is the $y$ coordinate. You could figure out a magnitude and direction from the origin to this point and write the location in {\it polar coordinates}. The magnitude and direction would be given by: \begin{align*} \mbox{magnitude}({\bf n})=|{\bf n}|=n&=\sqrt{\left(\Re\cof{n}\right)^2 +\left(\Im\cof{n}\right)^2}=\sqrt{n_r^2+n_i^2}\\ \mbox{direction}({\bf n})=\angle{\bf n}=\theta_n&= \arctan(\Im\cof{n}, \Re\cof{n})=\arctan(n_i, n_r) \end{align*} where arctan with two arguments specifies that the answer will be some angle between $-\pi$ and $\pi$ instead of the typical limits of $-\pi/2$ to $\pi/2$. This distinction is important because the two-argument version of arctan will give the proper angle between the positive real axis and the complex number. Calculators usually only have the one-argument version. In this case, you will use the ratio $n_i/n_r$ as your argument, but must make sure your answer is in the proper quadrant.

Using the above, a complex number {\bf n} can be represented: \begin{align*} {\bf n}&=n\angle\theta_n \end{align*}

At this point, you should notice that $n$ is the hypotenuse of a right triangle with an angle of $\theta_n$ with respect to the horizontal. This means the real and imaginary parts can be written as: \begin{align*} \Re\cof{n}&=n_r=n\cos\left(\theta_n\right) & \Im\cof{n}&=n_i=n\sin\left(\theta_n\right) \end{align*} and {\bf n} can be written as: \begin{align*} {\bf n}&=n\cos\left(\theta_n\right)+jn\sin\left(\theta_n\right)= n\left(\cos\left(\theta_n\right)+j\sin\left(\theta_n\right)\right) \end{align*} \pagebreak

\section{Euler Notation} In representing complex numbers, you should note the following Maclaurin Series for $\cos(\theta)$ and $\sin(\theta)$: \begin{align*} \cos(\theta)= \frac{\theta^0}{0!}-\frac{\theta^2}{2!}+\frac{\theta^4}{4!}-...&= \sum_{n=0,~n\mbox{ even}}^{\infty}\frac{(-1)^{n/2}\theta^n}{n!}\\ \sin(\theta)= \frac{\theta^1}{1!}-\frac{\theta^3}{3!}+\frac{\theta^5}{5!}-...&= \sum_{n=0,~n\mbox{ odd}}^{\infty}\frac{(-1)^{(n-1)/2}\theta^n}{n!} \end{align*} Now for some algebraic manipulation. First, note that the $(-1)^{n/2}$ term in the $\cos$ series can be rewritten using the fact that $(-1)^{1/2}=j$: \begin{align*} (-1)^{n/2} = ((-1)^{1/2})^n = (j)^n \end{align*} Next, in the $\sin$ series, the $(-1)^{(n-1)/2}$ term can be split up, noting that: \begin{align*} (-1)^{(n-1)/2}&=(-1)^{-1/2}(-1)^{n/2} \end{align*} and from above, rewritten as \begin{align*} (-1)^{-1/2}(-1)^{n/2}&= (-1)(-1)^{1/2}(-1)^{n/2}= -j~(j)^n \end{align*} which means the two Maclaurin Series can be written as: \begin{align*} \cos(\theta)&= \sum_{n=0,~n\mbox{ even}}^{\infty}\frac{(j\theta)^n}{n!}\\ \sin(\theta)&= -j\sum_{n=0,~n\mbox{ odd}}^{\infty}\frac{(j\theta)^n}{n!} \end{align*} In the latter case, multiplying both sides by $j$ and recognizing that $-j^2=1$, we obtain: \begin{align*} j\sin(\theta)&= \sum_{n=0,~n\mbox{ odd}}^{\infty}\frac{(j\theta)^n}{n!} \end{align*} What Euler noticed was the following - one representation of $e^x$ is a Maclaurin series of: \begin{align*} e^x=\frac{x^0}{0!} + \frac{x^1}{1!} + \frac{x^2}{2!} + ... &= \sum_{n=0}^{\infty}\frac{x^n}{n!} \end{align*} Simply substituting $x=j\theta$ yields \begin{align*} e^{j\theta}=\frac{(j\theta)^0}{0!} + \frac{(j\theta)^1}{1!} + \frac{(j\theta)^2}{2!} + ... &= \sum_{n=0}^{\infty}\frac{(j\theta)^n}{n!} \end{align*} which is the sum of the Maclaurin Series for $\cos(\theta)$ and $j\sin(\theta)$. In other words, \begin{align*} e^{j\theta} = \cos(\theta) + j\sin(\theta) \end{align*} Using this, you can write a complex number as: \begin{align*} {\bf n}&=n(\cos(\theta)+j\sin(\theta))=ne^{j\theta_n} \end{align*} This gives rise to one of ``The Greatest Equations Ever (at least according to {\bf physicsweb}\footnote{http://physicsweb.org/articles/world/17/10/2, accessed October

 12, 2006}):

\begin{align*} e^{j\pi}+1&=0 \end{align*} which combines an infinite sum ($e$), the imaginary number ($j$), an irrational ratio (the ever mysterious $\pi$), and unity (1) and, through an equality (=), relates them all to...nothing (0). \pagebreak

%%%%%%%%%%%%%%%%%%%%%%%% \section{Addition and Subtraction} Addition and subtraction are performed component-wise and are done most easily by using the rectangular representation. Assume you have two complex numbers: \begin{align*} {\bf n}=a+jb&=ne^{j\theta_n} & {\bf m}=c+jd&=me^{j\theta_m} \end{align*} and you want to add or subtract them. Adding or subtracting the components and then collecting the real parts and the imaginary parts gives: \begin{align*} {\bf n} + {\bf m} &= (a+c) + j(b+d)& {\bf n} - {\bf m} &= (a-c) + j(b-d) \end{align*}

%%%%%%%%%%%%%%%%%%%%%%%%%% \section{Multiplication and Division} Multiplication and division are a little more difficult. The best notation to use is the Euler one. To multiply the two numbers given in the section above: \begin{align*} {\bf o}&={\bf n} {\bf m}=ne^{j\theta_n}~me^{j\theta_m}\\ {\bf o}&=nme^{j(\theta_n+\theta_m)}= oe^{j\theta_o} \end{align*} You can then get the rectangular representation of this by converting from the Euler representation writing: \begin{align*} {\bf o}&=nm\cos\left(\theta_n+\theta_m\right)+jnm\sin\left(\theta_n+\theta_m\right) \end{align*} Another way to do multiplication is by using the rectangular representation and FOILing: \begin{align*} {\bf o}&={\bf n} {\bf m}=(a+jb)(c+jd)\\ {\bf o}&=ac+jad+jbc+j^2bd\\ {\bf o}&=(ac-bd)+j(ad+bc)=\Re\cof{o}+j\Im\cof{o} \end{align*}

Division is easiest using the Euler representation: \begin{align*} {\bf p}&=\frac[[:Template:\bf n]][[:Template:\bf m]]= \frac{ne^{j\theta_n}}{me^{j\theta_m}}\\ {\bf p}&= \frac{n}{m}e^{j(\theta_n-\theta_m)}=pe^{j\theta_p} \end{align*}

Division using the rectangular representation is a little more difficult. You have to use the {\it complex conjugate} of the denominator to get rid of any $j$'s on the bottom. The complex conjugate of a number is the number with the sign on its imaginary part switched. It is also the number with the sign on its angle switched. The complex conjugate is represented by a superscript $*$. For example, ${\bf n}^*$ is: \begin{align*} {\bf n}^*=a-jb&=n\angle-\theta_n=ne^{-j\theta_n} \end{align*} Note that a number multiplied by its own complex conjugate will give the magnitude of that number squared. The following shows this using all three notations: \begin{align*} {\bf n}{\bf n}^*&=(a+jb)(a-jb)=a^2+b^2=n^2\\ {\bf n}{\bf n}^*&=(n\angle\theta_n)(n\angle-\theta_n)=n^2\angle 0=n^2\\ {\bf n}{\bf n}^*&= \left(ne^{j\theta_n}\right)\left(ne^{-j\theta_n}\right)= n^2e^{j0}=n^2 \end{align*}

Division thus proceeds as follows: \begin{align*} {\bf p}=\frac[[:Template:\bf n]][[:Template:\bf m]]&= \frac[[:Template:\bf n]][[:Template:\bf m]] \frac{{\bf m}^*}{{\bf m}^*}= \frac{a+jb}{c+jd}\frac{c-jd}{c-jd} = \frac{(ac+bd)+j(-ad+bc)}{c^2+d^2}= \frac{ac+bd}{c^2+d^2}+j\frac{-ad+bc}{c^2+d^2}= \Re\cof{p}+j\Im\cof{p} \end{align*}

%%%%%%%%%%%%%%%%%%%%%%%% \section{Elongation / Contraction} Sometimes, you will only need to change the magnitude of a complex number. This is the same as only changing the {\it length} and not the {\it direction} of a vector. Multiplication by a {\it scalar} only changes the magnitude. A {\it scalar} is not a complex number because it does not have an angle associated with it. The complex equivalent of a scalar is a number having an angle of 0 radians. Multiplication by a scalar is simple. Assume that $s$ is a scalar, \begin{align*} {\bf t}=s{\bf n}=sa+jsb=sn\angle\theta_n= sne^{j\theta_n} \end{align*}

%%%%%%%%%%%%%%%%%%%%%%%% \section{Rotation} You may also simply want to rotate a complex number around the origin. For example, once you find the first $r$th root of a number you really only need to rotate it around $\frac{2\pi}{r}$ to get the next root. This is done by multiplying by a complex number of unit magnitude with some angle. Assume you want to rotate {\bf n} by an angle $\theta_i$ radians counterclockwise around the origin: \begin{align*} {\bf u}=\left(1\angle\theta_i\right) \left(n\angle\theta_n\right)= ne^{j\theta_i}e^{j\theta_n}=ne^{\left(j\theta_i+\theta_n\right)}= ue^{j\theta_u} \end{align*} You can also multiply by the rectangular representation of the angle \begin{align*} e^{j\theta_i}&=\cos\left(\theta_i\right)+j\sin\left(\theta_i\right)\\ {\bf u}&=\left(\cos\left(\theta_i\right)+j\sin\left(\theta_i\right)\right) \left(a+jb\right)\\ {\bf u}&=\left(a\cos\left(\theta_i\right)-b\sin\left(\theta_i\right)\right) +j\left(b\cos\left(\theta_i\right)+a\sin\left(\theta_i\right)\right)= \Re\cof{u}+j\Im\cof{u} \end{align*}

From this, you should recognize that multiplication by $j$, which is also $1\angle90^{\circ}$, is the same as a counterclockwise rotation of $90^{\circ}$

%%%%%%%%%%%%%%%%%%%% \section{Integer Powers} Integer powers of complex numbers are best taken using Euler notation: \begin{align*} {\bf v}&={\bf n}^p=\left(ne^{j\theta_n}\right)^p=n^pe^{jp\theta_n} \end{align*} This represents both a change in length (from $n$ to $n^{p}$) and a change in direction (from $\theta_n$ to $p\theta_n$).

\subsection{Integer Roots} Roots of complex numbers are also best taken using Euler notation. To take the $r$th root of a number: \begin{align*} {\bf n}^{\frac{1}{r}}=\left(ne^{j\theta_n}\right)^{\frac{1}{r}}= n^{\frac{1}{r}}e^{j\frac{\theta_n}{r}} \end{align*}

In other words, the {\it magnitude} of the root is equal to the root of the original magnitude, and the {\it direction} of the root is equal to the direction of the original number divided by whatever root you are taking. This is the {\it primary} root.

Note that using the Euler notation, any number can be represented in an infinite number of ways simply by adding multiples of $2\pi$ to the angle. This is the same as going around a complete circle and ending up where you started. In the above root: \begin{align*} {\bf n}^{\frac{1}{r}}=\left(ne^{j\theta_n+j2\pi}\right)^{\frac{1}{r}} =n^{\frac{1}{r}}e^{\frac{j\theta_n}{r}+j\frac{2\pi}{r}} \end{align*} This gives another, equally valid root of the number. In fact, any number other than {\bf 0} has $r$ $r$th roots. These roots will be evenly divided across the full range of $2\pi$. They will all have the same magnitude. You can draw a circle with a radius of the $r$th root of $n$ and it will pass through all $r$ roots of {\bf n}.

\subsection{Example 1} Find all the cube roots of $1+j0$. Since the magnitude of this number is 1 and the direction is 0, the first cube root has a magnitude of $1^{\frac{1}{3}}=1$ and a direction of $0/3=0$. Since the roots are equally spaced, they will be $\frac{2\pi}{3}$ apart, meaning: \begin{align*} \left(1+j0\right)^{\frac{1}{3}} &=1e^{j0}=\cos 0 + j\sin 0 = 1\\ \left(1+j0\right)^{\frac{1}{3}} &=1e^{j\frac{2}{3}\pi}= \cos \frac{2}{3}\pi+j\sin \frac{2}{3}\pi= -0.5+j0.866\\ \left(1+j0\right)^{\frac{1}{3}} &=1e^{j\frac{4}{3}\pi}= \cos \frac{4}{3}\pi+j\sin \frac{4}{3}\pi= -0.5-j0.886 \end{align*}

%%%%%%%%%%%%%%%%%%% \subsection{Example 2} Find all the fifth roots of ${\bf n}=8-j6$. First, find the magnitude and direction: \begin{align*} n = \sqrt{8^2+6^2}&=10\\ \theta_n=\arctan(-6,8)&=-0.64350~\mbox{rad} \end{align*} The magnitude and direction of the primary root ${\bf q_1} $ will therefore be: \begin{align*} q_1 = (10)^{\frac{1}{5}} &= 1.585 & \theta_{q_1}&=\frac{-0.64350~\mbox{rad}}{5} = -0.1287~\mbox{rad} \end{align*} In its rectangular representation, this is: \begin{align*} {\bf q_1} = 1.585\cos\left(-0.1287~\mbox{rad}\right)+ j1.585\sin\left(-0.1287~\mbox{rad}\right)= 1.572-j0.203 \end{align*} The next four roots will be evenly spaced around the complex plane, so they will be $\frac{2\pi}{5}$ apart and have directions of: \begin{align*} \theta_{q_2}&=\theta_{q_1}+1*\frac{2\pi}{5}=1.128~\mbox{rad} & \theta_{q_3}&=\theta_{q_1}+2*\frac{2\pi}{5}=2.385~\mbox{rad}\\ \theta_{q_4}&=\theta_{q_1}+3*\frac{2\pi}{5}=3.641~\mbox{rad} & \theta_{q_5}&=\theta_{q_1}+4*\frac{2\pi}{5}=4.898~\mbox{rad} \end{align*} By converting from Euler to rectangular notation, you can find: \begin{align*} {\bf q_2}&=0.679+j1.432 & {\bf q_3}&=-1.152+j1.088& {\bf q_4}&=-1.391-j0.759& {\bf q_5}&=0.292-j1.558 \end{align*} These are shown in Figure 1. \begin{figure}[tbh] \begin{center} \epsfig{file=/afs/acpub/users/m/r/mrg/MANUALS/GENERAL/MATH/ComplexPlots.eps, width=2.2in, height=2.2in} \caption{Fifth roots} \end{center} \end{figure}

%%%%%%%%%%%%%%%%%%%%%%% \section{Non-integer Powers} Non-integer powers and roots are more complicated. If you are only looking for the {\it primary} power for any arbitrary scalar a then you can simply calculate: \begin{align*} {\bf q_p}=\left({\bf n}\right)^a=\left(ne^{j\theta_n}\right)^a =n^ae^{ja\theta_n} \end{align*}

For rational powers (powers that can be represented by a fraction), you can first raise the complex number to the numerator and then take roots from the denominator. That is: \begin{align*} {\bf q_r}={\bf n}^{\left(\frac{t}{b}\right)}= \left(\left(ne^{j\theta_n}\right)^{t}\right)^{\frac{1}{b}}= \left(n^{t}e^{jt\theta_n}\right)^{\frac{1}{b}} \end{align*}

\begin{comment} %%%%%%%%%%%%%%%%%%%%%% \section{Calculator Functions} The HP48 series of calculators - among others - has some helpful built-in functions for dealing with complex numbers. This tutorial is written specifically for the HP48, though if you have a different calculator you will be required to learn the equivalent functions. First, your calculator is initially set to rectangular mode. That means it will use that notation for complex numbers. To see this, take the square root of -1. You should get: \begin{verbatim} 1: (0,1) \end{verbatim} which shows you that, for complex numbers, the HP will return a value $a+jb$ as \begin{verbatim} 1: (a,b) \end{verbatim} Note that the representations of $a$ and $b$ may be different depending on what {\tt MODES} you have set.

To enter a rectangular representation of a complex number, use the parenthesis command (left shift (orange) on the divide ($\div$) button). This will bring up a pair of () and stay in insertion mode. Type the real part of the number, a comma (shift left (orange) on the decimal (.) button), the imaginary part, and {\tt ENTER}. To enter a polar representation of a complex number, follow the same steps until just after the comma. To tell the HP you will be entering an angle, enter the angle character (right (blue) shift on the {\tt SPC} button). The $\angle$ symbol will come up and you can enter your angle. See below about radians versus degrees. Note that regardless of how you {\it enter} your complex number, the HP will display it in the current display mode.

The calculator can automatically convert rectangular notation to polar for you. On the HP, hit the {\tt MTH} button. The fifth sub-menu is {\tt VECTR}. Hit its button (the {\tt E}). The three toggles on the left indicate how the calculator is representing coordinates in 3D space. {\tt XYZ} is Cartesian (the 3D version of rectangular), {\tt R$\angle$Z} is cylindrical (a 3D extension of polar), and {\tt R$\angle\angle$} is spherical (another 3D extension of polar). Cylindrical and spherical modes will both cause complex numbers to be shown in polar notation. To see this, hit the buttons under the {\tt R$\angle$Z} toggle. The dot should now be next to that toggle, the cylindrical coordinates indicator should come on near the top-left of the screen, and the display should now read \begin{center} 1: (1,'"`UNIQ-MathJax1-QINU`"'1.57079632679) \end{center} or \begin{center} 1: (1,'"`UNIQ-MathJax2-QINU`"'90) \end{center}

This ambiguity brings up another important setting. You need to make sure if you are in {\tt RAD} mode that all your angles are in radians and if you are in {\tt DEG} mode that your angles are in degrees of arc. There is a third mode, {\tt GRAD}, which measures 100 gradians per quadrant. You will not use this setting often (if at all).

To change angular representations, hit the left-shift (orange) and then the {\tt CST}. This will bring up the {\tt MODES} menu. The first four entries refer to the numerical representation. They are listed in Table \ref{tab:nrm}. Note that the calculator will never show more than 12 digits, though it keeps track of up to 15 significant digits. Modes with arguments take the bottom number off the stack when entered. \begin{table} \begin{center} \begin{tabular}{|c|l|l|}\hline {\bf Mode} & {\bf Name} & {\bf Description}\\ \hline {\tt STD} & standard & display only significant digits (up to 12)\\ \hline {\tt FIX} & fixed & display a fixed number of digits after the decimal point (up to 11)\\ & &{\tt FIX} takes an argument\\ & &\\ & &If the number is too small for the most significant digit to show up\\ & &or greater than or equal to $10^{12}$ then {\tt FIX} defaults to {\tt SCI} \\ \hline {\tt SCI} & scientific & display numbers in scientific notation with a fixed precision (up to 12)\\ & &{\tt SCI} takes an argument\\ \hline {\tt ENG} & engineering & display numbers in engineering notation with a fixed precision (up to 12)\\ & &{\tt ENG} takes an argument\\ \hline \end{tabular} \end{center} \caption{Numerical Representation Modes for HP48\label{tab:nrm}} \end{table}

For now, set your calculator in {\tt ENG} mode with 12 digit precision. Engineering mode is like scientific mode except the powers of 10 are always integer multiples of 3. This is very convenient for representing values corresponding to SI units. Now hit the {\tt NXT} button twice. There are six toggles at the bottom. The right three are the same as the three in the {\tt VECTR} menu for representing 3D coordinates. Set your calculator to {\tt R$\angle$Z} mode.

The left three tell whether the calculator is in degree, radian, or gradian mode (respectively). To switch between the different notations, just hit the button corresponding to that toggle. All entries on the screen will change representations. You will want to have these toggles active most of the time while performing calculations with complex numbers. Set your calculator to {\tt DEG} mode.

There are also keyboard shortcuts to switch between radians and degrees and to switch between polar and rectangular coordinates. The 1 button has two switches on it. The left (orange) switch toggles between {\tt RAD} mode and {\tt DEG} mode. The indicator at the top left of the screen will tell you if you are in {\tt RAD} mode or not. Hit the left shift (orange) button then 1. The angle on your complex number will change from degrees to radians. Also, the {\tt RAD} indicator will come on.

The right (blue) switch on the 1 button will switch between polar and rectangular notation. The indicator near the top left of the screen will tell you if you are in {\tt R$\angle$Z} (cylindrical) mode or not. Hit the right (blue) shift button then 1. The representation of your complex number will change from polar to rectangular. Also, the {\tt R$\angle$Z} indicator will turn off. \end{comment}

%%%%%%%%%%% \section{Parting Thoughts} Decide early on a notation you like for complex numbers. Some possibilities are: \begin{align*} {\bf n} && \tilde{n} && \mbox{\Bbb{n}} && \uline{n} \end{align*} For example, using complex variables to give Ohm's Law might look like: \begin{align*} \Bb{Z}&=\frac{\Bb{V}}{\Bb{I}} \end{align*}

Make sure you know how your angles are represented (degrees or radians). If someone asks you ``What is the cosine of 45, you need to start getting the the habit of asking ``radians or degrees? even though it may seem obvious. Also, if someone says ``the frequency is ten, you need to always ask ``in Hertz or radians per second?

Complex numbers are at the heart of many powerful tools in engineering. You need to be comfortable with how complex numbers work and what they represent in order to truly understand how those tools work and to fully comprehend their usefulness. Complex numbers are not that difficult once you have practiced with them a little bit, and the time spent learning about them will pay great dividends in the future.