Advanced maths

Principal matrix logarithm calculator for positive definite matrices

Compute the real principal logarithm of a symmetric positive-definite matrix, with eigenvalue checks and exp(log(A)) reconstruction.

Your numbers

One rational row per line, comma-separated; at most 6 rows and columns.

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

The matrix logarithm is an inverse of the matrix exponential, not a logarithm applied independently to every entry. This page restricts the domain to real symmetric positive-definite matrices, where the principal logarithm is real and symmetric and the positive eigenvalues select a clear branch. A numerical symmetric eigendecomposition applies the scalar logarithm to eigenvalues and reconstructs the matrix function. Exact rational symmetry is checked first, and the final exponential reconstruction is compared with the original matrix.

THE FORMULAA=Vdiag(λᵢ)Vᵀ, λᵢ>0; log(A)=Vdiag(log λᵢ)Vᵀ and exp(log(A))=A.

A worked example

A=((2,1),(1,2)) has eigenvalues three and one, with orthogonal directions (1,1) and (1,−1). Its principal logarithm has every entry equal to log(3)/2, approximately 0.5493061443. Exponentiating this full matrix returns A. Taking entrywise logs would instead produce diagonal log(2) and off-diagonal zero, a different matrix whose exponential does not recover the original off-diagonal entries. The identity matrix has matrix logarithm zero.

Good to know

Exactly symmetric rational square matrices of order one through six. Every eigenvalue must exceed 10^−12 times the spectral scale; zero, negative and numerically ill-conditioned eigenvalues are rejected. Factors are numerical approximations, and reconstruction must satisfy relative tolerance 10^−9. This page supports only the real principal SPD branch, not a general nonsymmetric logarithm, complex branches or entrywise logarithms. Decimal inputs are interpreted as exact rational values.

Eigenvalue functions act along matrix directions

A symmetric matrix has an orthonormal eigenbasis. Applying a scalar function to each eigenvalue while keeping that basis defines its spectral matrix function. Repeated eigenvalues cause no ambiguity: any orthonormal basis of their eigenspace gives the same reconstructed logarithm. The off-diagonal entries of log(A) reflect the orientation of the eigenvectors and can be nonzero even when a careless entrywise operation would suppress them.

Positive definiteness is stronger than positive diagonal entries. A symmetric matrix can have positive entries on its diagonal and still have a negative eigenvalue. The solver checks the full eigensystem and rejects any nonpositive spectral value. Its numerical threshold also excludes matrices too close to the boundary for reliable logarithms, because the derivative of the scalar logarithm becomes large near zero. This is a conditioning limit rather than a general theorem that tiny positive eigenvalues are invalid.

The matrix logarithm applies logarithms to eigenvalues rather than entriesEigenvalue: 3Eigenvalue: 1log(3)log(1) = 0log(A) = ½ log(3) × ((1,1),(1,1))exp(log(A)) = A
For A=((2,1),(1,2)), eigenvalues three and one become log(3) and zero. Reconstructing in the orthonormal eigenbasis makes all four log(A) entries equal to log(3)/2, and exponentiation returns A.

The principal branch is a declared restriction

General matrix logarithms can be nonunique, complex or unavailable over the reals. Restricting to symmetric positive-definite input avoids those branch choices and yields the unique symmetric real logarithm. It does not make claims about every nonsymmetric matrix with positive determinant. Similarly, log(A+B) is not generally log(A)+log(B), and product identities require additional commuting and branch assumptions; scalar shortcuts do not automatically transfer to matrices.

The output includes the exponential reconstruction and a relative residual, not just eigenvalues or a success label. Independent tests compare against another logarithm implementation and the site’s existing matrix exponential. The Matrix exponential calculator e^(At) performs the forward map and can accept a wider family. This page solves its branch-restricted inverse and explains why a stable positive spectrum is part of the supported input contract.

A few questions, answered

Can I enter a positive semidefinite matrix?

Not if it has a zero eigenvalue. The scalar logarithm at zero is not finite, so the supported matrix logarithm requires strict positive definiteness.

Why can log(A) have negative entries?

The logarithm acts on eigenvalues and is reconstructed in the original basis. Positive eigenvalues below one have negative logarithms, and off-diagonal signs depend on the eigenvectors.

Find your calculator

Start typing to explore the library.