Why is the log of $x$ equal to the log of the absolute value of $x$ plus $i$ times $\pi$?

$$\log(x)=\log(|x|)+i\pi\text{, for }x < 0$$

Where does the $\pi$ come from? Is it from a logarithmic identity?

I know it sounds silly, but I was not able to find an answer from existing solutions: here, here, and here.

  • 7
    $\begingroup$ It comes from the identity $e^{i\pi} +1 = 0$, we rearrange this to be $\log(-1) = i \pi$, then for any negative number, $\log(-x) = \log( (-1) \cdot (x) ) = \log(-1) + \log(x) = i \pi + \log(x)$ $\endgroup$
    – Rob
    Jan 9, 2017 at 1:09
  • 3
    $\begingroup$ Are you familiar with the complex logarithm? $\endgroup$
    – pjs36
    Jan 9, 2017 at 1:10
  • 1
    $\begingroup$ Probably it comes from $e^{i\pi}=-1$ $\endgroup$
    – drzbir
    Jan 9, 2017 at 1:10
  • 1
    $\begingroup$ someday, when you study complex analysis, you will understand that what you said is only approximately true... $\endgroup$
    – GEdgar
    Jan 9, 2017 at 3:09
  • 2
    $\begingroup$ You asked "why is this not always true" but you linked to a page that says the formula is always true. $\endgroup$
    – David K
    Jan 9, 2017 at 3:28

3 Answers 3


$e^{πi} + 1 = 0$.

$e^{πi} = -1$.

$πi = \log(-1)$.

$\log(-1) + \log(|a|) = \log(-|a|)$.

$\log(-|a|) = \log(|a|)+iπ$.

  • 1
    $\begingroup$ first equation should be $e^{(2k+1)\pi i}$ $\endgroup$
    – L Q
    Aug 14, 2022 at 22:31
  • $\begingroup$ that's a fair add, but this response was catered to his result @LQ $\endgroup$ Aug 14, 2022 at 22:57

The standard explanation would go like this:

Any complex number $z$ can be written in polar form: $$z = |z|e^{i\theta}.$$ So, if we want to define the complex logarithm, we do so as follows: $$\log (z) = \log(|z|e^{i\theta}) = \log(|z|) + \log(e^{i\theta}) = \log(|z|) + i\theta.$$ In particular, the logarithm of a negative real number $x$ can then be calculated as $$\log (x) = \log(|x|e^{i\pi}) = \log(|x|) + \log(e^{i\pi}) = \log(|x|) + i\pi.$$

However, this explanation is not sufficient and the logarithm as presented is NOT a well-defined function. The angle $\theta$ is, well, an angle, and hence only defined up to multiples of $2\pi$: $$|z|e^{i\theta} = |z|e^{i(\theta+k2\pi)}$$ for all $k \in \mathbb{Z}$. Therefore, the complex logarithm is only defined up to multiples of $2\pi i$ !

For example: $$\log (x) = \log(|x|e^{i\frac{3}{2}\pi}) = \log(|x|) + \log(e^{i\frac{3}{2}\pi}) = \log(|x|) + i\frac{3}{2}\pi,$$ or maybe $$\log (x) = \log(|x|e^{-i\frac{177}{2}\pi}) = \log(|x|) + \log(e^{-i\frac{177}{2}\pi}) = \log(|x|) - i\frac{177}{2}\pi.$$ But clearly $\pi \neq \frac{3}{2}\pi \neq -\frac{177}{2}\pi$. The point is: the complex logarithm is not a function, but what we call a multivalued function. To turn it into a proper function, we must restrict what $\theta$ is allowed to be, for example $\theta \in (-\pi,\pi]$. This is called the principal complex logarithm and is usually denoted by $\operatorname{Log}$ (capital L).

Technically, it doesn't matter to what range you restrict $\theta$, as long as the resulting logarithm is a proper function (not a multivalued function) and you are consistent in your restriction of $\theta$. For example, the following "proof" can be obtained if you're sloppy: \begin{align} e^{\pi i} = -1 & \implies (e^{\pi i})^2 = (-1)^2 & \text{ (square both sides)}\\ & \implies e^{2\pi i} = 1 & \text{ (calculate the squares)}\\ & \implies \log (e^{2\pi i}) = \log(1) & \text{ (take the logarithm)}\\ & \implies 2\pi i = 0 & \text{ (calculate the logarithms)} \end{align} Clearly this is wrong!

  • $\begingroup$ Very clear. Thank you. I expect I'm being stupid, but I don't understand why, under "for example", it's $$\log(x)=\log(|x|e^{I\tfrac 32\pi})$$ and not $$\log(x)=\log(|x|e^{I 3\pi})$$ and so on. $\endgroup$ Aug 28, 2022 at 9:00

Slightly tongue in cheek but partially seriously I'm going to say "magic".

What I mean is before we talk about $\ln -k$ for a negative number we have to define what on earth it could possibly mean to have $e^{m} = -k$. There is no "natural" meaning to that and mathematicians, in one sense, must contrive a meaning for it. If our universe is the real numbers then this is .... impossible. If $b > 0$ then $b^x > 1$ and $e^x$ being negative is simply impossible.

But what if our universe is the complex numbers. Then if $z = a + bi$ ($i^2 = -1$) then what could $e^{a+bi}$ possibly mean? After all we can't just "multiply $e$ by itself the square root of negative one times".

Well, we know for real numbers, $e^{x + y} = e^xe^y$ and $\frac {de^x}{dx} = e^x$. For this to still be true for complex numbers as well as for real numbers the only way to define $e^{z}$ where $z$ is a complex number, so that $e^{z+w} = e^ze^w$ and so that $\frac {d^z}{dz}$ the only possible way for that to stay true we have to define $e^{a+bi} = e^a(\cos b + i \sin b)$.

Okay. That was ... a lot of hand waving. But it works and if you study complex analysis it will be derived in great detail. BUT this means....

$e^{i\pi} = e^{0 + i\pi} = e^0(\cos \pi + i \sin \pi) = 1*(-1 + i*0) = -1$.

This is Euler's Formula, one of the most famous mathematical formula in history.

Suddenly $e^z$ being a negative number is not impossible. But if $e^z$ is negative then we need to have $e^{z} = e^{a + bi} = e^a(\cos b + i \sin b)$ so $\cos b + i \sin b$ is a negative number. That means $b = \pi$ . So $z = i \pi$.

So this means $\ln -1*x = \ln -1 + \ln x = i\pi + \ln x$.

And that's where $\pi$ comes from. When we define $e^{a+bi} = e^a(\cos b + i \sin b)$, exponents become thoroughly linked with trigonometric functions. As such, $\pi$ is an essential part of the inverse.

For the real numbers only and logs of positive real numbers only, we don't have to worry as $e^x = e^{x + 0*i} = e^x(\cos 0 + i \sin 0) = e^x(1 + i*0) = e^x= k$ and $\ln k = x$ and $\pi$ is not relevant.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .