# Complex logarithm

In mathematics, a complex logarithm is a generalization of the natural logarithm to nonzero complex numbers. The term refers to one of the following, which are strongly related:
* A complex logarithm of a nonzero complex number $z$, defined to be any complex number $w$ for which $e^{w}=z$. Such a number $w$ is denoted by $\log z$. If $z$ is given in polar form as $z=re^{i\theta }$, where $r$ and $\theta$ are real numbers with $r>0$, then $\ln r+i\theta$ is one logarithm of $z$, and all the complex logarithms of $z$ are exactly the numbers of the form $\ln r+i\left(\theta +2\pi k\right)$ for integers $k$. These logarithms are equally spaced along a vertical line in the complex plane.
* A complex-valued function $\log \colon U\to \mathbb {C}$, defined on some subset $U$ of the set $\mathbb {C} ^{*}$ of nonzero complex numbers, satisfying $e^{\log z}=z$ for all $z$ in $U$. Such complex logarithm functions are analogous to the real logarithm function $\ln \colon \mathbb {R} _{>0}\to \mathbb {R}$, which is the inverse of the real exponential function and hence satisfies e$^{lnx}$ = x for all positive real numbers x. Complex logarithm functions can be constructed by explicit formulas involving real-valued functions, by integration of $1/z$, or by the process of analytic continuation.
There is no continuous complex logarithm function defined on all of $\mathbb {C} ^{*}$. Ways of dealing with this include branches, the associated Riemann surface, and partial inverses of the complex exponential function. The principal value defines a particular complex logarithm function $\operatorname {Log} \colon \mathbb {C} ^{*}\to \mathbb {C}$ that is continuous except along the negative real axis; on the complex plane with the negative real numbers and 0 removed, it is the analytic continuation of the (real) natural logarithm.

## Problems with inverting the complex exponential function

For a function to have an inverse, it must map distinct values to distinct values; that is, it must be injective. But the complex exponential function is not injective, because $e^{w+2\pi ik}=e^{w}$ for any complex number $w$ and integer $k$, since adding $i\theta$ to $z$ has the effect of rotating $e^{w}$ counterclockwise $\theta$ radians. So the points
    $\ldots ,\;w-4\pi i,\;w-2\pi i,\;w,\;w+2\pi i,\;w+4\pi i,\;\ldots ,$
equally spaced along a vertical line, are all mapped to the same number by the exponential function. This means that the exponential function does not have an inverse function in the standard sense. There are two solutions to this problem.
One is to restrict the domain of the exponential function to a region that does not contain any two numbers differing by an integer multiple of $2{\mathit {\pi i}}$: this leads naturally to the definition of branches of $\log z$, which are certain functions that single out one logarithm of each number in their domains. This is analogous to the definition of $\arcsin x$ on $[-1,1]$ as the inverse of the restriction of $\sin \theta$ to the interval $[-\pi /2,\pi /2]$: there are infinitely many real numbers $\theta$ with $\sin \theta =x$, but one arbitrarily chooses the one in $[-\pi /2,\pi /2]$.
Another way to resolve the indeterminacy is to view the logarithm as a function whose domain is not a region in the complex plane, but a Riemann surface that covers the punctured complex plane in an infinite-to-1 way.
Branches have the advantage that they can be evaluated at complex numbers. On the other hand, the function on the Riemann surface is elegant in that it packages together all branches of the logarithm and does not require an arbitrary choice as part of its definition.

## Principal value
### Definition

For each nonzero complex number $z$, the principal value $\operatorname {Log} z$ is the logarithm whose imaginary part lies in the interval $(-\pi ,\pi ]$. The expression $\operatorname {Log} 0$ is left undefined since there is no complex number $w$ satisfying $e^{w}=0$.
When the notation $\log z$ appears without any particular logarithm having been specified, it is generally best to assume that the principal value is intended. In particular, this gives a value consistent with the real value of $\ln z$ when $z$ is a positive real number. The capitalization in the notation ${\text{Log}}$ is used by some authors to distinguish the principal value from other logarithms of $z.$

### Calculating the principal value

