Post · 3 min read· pp. 660–661

What Is the Matrix Logarithm?

A logarithm of a square matrix AA is a matrix XX such that eX=A\mathrm{e}^X = A, where eX\mathrm{e}^X is the matrix exponential. Just as in the scalar case, the matrix logarithm is not unique, since if eX=A\mathrm{e}^X = A then eX+2kπiI=A\mathrm{e}^{X+2k\pi\mathrm{i}I} = A for any integer kk. However, for matrices the nonuniqueness is complicated by the presence of repeated eigenvalues. For example, the matrix

X(t)=2πi[1−2t2t20−1−t000]\notag X(t) = 2\pi \mathrm{i} \begin{bmatrix}1 & -2t & 2t^2 \\ 0 & -1 & -t \\ 0 & 0 & 0 \end{bmatrix}

is an upper triangular logarithm of the 3×33\times 3 identity matrix I3I_3 for any tt, whereas the obvious logarithms are the diagonal matrices 2π i diag(k1,k2,k3)2\pi\mskip1mu\mathrm{i}\mskip1mu\mathrm{diag}(k_1,k_2,k_3), for integers k1k_1, k2k_2, and k3k_3. Notice that the repeated eigenvalue 11 of I3I_3 has been mapped to the distinct eigenvalues 2π2\pi, −2π-2\pi, and 00 in X(t)X(t). This is characteristic of nonprimary logarithms, and in some applications such strange logarithms may be required—an example is the embeddability problem for Markov chains.

An important question is whether a nonsingular real matrix has a real logarithm. The answer is that it does if and only if the Jordan canonical form contains an even number of Jordan blocks of each size for every negative eigenvalue. This means, in particular, that if AA has an unrepeated negative eigenvalue then it does not have a real logarithm. Minus the n×nn\times n identity matrix has a real logarithm for even nn but not for odd nn. Indeed, for n=2n=2,

\notag X = \pi\left[\begin{array}{@{}rr@{}} 0 & 1\\ -1 & 0 \end{array}\right]

satisfies eX=−I2\mathrm{e}^X = -I_2, as does Y=ZXZ−1Y = ZXZ^{-1} for any nonsingular ZZ, since eY=ZeXZ−1=−ZZ−1=−I2\mathrm{e}^Y = Z\mathrm{e}^X Z^{-1} = -Z Z^{-1} = -I_2.

For most practical purposes it is the principal logarithm that is of interest, defined for any matrix with no negative real eigenvalues as the unique logarithm whose eigenvalues lie in the strip { z:−π<Im(z)<π }\{\, z : -\pi < \mathrm{Im}(z) < \pi \,\}. From this point on we assume that AA has no negative eigenvalues and that the logarithm is the principal logarithm.

Various explicit representations of the logarithm are available, including

log⁡A=∫01(A−I)[t(A−I)+I]−1 dt,log⁡(I+X)=X−X22+X33−X44+⋯ ,ρ(X)<1,\notag \begin{aligned} \log A &= \int_0^1 (A-I)\bigl[ t(A-I) + I \bigr]^{-1} \,\mathrm{d}t, \\ \log(I+X) &= X - \frac{X^2}{2} + \frac{X^3}{3} - \frac{X^4}{4} + \cdots, \quad \rho(X)<1, \end{aligned}

where the spectral radius ρ(X)=max⁡{ ∣λ∣:λ is an eigenvalue of X }\rho(X) = \max\{\, |\lambda| : \lambda~\textrm{is an eigenvalue of}~X\,\}. A useful relation is log⁡(Aα)=αlog⁡A\log (A^{\alpha}) = \alpha \log A for α∈[−1,1]\alpha\in[-1,1], with important special cases log⁡(A−1)=−log⁡A\log (A^{-1}) = - \log A and log⁡(A1/2)=12log⁡A\log (A^{1/2}) = \frac{1}{2} \log A (where the square root is the principal square root). Recurring the latter expression gives, for any positive integer kk,

log⁡(A)=2klog⁡(A1/2k).\notag \log(A) = 2^k \log\bigl(A^{1/2^k}\bigr).

This formula is the basis for the inverse scaling and squaring method for computing the logarithm, which chooses kk so that E=I−A1/2kE = I - A^{1/2^k} is small enough that log⁡(I+E)\log(I + E) can be efficiently approximated by Padé approximation. The MATLAB function logm uses the inverse scaling and squaring method together with a Schur decomposition.

References

This references contains more on the facts above, as well as further references.

This article is part of the “What Is” series, available from https://nhigham.com/category/what-is and in PDF form from the GitHub repository https://github.com/higham/what-is.