Drag & Drop elements for the Sidebar here
One thing that my math teachers always said: "You can't take the logarithm of a negative number". Well it turns out that you can, but the answer is complex, in every sense of the word. I’m going to assume you already know a bit about complex numbers and logarithms.
In order to take the log of a complex number, we must re-write the number in it's polar form. However this form is not unique. In particular, the parameter 'n' can be any integer value, and we still get a valid result. Furthermore, the result of the log function is dependent on which value of 'n' we choose. This means that the log function is multivalued. In fact an infinite number of complex values could satisfy the log function.
Ideally, we would like to work with a single valued function. This allows us to create mappings from the plane to itself, to see how the function warps the geometry. To do this with a function like log, we must introduce a branch cut. A branch cut is a discontinuity in the function which separates one leaf of the function from another. That discontinuity is important, which we will get to later.
If that sounds strange, try to imagine a corkscrew. Every time the corkscrew makes one revolution, it overlaps itself. However, our function can't have overlapping regions, as overlapping regions correspond to multiple values. Thus we must make a cut after one full revolution, only considering the output values of a single revolution. Where exactly one revolution starts and ends is somewhat arbitrary.
You may be more familiar with the square root function. Every square root has two values, one positive and one negative. Typically though, we only consider the positive value when taking square roots, and this can be thought of as the principle value. The complex logarithm also has a principle value. It is the leaf of the log function that contains the real valued outputs, and has the branch cut along the negative real axis.
So that's it then? We have a single valued version of the complex logarithm? Not so fast. Although there are good reasons to use the principle branch cut, we could have placed the branch cut on the positive imaginary axis, on one of the diagonal lines, or any ray emanating from the origin. See (Image 1) for various possible branch cuts.
As you can see from the complex maps, the branch cuts are clearly visible. One side of the branch cut looks radically different from the other. The colors in the image do not blend smoothly. Apart from aesthetic concerns, this also has implications for things like complex analysis and path integrals. In particular, this makes it difficult to answer our original question: What is the logarithm of a negative number? If we were to use the principle value, our answer would fall right on the branch cut!
So what branch cut you use depends a lot on your application. However we've only been considering the natural logarithm. Things get completed fast when we start to consider other multivalued functions. The generalized logarithm has two branch cuts, via the change of base formula. This can lead to weird things like negative base logarithms, or log base one. The inverse trigonometric functions, arc-sine, arc-tangent, and so on, also have multiple values and are often defined in terms of logarithms and square roots.
For the most part, you are better off using the principle value of such multivalued functions. While your teacher may be incorrect in saying you can't take the log of a negative number, in most all cases you probably shouldn’t. For those who are curious, however, experimenting with branch cuts can lead to some beautiful, if counter-intuitive, results. Just be sure, if you follow that path, not to go mad, and don't try any of this stuff on a math test if the teacher says not to.