The polar form of a nonzero complex number $z=x+yi$ is $z=re^{i\theta }$, where r=|z|=√(x$^2$+y$^2$){\textstyle r=|z|={\sqrt {x^{2}+y^{2}}}} is the absolute value of $z$, and $\theta$ is its argument. The absolute value is real and positive. The argument is defined up to addition of an integer multiple of 2π. Its principal value is the value that belongs to the interval $(-\pi ,\pi ]$, which is expressed as $\operatorname {atan2} (y,x)$.
This leads to the following formula for the principal value of the complex logarithm:
    $\operatorname {Log} z=\ln r+i\theta =\ln |z|+i\operatorname {Arg} z=\ln {\sqrt {x^{2}+y^{2}}}+i\operatorname {atan2} (y,x).$
For example, $\operatorname {Log} (-3i)=\ln 3-\pi i/2$, and $\operatorname {Log} (-3)=\ln 3+\pi i$.

### The principal value as an inverse function

Another way to describe $\operatorname {Log} z$ is as the inverse of a restriction of the complex exponential function, as in the previous section. The horizontal strip $S$ consisting of complex numbers $w=x+yi$ such that $-\pi <y\leq \pi$ is an example of a region not containing any two numbers differing by an integer multiple of $2\pi i$, so the restriction of the exponential function to $S$ has an inverse. In fact, the exponential function maps $S$ bijectively to the punctured complex plane $\mathbb {C} ^{*}=\mathbb {C} \setminus \{0\}$, and the inverse of this restriction is $\operatorname {Log} \colon \mathbb {C} ^{*}\to S$. The conformal mapping section below explains the geometric properties of this map in more detail.

### The principal value as an analytic continuation

On the region $\mathbb {C} -\mathbb {R} _{\leq 0}$ consisting of complex numbers that are not negative real numbers or 0, the function $\operatorname {Log} z$ is the analytic continuation of the natural logarithm. The values on the negative real line can be obtained as limits of values at nearby complex numbers with positive imaginary parts.

### Properties

Not all identities satisfied by $\ln$ extend to complex numbers. It is true that $e^{\operatorname {Log} z}=z$ for all $z\not =0$ (this is what it means for $\operatorname {Log} z$ to be a logarithm of $z$), but the identity $\operatorname {Log} (e^{z})=z$ fails for $z$ outside the strip $S$. For this reason, one cannot always apply ${\text{Log}}$ to both sides of an identity $e^{z}=e^{w}$ to deduce $z=w$. Also, the identity $\operatorname {Log} (z_{1}z_{2})=\operatorname {Log} z_{1}+\operatorname {Log} z_{2}$ can fail: the two sides can differ by an integer multiple of $2\pi i$; for instance,
    $\operatorname {Log} ((-1)i)=\operatorname {Log} (-i)=\ln(1)-{\frac {\pi i}{2}}=-{\frac {\pi i}{2}},$
but
    $\operatorname {Log} (-1)+\operatorname {Log} (i)=\left(\ln(1)+\pi i\right)+\left(\ln(1)+{\frac {\pi i}{2}}\right)={\frac {3\pi i}{2}}\neq -{\frac {\pi i}{2}}.$
The function $\operatorname {Log} z$ is discontinuous at each negative real number, but continuous everywhere else in $\mathbb {C} ^{*}$. To explain the discontinuity, consider what happens to $\arg z$ as $z$ approaches a negative real number $a$. If $z$ approaches $a$ from above, then $\arg z$ approaches $\pi ,$ which is also the value of $\arg a$ itself. But if $z$ approaches $a$ from below, then $\arg z$ approaches $-\pi .$ So $\arg z$ "jumps" by $2\pi$ as $z$ crosses the negative real axis, and similarly $\operatorname {Log} z$ jumps by $2\pi i.$

## Branches of the complex logarithm

