# Logs of Negative or Complex Numbers

Last time we considered negative bases for logarithms; in that discussion it was mentioned that complex numbers can change everything. This will allow us to do things like finding logs of negative numbers; but it will also make things, well, more complex! Let’s take a look.

## What is the log of -10? Is it complex?

The Log of a Negative Number

Hi,

I ran into a revision problem with logs which wasn't the problem itself, just a gaping hole in my learning. They had given us what turned out to be a log of a quadratic, with a x-3 factor or something. I was checking my answers like the good student I was, but my calculator couldn't do log (-3). I guessed that the answer had to be complex. I consulted my Maths coordinator and he agreed with me and said that (for example), log -10 equaled i. I had a play around at home and devised that x^i = -x (where x is a real number) and a few other rules for complex numbers for powers. Am I right? I tried to look up several maths databases for verification, but they didn't have anything.

I congratulate you all for all the helpful info and hard work you guys put into the site. It's great help.

As we’ll see, the teacher’s guess was wrong, as is Brett’s idea about $$x^i$$. I’d like to see his work! But the question alone is a great one; most of us at this level would be satisfied just to say, as we did last time, that negative numbers are not in the domain of a log.

Hi, Brett!

You're partially right. To start out with, the logarithm of a negative number in base 10 is complex.

I ran into a problem in verifying what your coordinator said, though. Here's what I did, using the math software program Maple V (release 5):

