Symmetric Positive-Definite Matrix Logarithm
Find the logarithm of a positive-definite matrix and verify that exponentiating it returns the original transformation.
By Riano · Published · Updated · Report a correction
Symmetric Positive-Definite Matrix Logarithm
Concept Overview
The matrix logarithm is the inverse operation of the matrix exponential. For a given matrixA, its logarithm L is a matrix such that exp(L) = A. While not all matrices have a real logarithm, every real Symmetric Positive-Definite (SPD) matrix has a unique real symmetric principal logarithm. This can be found using the spectral theorem, by taking the natural logarithm of the strictly positive eigenvalues.
Mathematical Definition
By the spectral theorem, any real symmetric matrix A can be factorized asA = QΛQT, where Q is an orthogonal matrix whose columns are the eigenvectors of A, and Λ is a diagonal matrix of real eigenvalues λi.
If A is positive-definite, all its eigenvalues are strictly positive (λi > 0). The principal matrix logarithm is then uniquely defined as:
Alternatively, using orthogonal spectral projectors Pi corresponding to distinct eigenvalues, the logarithm can be computed directly as:
A fundamental property relates the trace of the logarithm to the determinant of the original matrix:tr(ln A) = ln(det A)
Worked Example
Let's calculate the principal matrix logarithm for a specific 2×2 SPD matrix:
A = [ 3 1 ] [ 1 3 ]
- Check SPD condition:
det(A) = 3(3) - 1(1) = 8 > 0, and A11 = 3 > 0. Thus, A is SPD. - Find eigenvalues:
The characteristic polynomial is λ2 - tr(A)λ + det(A) = 0.
λ2 - 6λ + 8 = 0
(λ - 2)(λ - 4) = 0
So, λ1 = 2, λ2 = 4. Both are positive, confirming SPD. - Compute spectral projectors:
P1 = (A - 4I) / (2 - 4) = [ -1 1; 1 -1 ] / -2 = [ 0.5 -0.5; -0.5 0.5 ]
P2 = (A - 2I) / (4 - 2) = [ 1 1; 1 1 ] / 2 = [ 0.5 0.5; 0.5 0.5 ] - Compute matrix logarithm:
L = ln(2) * P1 + ln(4) * P2
L = ln(2) * [ 0.5 -0.5; -0.5 0.5 ] + 2*ln(2) * [ 0.5 0.5; 0.5 0.5 ]
L = [ 1.5*ln(2) 0.5*ln(2) ]
[ 0.5*ln(2) 1.5*ln(2) ]
L ≈ [ 1.0397207708 0.3465735903 ]
[ 0.3465735903 1.0397207708 ] - Verify Trace/Determinant Identity:
tr(L) = 3*ln(2) ≈ 2.07944154168
ln(det A) = ln(8) = ln(23) = 3*ln(2) ≈ 2.07944154168
Interactive Experiment
You can visualize this exact mapping and test boundaries in the real module:
https://riano.app/module/matrix-logarithm
- Set A11 to 3, A22 to 3, and A12 to 1. The interface confirms "SPD logarithm defined".
- Observe the computed logarithm matrix L entries matching our worked example.
- Observe the actual reconstruction row-sum residual ‖exp(L) − A‖∞, calculated by exponentiating L rather than copying A.
- Set A12 to 0. The eigenvalues become 3 and 3, representing a repeated eigenvalue branch. The off-diagonal entries of L become exactly 0.
- Set A22 to 0. The matrix A becomes singular (determinant = 0), and the module correctly identifies this as "Outside SPD logarithm domain".
Limitations
This explorer focuses exclusively on the principal real logarithm of symmetric positive-definite matrices. Singular matrices (determinant zero) have no logarithm because ln(0) is undefined. Indefinite matrices (with negative eigenvalues) or non-symmetric matrices may have complex logarithms or multiple branches, which fall outside the domain of this specific real principal-log implementation.
References
SciPy linalg.logm Documentation
Official manual for the matrix logarithm, describing the inverse relation to expm and matrix function concepts. Our implementation explicitly narrows the domain to real SPD matrices.
Experience it interactively
Adjust parameters, observe in real time, and build deep intuition with Riano’s interactive Symmetric Positive-Definite Matrix Logarithm module.
Try Symmetric Positive-Definite Matrix Logarithm on Riano →