Is there a different way to choose a logarithm of each nonzero complex number so as to make a function $\operatorname {L} (z)$ that is continuous on all of $\mathbb {C} ^{*}$? The answer is no. To see why, imagine tracking such a logarithm function along the unit circle, by evaluating $\operatorname {L} \left(e^{i\theta }\right)$ as $\theta$ increases from $0$ to $2\pi$. If $\operatorname {L} (z)$ is continuous, then so is $\operatorname {L} \left(e^{i\theta }\right)-i\theta$, but the latter is a difference of two logarithms of $e^{i\theta },$ so it takes values in the discrete set $2\pi i\mathbb {Z} ,$ so it is constant. In particular, $\operatorname {L} \left(e^{2\pi i}\right)-2\pi i=\operatorname {L} \left(e^{0}\right)-0$, which contradicts $\operatorname {L} \left(e^{2\pi i}\right)=\operatorname {L} \left(e^{0}\right)$.
To obtain a continuous logarithm defined on complex numbers, it is hence necessary to restrict the domain to a smaller subset $U$ of the complex plane. Because one of the goals is to be able to differentiate the function, it is reasonable to assume that the function is defined on a neighborhood of each point of its domain; in other words, $U$ should be an open set. Also, it is reasonable to assume that $U$ is connected, since otherwise the function values on different components of $U$ could be unrelated to each other. All this motivates the following definition:
    A branch of $\log z$ is a continuous function $\operatorname {L} (z)$ defined on a connected open subset $U$ of the complex plane such that $\operatorname {L} (z)$ is a logarithm of $z$ for each $z$ in $U$.
For example, the principal value defines a branch on the open set where it is continuous, which is the set $\mathbb {C} -\mathbb {R} _{\leq 0}$ obtained by removing 0 and all negative real numbers from the complex plane.
Another example: The Mercator series
    $\ln(1+u)=\sum _{n=1}^{\infty }{\frac {(-1)^{n+1}}{n}}u^{n}=u-{\frac {u^{2}}{2}}+{\frac {u^{3}}{3}}-\cdots$
converges locally uniformly for $|u|<1$, so setting $z=1+u$ defines a branch of $\log z$ on the open disk of radius 1 centered at 1. (Actually, this is just a restriction of $\operatorname {Log} z$, as can be shown by differentiating the difference and comparing values at 1.)
Once a branch is fixed, it may be denoted $\log z$ if no confusion can result. Different branches can give different values for the logarithm of a particular complex number, however, so a branch must be fixed in advance (or else the principal branch must be understood) in order for "$\log z$" to have a precise unambiguous meaning.
In some literature, the notation $\ln _{k}z$ is used to explicitly denote the $k$-th branch of the complex logarithm. This notation is particularly useful when working with multi-valued logarithms in complex analysis and topology. It was first introduced in the paper Unwinding the Branches of the Lambert W function and was later referenced in the work of David Jeffrey.

### Branch cuts

The argument above involving the unit circle generalizes to show that no branch of $\log z$ exists on an open set $U$ containing a closed curve that winds around 0. One says that "$\log z$" has a branch point at 0". To avoid containing closed curves winding around 0, $U$ is typically chosen as the complement of a ray or curve in the complex plane going from 0 (inclusive) to infinity in some direction. In this case, the curve is known as a branch cut. For example, the principal branch has a branch cut along the negative real axis.
If the function $\operatorname {L} (z)$ is extended to be defined at a point of the branch cut, it will necessarily be discontinuous there; at best it will be continuous "on one side", like $\operatorname {Log} z$ at a negative real number.

### The derivative of the complex logarithm

Each branch $\operatorname {L} (z)$ of $\log z$ on an open set $U$ is the inverse of a restriction of the exponential function, namely the restriction to the image $\operatorname {L} (U)$. Since the exponential function is holomorphic (that is, complex differentiable) with nonvanishing derivative, the complex analogue of the inverse function theorem applies. It shows that $\operatorname {L} (z)$ is holomorphic on $U$, and $\operatorname {L} '(z)=1/z$ for each $z$ in $U$. Another way to prove this is to check the Cauchy–Riemann equations in polar coordinates.

### Constructing branches via integration