(In the following, I'll use log[a](b) to mean the logarithm with base a of b. For example, log[2](8) = 3, since 2^3 = 8.)

In typing, we also use the notation “log_a(b)” to indicate $$\log_a(b)$$. We want to find $$\log_{10}(-10)$$.

First I used the base-conversion rule of logarithms:

log[a](b) = log[c](b) / log[c](a)

to write:

log[10](-10) = log[e](-10) / log[e](10) = ln(-10) / ln(10)

(I did this because Maple can only work with complex logs when the logarithm base is e.)

The same is likely true for most humans! So far, we have that $$\log_{10}(-10)=\frac{\ln(-10)}{\ln(10)}$$

Next I found the value of ln(-10):

ln(-10) = ln(10 * -1)
= ln(10) + ln(-1)     (Using the sum rule of logs)


This brings us a step closer to something we can calculate: $$\ln(-10)=\ln(10)+\ln(-1)$$

To deal with the ln(-1), I used Euler's Identity:

e^(i*x) = cos(x) + i*sin(x)

In particular, e^(i*pi) = cos(pi) + i*sin(pi) = -1 + i*0 = -1

(I'm not sure how much math you've learned. The Euler identity is something that you can derive using Taylor series, which you learn about in calculus. Also, if you haven't covered trigonometry yet, you'll have to take my word for it that when you're measuring angles in radians (not degrees), cos(pi) = -1 and sin(pi) = 0).

We met this in Euler’s Formula: Complex Numbers as Exponents. We need to turn this exponential expression into its logarithmic form.

Now, since e^(i*pi) = -1, we can write:

-1 = e^(i*pi))
ln(-1) = ln(e^(i*pi))
ln(-1) = i*pi

This is the same idea as saying that $$\log_2(8)=3$$ because $$8=2^3$$.

So, back to our equation:

ln(-10) = ln(10) + ln(-1)
= ln(10) + (i*pi)

which is the numerical answer Maple gives.

We used $$\ln(-1)$$ to find $$\ln(-10$$, and now we use that to find $$\log_{10}(-10)$$:

Now ln(10) is about 2.303, so (going back to our first formula):

log[10](-10) = ln(-10)/ln(10)

ln(10) + pi*i
= ---------------
ln(10)

= 1 + [pi/ln(10)]*i

Now, raising 10 to this power gives -10, but this is not equal to i. So log(-10) is not equal to i.

So the teacher was wrong in saying the answer was merely i. As we’ll see, Doctor Barrus skipped over a couple tricky details, too. The important thing here was to show how to think about such a question.

Using Maple, I calculated 10^i and got -0.668 + 0.744*i (approximately), which, as you can see, is not equal to -10.

So your rule isn't quite correct, but you're right about the logs of negative numbers being complex. Using the steps I used to find out log(-10), you can find out log[a](-a) for any a. You might give it a shot. Good luck!

Let’s take him up on that: $$\log_a(-a)=\frac{\ln(-a)}{\ln(a)}=\frac{\ln(a)+\ln(-1)}{\ln(a)}=\frac{\ln(a)}{\ln(a)}+\frac{\ln(-1)}{\ln(a)}=1+\frac{\pi}{\ln(a)}i$$

Observe that what happened here is that we are able to expand the domain of logarithms when we are willing to expand the range into the complex numbers! What happens when we expand the domain to complex numbers as well?

## Log(s) of a complex number

This 1996 question from Rod will take us into that new territory:

Log of Complex Number

Does the log of a complex number have any meaning?  If so, are there log laws, and what are they?

Yes, to both questions.

Let's begin with complex exponentiation, if you are not already familiar with it.  We define

e^(i*t) = Cos[t] + i*Sin[t]

where t is a real number and i is the imaginary unit.  (Actually, this is not so much a definition as an extension of the exponential function on the reals, and can be "derived" in many ways.)  Thus,

e^(x+i*y) = e^x (Cos[y] + i*Sin[y])
= e^x*Cos[y] + i*e^x*Sin[y]

and we have the formula for the exponential of a general complex number z = x + i*y expressed in Cartesian coordinates.

Let's shorten this to

e^z = w

where z and w are both complex.  Taking the logarithm of both sides,

z = Log[w]

Thus, if we let w = a + i*b, and we solve for x and y in terms of a and b, we will have a formula for the complex logarithm.

So, the complex exponential function is $$e^z=e^{x+iy}=e^x\cos(x)+ie^x\sin(y)=a+bi=w,$$ and the complex (natural) logarithm is the inverse function, where we express z as a function of w. We need, therefore, to solve for x and y as functions of a and b.

(Please note that he is using the convention, common at the level of calculus and above, that “log” refers to the natural logarithm, not the common (base 10) logarithm. I’ll stick with his convention until near the end.)

But note that

a = e^x*Cos[y]                   [eq. 1]
b = e^x*Sin[y]                   [eq. 2]

by equating the real and imaginary parts.  So we solve for x and y.  To solve for x, square equations [1] and [2] and add them together.  Then

a^2 + b^2 = e^(2x)*Cos[y]^2 + e^(2x)*Sin[y]^2
= e^(2x)*(Cos[y]^2 + Sin[y]^2)
= e^(2x)

since Cos[y]^2 + Sin[y]^2 = 1 for all y,

so

2x = Log[a^2 + b^2]
x = (1/2)*Log[a^2 + b^2]
= Log[(a^2 + b^2)^(1/2)]
= Log[Sqrt[a^2 + b^2]] .

We will write Sqrt[a^2 + b^2] more compactly as |w|, which is the *magnitude* of the complex number w, the distance from w = a + i*b to the origin in the complex plane.

This tells us that the real part of the logarithm is just the (real) logarithm of the magnitude of the given complex number. How about the imaginary part?

Now, to solve for y, we divide equation [2] by equation [1], giving

b/a = Sin[y]/Cos[y]
= Tan[y]

so

y = ArcTan[b/a]

So the imaginary part of the logarithm is the angle of the complex number, also called its “argument”.

But we have to be careful of our signs, because if b < 0 and a < 0, then -Pi < y < -Pi/2, which is not evident from the ArcTan expression but is obvious from looking at it geometrically.  ArcTan[b/a] is the angle formed by the line connecting w = a + i*b to the origin; this is called the *argument* of w, or Arg[w].  But say w = 1 + i.  Then Arg[w] = Pi/4, but it can also be Pi/4+2*Pi = 9*Pi/4, or Pi/4-2*Pi = -7*Pi/4.  In fact, we can add any integer multiple of 2*Pi to Arg[w] and still get the same angle.  So, compactly written,

y = Arg[w] + 2*Pi*k, for any integer k.

Here are two possible arguments for $$1+i$$:

The principal argument is in red, a second option in blue.

It’s also worth pointing out that in quadrants 2 and 3, we need to adjust the angle, because those quadrants are outside the range of the arctan function. For example, $$-1+i$$ is in quadrant 2:

Here the arctan would produce the angle in blue, which is negative; we have to add $$\pi$$ to get the angle we want, in red.

Putting this all together, we see that

x = Log[|w|], y = Arg[w] + 2*Pi*k,
z = x + i*y = Log[|w|] + i*(Arg[w] + 2*Pi*k), for any integer k.

But z = Log[w], so

Log[w] = Log[|w|] + i*(Arg[w] + 2*Pi*k), for any integer k.

This is our formula!  But notice that it is a bit strange:  For one complex value w, there are infinitely many logarithms, because we can choose any integer k!  So it is clearly not like the real logarithm.  This arises because the complex exponential is many-to-one, that is, more than one value (in fact, infinitely many) of z will give the same value of e^z.  Thus the inverse, Log[w], should be one-to-many, where one value of w will give infinitely many logarithms.

Once again, here is the formula: $$\log(w)=\log(|w|)+i(\arg(w)+2\pi k),\;\;k\in\mathbb{Z}$$

To illustrate the existence of infinitely many values of the log, consider that both $$e^{1+i}$$ and $$e^{1+(1+2\pi)i}$$ are equal to $$e(\cos(1)+i\sin(1))\approx1.46869+2.28736i$$, because $$\sin(2\pi)=0$$. Therefore, both $$1+i$$ and $$1+(1+2\pi)i$$ are natural logs of that same number.

Now that we've found a formula, the usual algebraic laws apply to it, so no additional laws need to be taken into account.  The only tricky part is the one-to-many aspect of the complex logarithm - simplifications can be made by forcing Arg[w] to be in the interval [-Pi, Pi] and always taking k = 0.  This is called taking the *principal value*, though depending on how you use the complex logarithm, different intervals (like [0, 2*Pi]) and values of k may have to be used.  Notice this is much like taking the principal value of the square root; we usually say Sqrt[4] = 2, not Sqrt[4] = -2, though both are equally valid.

We’ll see  below that just as taking the principle value of the square root, which works nicely for real numbers, causes trouble for complex (or even negative) numbers, the same is true for logarithms. See Squares, Roots, and Negative Numbers.

### Many-to-one functions, multi-valued inverses

This answer got a reply (though it appears that a different person, Dave, answered, at an earlier time!):

So are you saying that there is more than one solution to ln(x^a) where a is complex or that there IS no solution for when a is complex?

Presumably he just means “log(a)”, or “$$e^x=a$$”; as written, there is no equation to solve.

The natural logarithm is not well-defined on the complex plane for the same reason that the exponentiation function is not one to one.

Thus, a = b does not imply ln(a) = ln(b).

Your argument is similar to the following:

4 = 4

Take square roots, and you get

-2 = 2 !

In other words, it is not there are is no square root of 4; there are just too many! And we deal with that by defining a principal root.

Then Doctor Pete responded:

The former is true; that is, the logarithm of a complex number is generally not a unique value, much in the same way that the square root of a positive real number has two possible values, the positive (principal) value and its negative.  This analogy was made by Dr. Ceeks.

That is, just as there are two solutions to $$x^2=4$$, there are multiple solutions to, say, $$e^x=1+i$$. Another analogy would be the inverse sine function; because the sine is not a one-to-one function, we have to choose one of many possible values for the inverse of that function, by restricting the domain. (See Ranges of Inverse Trig Functions.)

Let's illustrate this property further.  We will call a function f an *injection* if a is not equal to b implies f(a) is not equal to f(b).  Such a function is also called "one-to-one."

From this definition then, we see that y = x^2 is not an injection, because if we let a = -1, and b = 1, we have f(a) = f(b) = 1.  Thus it is not one-to-one.  y = x, of course, is an injection.  What about y = x^3?  Is it an injection?  Well, it depends on what domain we are considering.  If we think of y = x^3 as a mapping from the reals to the reals, that is, if we only allow x and y to be real, then yes, it is an injection.  But if we take it as a mapping over the complex numbers, then no, it is not, because 1^3 = (-1/2 + i*Sqrt[3]/2)^3 = 1.  (There's a third complex number whose cube is 1; what is it?)

The inverse of a one-to-one function is a (single-valued) function; otherwise, it is not. Here is the graph of $$f(x)=x^2$$ restricted to non-negative values of x (red), which is one-to-one and has the inverse $$f^{-1}(x)=\sqrt{x}$$ (green):

Here, for comparison, is the graph of $$f(x)=x^2$$ defined for all real numbers (red), which is not one-to-one, whose “inverse” is $$f^{-1}(x)=\pm\sqrt{x}$$ (green):

The result is a one-to-many “function”.

It’s harder to graph when x and y can both be complex numbers, so I won’t attempt to illustrate that in the same way.

So for the question of injectivity to be meaningful, one must specify the domain.  This is also the case for the exponential function, e^x or Exp[x].  Over the reals, e^x is injective.  But in the complex plane, e^x is *not* an injection.  This is because

e^(x + i*y) = e^x (Cos[y] + i*Sin[y]) .

Note that cosine and sine are not injective -- in fact, their periodicity (Sin[x] = Sin[x+2*Pi] = Sin[x+4*Pi] = ...) is immediate proof of this fact. It follows, then, that complex exponentiation is not injective.  In fact, it is a many-to-one mapping, so infinitely many values of z will give the same value of e^z.

In Complex Powers of Complex Numbers, we illustrated how the exponential function wraps the plane around the origin; one result is that multiple points are mapped to the same point, illustrating the many-to-one nature of the exponential function.

Thus, when we consider its inverse, the natural logarithm over the complex numbers, it is not surprising that it should be a one-to-many mapping, where one value of z will result in infinitely many values of Log[z].  In particular,

Log[z] = Log[Abs[z]] + i*(Arg[z]+2*Pi*k), k = ...-2,-1,0,1,2,...

which is a good exercise to show.  (Abs[z] is the magnitude of z, or Sqrt[x^2+y^2] if z = x + i*y.  Arg[z] is the argument of z, or the angle it creates as a vector in the complex plane.)

This formula, of course, is what Doctor Pete derived in the original answer.

I know this is very long-winded, but I hope the background information I've provided here explains why the complex logarithm does funny things (which really aren't so strange in the end).  Again, as Dr. Ceeks explained, your argument is analogous to the one he provided.

## The laws of logs don’t always work!

We’ll close with this 2004 question that reveals an odd implication of all this:

Logs of Complex Numbers

Give an example showing that Log(z1/z2) does not always equal Log(z1)- Log(z2) where z1 and z2 are complex numbers.  Each time I try to plug in different complex numbers, such as z1 = e^i*pi/3 and z2 = e^2i*pi/3, I find that the two calculations are equal.  I can't find a counterexample.

Hi Brittany,

The complex logarithm is an interesting function.  Simpler complex functions are defined everywhere except at certain points called "poles" where they behave like divisions by zero.  But the logarithm has a thing called a "branch" where you have to make a jump.  Because the function f(z) = e^z has the property

f(z + 2*pi*i) = f(z),

there isn't only one inverse (or logarithm).  Well, we pick one of those inverses for the function Log, but it causes there to be a jump.

The property mentioned is exactly the one-to-many property (periodicity) that we just looked at. A full exploration of these ideas would requite a course in Complex Analysis.

Think of it this way.  If you make a 3-D graph with the complex plane on the x-y coordinates and the value of the imaginary part of the logarithm on the z coordinate, then what we really *should* get is a spiral that is flat when you go straight out from the center x = y = 0 but winds upwards as you go counterclockwise around the center, and increases by 2*pi each time around.

It would look like this (a helicoid):

But that's not a function because a function can only have one value, so we limit the domain by just taking one loop.  That means the spiral starts on the negative x axis at z = -pi, does one counterclockwise loop and ends on the same negative x axis but higher, at z = pi.  So there is this break where the complex log jumps by 2*pi along the negative x axis.

Here we are graphing the function $$z=\text{Im}\left(\log(x+iy)\right)=\arg(x+iy)=\arctan\left(\frac{y}{x}\right)$$, showing where $$z=0,1,2$$:

Observe the break along the negative x-axis.

Everywhere else, the log behaves normally; but across the break, it does not:

So in order to make Log (z1/z2) different from Log(z1) - Log(z2), you just have to go over this break.  In other words, find a Log(z1) whose imaginary part is negative near -pi and a Log(z2) whose imaginary part is positive near pi (or vice-verse), and then subtracting them will be on some other part of the logarithm spiral that was cut off in order to make Log a function.

In effect, we want to find a pair of numbers that will force us to go “over the cliff” when we divide them!

Brittany replied:

I tried z1 = e^(i5pi/3) and z2 = e^(i*pi/3) so that Log(z1) = -i*pi/3 and Log(z2) = i*pi/3, and when you subtract these, you get -i2pi/3, which is what I get when I calculate Log(z1/z2).  Am I not looking at the correct z1 and z2?

She chose $$z_1=e^{(5\pi/3)i}=\cos\left(\frac{5\pi}{3}\right)+i\sin\left(\frac{5\pi}{3}\right)\approx0.5-0.866i\\z_2=e^{(\pi/3)i}=\cos\left(\frac{\pi}{3}\right)+i\sin\left(\frac{\pi}{3}\right)\approx0.5+0.866i$$

Using these numbers, $$\frac{z_1}{z_2}=\frac{0.5-0.866i}{0.5+0.866i}=\frac{(0.5-0.866i)(0.5-0.866i)}{(0.5+0.866i)(0.5-0.866i)}=\frac{-0.5-0.866i}{1}=-0.5-0.866i$$

By our formula, the principal log is $$\ln(-0.5-0.866i)=\ln(|-0.5-0.866i|)+i(\arg(-0.5-0.866i))\\=\ln\left(\sqrt{0.5^2+0.866^2}\right)+i\left(\arctan\left(\frac{-0.866}{-0.5}\right)-\pi\right)\\=\ln(1)+i(\arctan(1.732)-\pi)=-2.094i$$ (The subtraction of pi is because it is in the third quadrant, so the angle is not $$\frac{\pi}{3}$$ but $$\frac{\pi}{3}-\pi=-\frac{2\pi}{3}$$, as Brittany pointed out.)

Or, using properties of exponents, $$\ln\left(\frac{z_1}{z_2}\right)=\ln\left(\frac{e^{(5\pi/3)i}}{e^{(\pi/3)i}}\right)\\=\ln\left(e^{(5\pi/3)i-(\pi/3)i}\right)=\ln\left(e^{(4\pi/3)i}\right)\\=\ln\left(e^{(-2\pi/3)i}\right)=\frac{-2\pi}{3}i=-2.094i$$ (Here, I replaced the exponent $$(4\pi/3)i$$ with the coterminal angle $$(-2\pi/3)i$$ to obtain the principal argument.)

Since $$\ln(z_1)=\ln(0.5-0.866i)=\ln(|0.5-0.866i|)+i(\arg(0.5-0.866i))\\=\ln\left(\sqrt{0.5^2+0.866^2}\right)+i\left(\arctan\left(\frac{-0.866}{0.5}\right)\right)\\=\ln(1)+i(\arctan(-1.732))=-1.047i$$ and $$\ln(z_2)=\ln(0.5+0.866i)=\ln(|0.5+0.866i|)+i(\arg(0.5+0.866i))\\=\ln\left(\sqrt{0.5^2+0.866^2}\right)+i\left(\arctan\left(\frac{0.866}{0.5}\right)\right)\\=\ln(1)+i(\arctan(1.732))=1.047i$$ we find that $$\ln(z_1)-\ln(z_2)=-1.047i-1.047i=-2.094i$$

This is $$-\frac{2\pi}{3}$$; no adjustments were needed because $$z_1$$ and $$z_2$$ are in quadrants 1 and 4 respectively, in range of the arctan.

So she’s right; $$\ln(z_1/z_2)=-2.094i=\ln(z_1)-\ln(z_2)$$ for this example.

Hi Brittany,

You need imaginary parts closer to pi and -pi.  Try making

Log(z1) = -i*2*pi/3
Log(z2) = i*2*pi/3

Let’s repeat the process for these numbers:

We take $$z_1=e^{(-2\pi/3)i}=\cos\left(-\frac{2\pi}{3}\right)+i\sin\left(-\frac{2\pi}{3}\right)\approx-0.5-0.866i\\z_2=e^{(2\pi/3)i}=\cos\left(\frac{2\pi}{3}\right)+i\sin\left(\frac{2\pi}{3}\right)\approx-0.5+0.866i$$

Using these numbers, $$\frac{z_1}{z_2}=\frac{-0.5-0.866i}{-0.5+0.866i}=\frac{(-0.5-0.866i)(-0.5-0.866i)}{(-0.5+0.866i)(-0.5-0.866i)}=\frac{-0.5+0.866i}{1}=-0.5+0.866i$$

By our formula, the principal log is $$\ln(-0.5+0.866i)=\ln(|-0.5+0.866i|)+i(\arg(-0.5+0.866i))\\=\ln\left(\sqrt{0.5^2+0.866^2}\right)+i\left(\arctan\left(\frac{0.866}{-0.5}\right)+\pi\right)\\=\ln(1)+i(\arctan(-1.732)+\pi)=2.094i$$ (The addition of pi is because it is in the second quadrant, so the angle is not $$-\frac{\pi}{3}$$ but $$\frac{2\pi}{3}$$.)

Or, using properties of exponents, $$\ln\left(\frac{z_1}{z_2}\right)=\ln\left(\frac{e^{(-2\pi/3)i}}{e^{(2\pi/3)i}}\right)\\=\ln\left(e^{(-2\pi/3)i-(2\pi/3)i}\right)=\ln\left(e^{(-4\pi/3)i}\right)\\=\ln\left(e^{(2\pi/3)i}\right)=\frac{2\pi}{3}i=2.094i$$

Since $$\ln(z_1)=\ln(-0.5-0.866i)=\ln(|-0.5-0.866i|)+i(\arg(-0.5-0.866i))\\=\ln\left(\sqrt{0.5^2+0.866^2}\right)+i\left(\arctan\left(\frac{-0.866}{-0.5}\right)-\pi\right)\\=\ln(1)+i(\arctan(1.732)-\pi)=-2.094i$$ and $$\ln(z_2)=\ln(-0.5+0.866i)=\ln(|-0.5+0.866i|)+i(\arg(-0.5+0.866i))\\=\ln\left(\sqrt{0.5^2+0.866^2}\right)+i\left(\arctan\left(\frac{0.866}{-0.5}\right)+\pi\right)\\=\ln(1)+i(\arctan(-1.732)+\pi)=2.094i$$ we find that $$\ln(z_1)-\ln(z_2)=-2.094i-2.094i=-4.189i$$

This is $$-\frac{4\pi}{3}$$; adjustments were needed because $$z_1$$ and $$z_2$$ are in quadrants 3 and 2 respectively.

So this time; $$\ln(z_1/z_2)=\frac{2\pi}{3}i\ne-\frac{4\pi}{3}i=\ln(z_1)-\ln(z_2)$$. In fact, they differ by $$2\pi$$, “height of the cliff”.

This site uses Akismet to reduce spam. Learn how your comment data is processed.