# Logarithm of a matrix

(Redirected from Matrix logarithm)

In mathematics, a logarithm of a matrix is another matrix such that the matrix exponential of the latter matrix equals the original matrix. It is thus a generalization of the scalar logarithm and in some sense an inverse function of the matrix exponential. Not all matrices have a logarithm and those matrices that do have a logarithm may have more than one logarithm. The study of logarithms of matrices leads to Lie theory since when a matrix has a logarithm then it is in a Lie group and the logarithm is the corresponding element of the vector space of the Lie algebra.

## Definition

The exponential of a matrix A is defined by

${\displaystyle e^{A}\equiv \sum _{n=0}^{\infty }{\frac {A^{n}}{n!}}}$.

Given a matrix B, another matrix A is said to be a matrix logarithm of B if eA = B. Because the exponential function is not one-to-one for complex numbers (e.g. ${\displaystyle e^{\pi i}=e^{3\pi i}=-1}$), numbers can have multiple complex logarithms, and as a consequence of this, some matrices may have more than one logarithm, as explained below.

## Power series expression

If B is sufficiently close to the identity matrix, then a logarithm of B may be computed by means of the following power series:

${\displaystyle \mathrm {log} (B)=\sum _{k=1}^{\infty }{(-1)^{k+1}{\frac {(B-I)^{k}}{k}}}=(B-I)-{\frac {(B-I)^{2}}{2}}+{\frac {(B-I)^{3}}{3}}\cdots }$.

Specifically, if ${\displaystyle \left\|{B-I}\right\|<1}$, then the preceding series converges and ${\displaystyle e^{\mathrm {log} (B)}=B}$.[1]

## Example: Logarithm of rotations in the plane

The rotations in the plane give a simple example. A rotation of angle α around the origin is represented by the 2×2-matrix

${\displaystyle A={\begin{pmatrix}\cos(\alpha )&-\sin(\alpha )\\\sin(\alpha )&\cos(\alpha )\\\end{pmatrix}}.}$

For any integer n, the matrix

${\displaystyle B_{n}=(\alpha +2\pi n){\begin{pmatrix}0&-1\\1&0\\\end{pmatrix}},}$

is a logarithm of A. Thus, the matrix A has infinitely many logarithms. This corresponds to the fact that the rotation angle is only determined up to multiples of 2π.

In the language of Lie theory, the rotation matrices A are elements of the Lie group SO(2). The corresponding logarithms B are elements of the Lie algebra so(2), which consists of all skew-symmetric matrices. The matrix

${\displaystyle {\begin{pmatrix}0&1\\-1&0\\\end{pmatrix}}}$

is a generator of the Lie algebra so(2).

## Existence

The question of whether a matrix has a logarithm has the easiest answer when considered in the complex setting. A matrix has a logarithm if and only if it is invertible.[2] The logarithm is not unique, but if a matrix has no negative real eigenvalues, then there is a unique logarithm that has eigenvalues all lying in the strip {zC | −π < Im z < π}. This logarithm is known as the principal logarithm.[3]

The answer is more involved in the real setting. A real matrix has a real logarithm if and only if it is invertible and each Jordan block belonging to a negative eigenvalue occurs an even number of times.[4] If an invertible real matrix does not satisfy the condition with the Jordan blocks, then it has only non-real logarithms. This can already be seen in the scalar case: no branch of the logarithm can be real at -1. The existence of real matrix logarithms of real 2×2 matrices is considered in a later section.

## Properties

If A and B are both positive-definite matrices, then

${\displaystyle \operatorname {tr} {\log {(AB)}}=\operatorname {tr} {\log {(A)}}+\operatorname {tr} {\log {(B)}},}$

and if A and B commute, i.e., AB = BA, then

${\displaystyle \log {(AB)}=\log {(A)}+\log {(B)}.\,}$

Substituting in this equation B = A−1, one gets

${\displaystyle \log {(A^{-1})}=-\log {(A)}.}$

## Further example: Logarithm of rotations in 3D space

A rotation R ∈ SO(3) in ℝ³ is given by a 3×3 orthogonal matrix.

The logarithm of such a rotation matrix R can be readily computed from the antisymmetric part of Rodrigues' rotation formula[5] (see also Axis angle). It yields the logarithm of minimal Frobenius norm, but fails when R has eigenvalues equal to −1 where this is not unique.

Further note that, given rotation matrices A and B,

${\displaystyle d_{g}(A,B):=\|\log(A^{\top }B)\|_{F}}$

is the geodesic distance on the 3D manifold of rotation matrices.

## Calculating the logarithm of a diagonalizable matrix