The function $\ln(x)$ for real $x>0$ can be constructed by the formula $\ln(x)=\int _{1}^{x}{\frac {du}{u}}.$ If the range of integration started at a positive number $a$ other than 1, the formula would have to be $\ln(x)=\ln(a)+\int _{a}^{x}{\frac {du}{u}}$ instead.
In developing the analogue for the complex logarithm, there is an additional complication: the definition of the complex integral requires a choice of path. Fortunately, if the integrand is holomorphic, then the value of the integral is unchanged by deforming the path (while holding the endpoints fixed), and in a simply connected region $U$ (a region with "no holes"), any path from $a$ to $z$ inside $U$ can be continuously deformed inside $U$ into any other. All this leads to the following:
$U$
$\mathbb {C}$
$\log z$
$U$
$a$
$U$
$b$
$a$
$L(z)=b+\int _{a}^{z}{\frac {dw}{w}}$
$z$
$U$

## The complex logarithm as a conformal map

Any holomorphic map $f\colon U\to \mathbb {C}$ satisfying $f'(z)\neq 0$ for all $z\in U$ is a conformal map, which means that if two curves passing through a point $a$ of $U$ form an angle $\alpha$ (in the sense that the tangent lines to the curves at $a$ form an angle $\alpha$), then the images of the two curves form the same angle $\alpha$ at $f(a)$. Since a branch of $\log z$ is holomorphic, and since its derivative $1/z$ is never 0, it defines a conformal map.
For example, the principal branch $w=\operatorname {Log} z$, viewed as a mapping from $\mathbb {C} -\mathbb {R} _{\leq 0}$ to the horizontal strip defined by $\left|\operatorname {Im} z\right|<\pi$, has the following properties, which are direct consequences of the formula in terms of polar form:
* Circles in the z-plane centered at 0 are mapped to vertical segments in the w-plane connecting $a-\pi i$ to $a+\pi i$, where $a$ is the real log of the radius of the circle.
* Rays emanating from 0 in the z-plane are mapped to horizontal lines in the w-plane.
Each circle and ray in the z-plane as above meet at a right angle. Their images under Log are a vertical segment and a horizontal line (respectively) in the w-plane, and these too meet at a right angle. This is an illustration of the conformal property of Log.

## The associated Riemann surface
### Construction

The various branches of $\log z$ cannot be glued to give a single continuous function $\log \colon \mathbb {C} ^{*}\to \mathbb {C}$ because two branches may give different values at a point where both are defined. Compare, for example, the principal branch $\operatorname {Log} z$ on $\mathbb {C} -\mathbb {R} _{\leq 0}$ with imaginary part $\theta$ in $(-\pi ,\pi )$ and the branch $\operatorname {L} (z)$ on $\mathbb {C} -\mathbb {R} _{\geq 0}$ whose imaginary part $\theta$ lies in $(0,2\pi )$. These agree on the upper half plane, but not on the lower half plane. So it makes sense to glue the domains of these branches only along the copies of the upper half plane. The resulting glued domain is connected, but it has two copies of the lower half plane. Those two copies can be visualized as two levels of a parking garage, and one can get from the ${\text{Log}}$ level of the lower half plane up to the ${\text{L}}$ level of the lower half plane by going $2\pi$ radians counterclockwise around 0, first crossing the positive real axis (of the ${\text{Log}}$ level) into the shared copy of the upper half plane and then crossing the negative real axis (of the ${\text{L}}$ level) into the ${\text{L}}$ level of the lower half plane.
One can continue by gluing branches with imaginary part $\theta$ in $(\pi ,3\pi )$, in $(2\pi ,4\pi )$, and so on, and in the other direction, branches with imaginary part $\theta$ in $(-2\pi ,0)$, in $(-3\pi ,-\pi )$, and so on. The final result is a connected surface that can be viewed as a spiraling parking garage with infinitely many levels extending both upward and downward. This is the Riemann surface $R$ associated to $\log z$.
A point on $R$ can be thought of as a pair $(z,\theta )$ where $\theta$ is a possible value of the argument of $z$. In this way, R can be embedded in $\mathbb {C} \times \mathbb {R} \approx \mathbb {R} ^{3}$.

### The logarithm function on the Riemann surface

