# Calculators and complex numbers (Part 20)

In this series of posts, I explore properties of complex numbers that explain some surprising answers to exponential and logarithmic problems using a calculator (see video at the bottom of this post). These posts form the basis for a sequence of lectures given to my future secondary teachers.

To begin, we recall that the trigonometric form of a complex number $z = a+bi$ is

$z = r(\cos \theta + i \sin \theta) = r e^{i \theta}$

where $r = |z| = \sqrt{a^2 + b^2}$ and $\tan \theta = b/a$, with $\theta$ in the appropriate quadrant. As noted before, this is analogous to converting from rectangular coordinates to polar coordinates.

Over the past few posts, we developed the following theorem for computing $e^z$ in the case that $z$ is a complex number.

Theorem. If $z = x + i y$, where $x$ and $y$ are real numbers, then

$e^z = e^x (\cos y + i \sin y)$

As a consequence, there are infinitely many complex solutions of the equation

$e^z = -2 - 2i$,

namely, $z = \ln 2\sqrt{2} - \displaystyle \frac{3\pi}{4} + 2 \pi n i$.

Choosing the solution that has an imaginary part in the interval $(-\pi,\pi]$ leads to the definition of the complex logarithm.

Definition. Let $z = r e^{i \theta}$ be a complex number so that $-\pi < \theta \le \theta$. Then we define

$\log z = \ln r + i \theta$.

Of course, this looks like what the definition ought to be if one formally applies the Laws of Logarithms to $r e^{i \theta}$. So, for example,

$\log (-2-2i) = \ln 2\sqrt{2} - \displaystyle \frac{3\pi}{4}$

A technicality: this is the principal value of the complex logarithm. In complex analysis, this is technically thought of as a multiply-defined function.

The complex version of the natural logarithm function matches the ordinary definition when applied to real numbers. For example,

$\log 6 = \log \left( 6 e^{0i} \right) = \ln 6 + 0 i = \ln 6$.

A couple of observations. In high school, the symbol $\log$ is usually dedicated to base 10. However, in higher-level mathematics courses, $\log$ always means natural logarithm. That’s because, for the purposes of abstract mathematics, base-10 logarithms are practically useless. They are helpful for us people since our number system uses base 10; it’s easy for me to estimate $\log_{10} 9000$, but $\ln 9000$ requires a little more thought. But nearly all major theorems that involve logarithms specifically employ natural logarithms. Indeed, when I first become a professor, I had to remind myself that my students used $\ln$ for natural logarithms and not $\log$. Still, I write $\log_{10}$ for base-10 logarithms and not $\log$ as a silent acknowledgment of the use of the symbol in higher-level courses.

This use of the logarithm explains the final results of the calculator in the video below. When $\ln(-5)$ is entered, it assumes that a real answer is expected, and so the calculatore returns an error message. On the other hand, when $\ln(-5+0i)$ is entered, it assumes that the user wants the principal complex logarithm. Since $-5+0i = 5 e^{i \pi}$, the calculator correctly returns $\ln 5 + \pi i$ as the answer. (Of course, the calculator still uses $\ln$ and not $\log$ to mean natural logarithm.)

For completeness, here’s the movie that I use to engage my students when I begin this sequence of lectures.