A method for finding ln A for a diagonalizable matrix A is the following:

Find the matrix V of eigenvectors of A (each column of V is an eigenvector of A).
Find the inverse V−1 of V.
Let
${\displaystyle A'=V^{-1}AV.\,}$
Then A′ will be a diagonal matrix whose diagonal elements are eigenvalues of A.
Replace each diagonal element of A′ by its (natural) logarithm in order to obtain ${\displaystyle \log A'}$.
Then
${\displaystyle \log A=V(\log A')V^{-1}.\,}$

That the logarithm of A might be a complex matrix even if A is real then follows from the fact that a matrix with real and positive entries might nevertheless have negative or even complex eigenvalues (this is true for example for rotation matrices). The non-uniqueness of the logarithm of a matrix follows from the non-uniqueness of the logarithm of a complex number.

## The logarithm of a non-diagonalizable matrix

The algorithm illustrated above does not work for non-diagonalizable matrices, such as

${\displaystyle {\begin{bmatrix}1&1\\0&1\end{bmatrix}}.}$

For such matrices one needs to find its Jordan decomposition and, rather than computing the logarithm of diagonal entries as above, one would calculate the logarithm of the Jordan blocks.

The latter is accomplished by noticing that one can write a Jordan block as

${\displaystyle B={\begin{pmatrix}\lambda &1&0&0&\cdots &0\\0&\lambda &1&0&\cdots &0\\0&0&\lambda &1&\cdots &0\\\vdots &\vdots &\vdots &\ddots &\ddots &\vdots \\0&0&0&0&\lambda &1\\0&0&0&0&0&\lambda \\\end{pmatrix}}=\lambda {\begin{pmatrix}1&\lambda ^{-1}&0&0&\cdots &0\\0&1&\lambda ^{-1}&0&\cdots &0\\0&0&1&\lambda ^{-1}&\cdots &0\\\vdots &\vdots &\vdots &\ddots &\ddots &\vdots \\0&0&0&0&1&\lambda ^{-1}\\0&0&0&0&0&1\\\end{pmatrix}}=\lambda (I+K)}$

where K is a matrix with zeros on and under the main diagonal. (The number λ is nonzero by the assumption that the matrix whose logarithm one attempts to take is invertible.)

Then, by the Mercator series

${\displaystyle \log(1+x)=x-{\frac {x^{2}}{2}}+{\frac {x^{3}}{3}}-{\frac {x^{4}}{4}}+\cdots }$

one gets

${\displaystyle \log B=\log {\big (}\lambda (I+K){\big )}=\log(\lambda I)+\log(I+K)=(\log \lambda )I+K-{\frac {K^{2}}{2}}+{\frac {K^{3}}{3}}-{\frac {K^{4}}{4}}+\cdots }$

This series has a finite number of terms (Km is zero if m is the dimension of K), and so its sum is well-defined.

Using this approach one finds

${\displaystyle \log {\begin{bmatrix}1&1\\0&1\end{bmatrix}}={\begin{bmatrix}0&1\\0&0\end{bmatrix}}.}$

## A functional analysis perspective

A square matrix represents a linear operator on the Euclidean space Rn where n is the dimension of the matrix. Since such a space is finite-dimensional, this operator is actually bounded.

Using the tools of holomorphic functional calculus, given a holomorphic function f(z) defined on an open set in the complex plane and a bounded linear operator T, one can calculate f(T) as long as f(z) is defined on the spectrum of T.

The function f(z)=log z can be defined on any simply connected open set in the complex plane not containing the origin, and it is holomorphic on such a domain. This implies that one can define ln T as long as the spectrum of T does not contain the origin and there is a path going from the origin to infinity not crossing the spectrum of T (e.g., if the spectrum of T is a circle with the origin inside of it, it is impossible to define ln T).

The spectrum of a linear operator on Rn is the set of eigenvalues of its matrix, and so is a finite set. As long as the origin is not in the spectrum (the matrix is invertible), the path condition from the previous paragraph is satisfied, and ln T is well-defined. The non-uniqueness of the matrix logarithm follows from the fact that one can choose more than one branch of the logarithm which is defined on the set of eigenvalues of a matrix.

## A Lie group theory perspective

In the theory of Lie groups, there is an exponential map from a Lie algebra g to the corresponding Lie group G

${\displaystyle \exp :g\rightarrow G.}$

For matrix Lie groups, the elements of g and G are square matrices and the exponential map is given by the matrix exponential. The inverse map ${\displaystyle \log =\exp ^{-1}}$ is multivalued and coincides with the matrix logarithm discussed here. The logarithm maps from the Lie group G into the Lie algebra g. Note that the exponential map is a local diffeomorphism between a neighborhood U of the zero matrix ${\displaystyle {\underline {0}}\in g}$ and a neighborhood V of the identity matrix ${\displaystyle {\underline {1}}\in G}$.[6] Thus the (matrix) logarithm is well-defined as a map,

${\displaystyle \log :V\subset G\rightarrow U\subset g.\,}$

An important corollary of Jacobi's formula then is

${\displaystyle \log(\det(A))=\mathrm {tr} (\log A)~.}$

## Constraints in the 2 × 2 case

If a 2 × 2 real matrix has a negative determinant, it has no real logarithm. Note first that any 2 × 2 real matrix can be considered one of the three types of the complex number z = x + y ε, where ε² ∈ { −1, 0, +1 }. This z is a point on a complex subplane of the ring of matrices.

The case where the determinant is negative only arises in a plane with ε² =+1, that is a split-complex number plane. Only one quarter of this plane is the image of the exponential map, so the logarithm is only defined on that quarter (quadrant). The other three quadrants are images of this one under the Klein four-group generated by ε and −1.

For example, let a = log 2 ; then cosh a = 5/4 and sinh a = 3/4. For matrices, this means that

${\displaystyle A=\exp {\begin{pmatrix}0&a\\a&0\end{pmatrix}}={\begin{pmatrix}\cosh a&\sinh a\\\sinh a&\cosh a\end{pmatrix}}={\begin{pmatrix}1.25&.75\\.75&1.25\end{pmatrix}}}$.

So this last matrix has logarithm

${\displaystyle \log A={\begin{pmatrix}0&\log 2\\\log 2&0\end{pmatrix}}}$.

These matrices, however, do not have a logarithm:

${\displaystyle {\begin{pmatrix}3/4&5/4\\5/4&3/4\end{pmatrix}},\ {\begin{pmatrix}-3/4&-5/4\\-5/4&-3/4\end{pmatrix}},\ {\begin{pmatrix}-5/4&-3/4\\-3/4&-5/4\end{pmatrix}}}$.

They represent the three other conjugates by the four-group of the matrix above that does have a logarithm.

A non-singular 2 x 2 matrix does not necessarily have a logarithm, but it is conjugate by the four-group to a matrix that does have a logarithm.

It also follows, that, e.g., a square root of this matrix A is obtainable directly from exponentiating (logA)/2,

${\displaystyle {\sqrt {A}}={\begin{pmatrix}\cosh((\log 2)/2)&\sinh((\log 2)/2)\\\sinh((\log 2)/2)&\cosh((\log 2)/2)\end{pmatrix}}={\begin{pmatrix}1.06&.35\\.35&1.06\end{pmatrix}}~.}$

For a richer example, start with a pythagorean triple (p,q,r) and let a = log(p + r) − log q. Then

${\displaystyle e^{a}={\frac {p+r}{q}}=\cosh a+\sinh a}$.

Now

${\displaystyle \exp {\begin{pmatrix}0&a\\a&0\end{pmatrix}}={\begin{pmatrix}r/q&p/q\\p/q&r/q\end{pmatrix}}}$.

Thus

${\displaystyle {\tfrac {1}{q}}{\begin{pmatrix}r&p\\p&r\end{pmatrix}}}$

has the logarithm matrix

${\displaystyle {\begin{pmatrix}0&a\\a&0\end{pmatrix}}}$ ,

where a = log(p + r) − log q.

## Notes

1. ^ Hall 2015 Theorem 2.8
2. ^ Higham (2008), Theorem 1.27
3. ^ Higham (2008), Theorem 1.31
4. ^ Culver (1966)
5. ^ Engø (2001)
6. ^ Hall 2015 Theorem 3.42

## References

• Gantmacher, Felix R. (1959), The Theory of Matrices, 1, New York: Chelsea, pp. 239–241.
• Hall, Brian C. (2015), Lie Groups, Lie Algebras, and Representations An Elementary Introduction, Graduate Texts in Mathematics, 222 (2nd ed.), Springer, ISBN 978-3319134666
• Culver, Walter J. (1966), "On the existence and uniqueness of the real logarithm of a matrix", Proceedings of the American Mathematical Society, 17 (5): 1146–1151, doi:10.1090/S0002-9939-1966-0202740-6, ISSN 0002-9939.
• Higham, Nicholas (2008), Functions of Matrices. Theory and Computation, SIAM, ISBN 978-0-89871-646-7.
• Engø, Kenth (June 2001), "On the BCH-formula in so(3)", BIT Numerical Mathematics, 41 (3): 629–632, doi:10.1023/A:1021979515229, ISSN 0006-3835