# Why does the graph of y = ln(x) have an imaginary part?

1. Nov 29, 2011

### rollcast

I was messing around with wolframalpha and tried to make this graph.

http://www.wolframalpha.com/input/?i=plot+y+=+log+x

Now I understand why the blue real part exists and has that shape but I don't understand why it has an imaginary part?

Thanks
AL

2. Nov 29, 2011

### D H

Staff Emeritus
In terms of the real numbers, the natural logarithm function maps positive reals to the reals. Given some negative real number x, there is no real number y such that ey=x (i.e., such that y=log(x).) The natural logarithm can be extended to the complex numbers via Euler's equation ex=cos(x)+i*sin(x). This leads to log(-1)=pi*i (And to a host of other values; natural log is no longer unique.)

3. Nov 29, 2011

### rollcast

Ok, but where does imaginary pi come into it?

I understand that from a bit of messing around that any value to the left of the y axis is found by taking the natural log and adding imaginary pi, but I don't understand where imaginary pi comes from.

4. Nov 29, 2011

### D H

Staff Emeritus
It comes from Euler's identity: $e^{\pi i}+1=0$.

5. Nov 29, 2011

### AlephZero

I don't know what math background you have, but the key result here is
$e^{ix} = \cos x + i \sin x$
If you aren't familar with that, Google for "Euler's identity"

Suppose $z = \log(-a)$ where $a > 0$. Then $e^z = -a$. Since $e^x > 0$ for any real value of $x$, $z$ must be complex so let $z = x + iy$.

Then $e^{x + iy} = e^x(\cos y + i \sin y) = -a$

The imaginary part = 0, so $\sin y = 0$.

So $\cos y = \pm 1$ and to make the real parts equal we have to take $\cos y = -1$ and $e^x = a$ or $x = \log a$.

Putting it all together

$\log(-a) = \log(a) + i \pi + 2k\pi$ where $k$ is any integer.

The graph shows the "principal value" i.e. $\log(a) + i \pi$.