# Ask Uncle Colin: A Strange Error

Dear Uncle Colin,

If $(-2)^3 = -8$, why doesn’t $\log_{-2}(-8) = 3$?

Exponential Rules: Rubbish Or Reasonable?

Hi, ERROR, and thanks for your message! As is so often the case, there are two (or possibly three) answers to this.

### A problem of definition

The way logarithms are usually ((by usually, I mean ‘in my head’ - other places of definition are available)) defined as $\log_{a}(x) = \frac{\ln(x)}{\ln(a)}$.

For this to work, it requires $\ln(a)$ to be defined (so $a$ has to be positive) - and non-zero (so $a$ can’t be 1).

That’s probably why your calculator complains.

### In the real numbers

The trouble with negative-based logarithms is that something like $f(x) = (-2)^x$ isn’t a very well-behaved function for real values of $x$: it only takes on real values when $x$ is an integer.

It’s possible to construct an inverse function for $f(x)$ all the same, but it’s only defined for exact powers of -2, and isn’t exactly all that useful - it has much the same behaviour from $\log_2(x)$ with signs alternating.

### In the complex numbers

If you want things to get *really* messy, you can think about logarithms in the complex numbers.

Even there, the answer isn’t quite 3. This is because, in the complex numbers, logarithm functions aren’t single-valued - as a result of Euler’s identity, $e^{i\pi} = -1$. This means that $\ln(-8)$, for example, would give all of the complex numbers $z$ such that $e^z = -8$ - which would be $z=3\ln(2) \pm (2n+1)\pi$, where $n$ is an integer.

Similarly, $\ln(-2)$ is $\ln(2) \pm (2m+1) \pi$, where $m$ is an integer.

That means that $\log_{-2}(-8)$, in the complex numbers, is $\frac{3 \ln(2) \pm (2n+1)\pi}{\ln(2) \pm (2m+1) \pi}$. In the very specific case where $n=1$ and $m=0$, this does work out to three! But there are infinitely many other answers, too.

Hope that helps!

- Uncle Colin

* Edited 2020-01-22 to fix a typo. Thanks, Rob!