Log of a negative number 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.
 A: 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.
A: $e^{πi} + 1 = 0$.
$e^{πi} = -1$.
$πi = \log(-1)$. 
$\log(-1) + \log(|a|) = \log(-|a|)$. 
$\log(-|a|) = \log(|a|)+iπ$.
A: 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!