Because the domains of the branches were glued only along open sets where their values agreed, the branches glue to give a single well-defined function $\log _{R}\colon R\to \mathbb {C}$. It maps each point $(z,\theta )$ on $R$ to $\ln |z|+i\theta$. This process of extending the original branch ${\text{Log}}$ by gluing compatible holomorphic functions is known as analytic continuation.
There is a "projection map" from $R$ down to $\mathbb {C} ^{*}$ that "flattens" the spiral, sending $(z,\theta )$ to $z$. For any $z\in \mathbb {C} ^{*}$, if one takes all the points $(z,\theta )$ of $R$ lying "directly above" $z$ and evaluates $\log _{R}$ at all these points, one gets all the logarithms of $z$.

### Gluing all branches of log z

Instead of gluing only the branches chosen above, one can start with all branches of $\log z$, and simultaneously glue every pair of branches $L_{1}\colon U_{1}\to \mathbb {C}$ and $L_{2}\colon U_{2}\to \mathbb {C}$ along the largest open subset of $U_{1}\cap U_{2}$ on which $L_{1}$ and $L_{2}$ agree. This yields the same Riemann surface $R$ and function $\log _{R}$ as before. This approach, although slightly harder to visualize, is more natural in that it does not require selecting any particular branches.
If $U'$ is an open subset of $R$ projecting bijectively to its image $U$ in $\mathbb {C} ^{*}$, then the restriction of $\log _{R}$ to $U'$ corresponds to a branch of $\log z$ defined on $U$. Every branch of $\log z$ arises in this way.

### The Riemann surface as a universal cover

The projection map $R\to \mathbb {C} ^{*}$ realizes $R$ as a covering space of $\mathbb {C} ^{*}$. In fact, it is a Galois covering with deck transformation group isomorphic to $\mathbb {Z}$, generated by the homeomorphism sending $(z,\theta )$ to $(z,\theta +2\pi )$.
As a complex manifold, $R$ is biholomorphic with $\mathbb {C}$ via $\log _{R}$. (The inverse map sends $z$ to $\left(e^{z},\operatorname {Im} (z)\right)$.) This shows that $R$ is simply connected, so $R$ is the universal cover of $\mathbb {C} ^{*}$.

## Applications

* The complex logarithm is needed to define exponentiation in which the base is a complex number. Namely, if $a$ and $b$ are complex numbers with $a\not =0$, one can use the principal value to define $a^{b}=e^{b\operatorname {Log} a}$. One can also replace $\operatorname {Log} a$ by other logarithms of $a$ to obtain other values of $a^{b}$, differing by factors of the form $e^{2\pi inb}$. The expression $a^{b}$ has a single value if and only if $b$ is an integer.
* Because trigonometric functions can be expressed as rational functions of $e^{iz}$, the inverse trigonometric functions can be expressed in terms of complex logarithms.
* In electrical engineering, the propagation constant involves a complex logarithm.

## Generalizations
### Logarithms to other bases

Just as for real numbers, one can define for complex numbers $b$ and $x$
    $\log _{b}x={\frac {\log x}{\log b}},$
with the only caveat that its value depends on the choice of a branch of log defined at $b$ and $x$ (with $\log b\not =0$). For example, using the principal value gives
    $\log _{i}e={\frac {\operatorname {Log} e}{\operatorname {Log} i}}={\frac {1}{\pi i/2}}=-{\frac {2i}{\pi }}.$

### Logarithms of holomorphic functions

If f is a holomorphic function on a connected open subset $U$ of $\mathbb {C}$, then a branch of $\log f$ on $U$ is a continuous function $g$ on $U$ such that $e^{g(z)}=f(z)$ for all $z$ in $U$. Such a function $g$ is necessarily holomorphic with $g'(z)=f'(z)/f(z)$ for all $z$ in $U$.
If $U$ is a simply connected open subset of $\mathbb {C}$, and $f$ is a nowhere-vanishing holomorphic function on $U$, then a branch of $\log f$ defined on $U$ can be constructed by choosing a starting point a in $U$, choosing a logarithm $b$ of $f(a)$, and defining
    $g(z)=b+\int _{a}^{z}{\frac {f'(w)}{f(w)}}\,dw$
for each $z$ in $U$.