The matrix logarithm is the inverse of the matrix exponential: it is a matrix L such that exp(L) = A. This calculator targets a common practical case: a real 2×2 matrix A whose eigenvalues are real, positive, and distinct. Under those conditions, the (real) logarithm computed via eigen-decomposition is well-defined and typically matches the principal matrix logarithm (using the natural logarithm).
If A is invertible, a matrix logarithm is any matrix L satisfying:
The matrix logarithm is not unique in general. However, when A has no eigenvalues on the non-positive real axis and we choose the principal branch of the scalar logarithm, there is a unique principal logarithm. For this calculator, we narrow further to distinct positive real eigenvalues so the computation is straightforward and stays real.
Let
A = [[a, b], [c, d]].
The characteristic polynomial is:
λ² − t λ + Δ = 0, where
The eigenvalues are
λ₁,₂ = (t ± √(t² − 4Δ)) / 2.
If A is diagonalizable with eigen-decomposition:
A = V Λ V⁻¹, where Λ = diag(λ₁, λ₂),
then
log(A) = V log(Λ) V⁻¹, with log(Λ) = diag(log(λ₁), log(λ₂)).
This is valid (in real arithmetic) when λ₁ and λ₂ are positive real numbers and V is invertible (i.e., eigenvectors are linearly independent, which is guaranteed when eigenvalues are distinct).
Take
A = [[4, 1], [1, 3]].
Compute trace and determinant:
Discriminant: t² − 4Δ = 49 − 44 = 5, so √5 ≈ 2.2361.
Eigenvalues:
Both are positive and distinct, so the method applies. The calculator forms eigenvectors (columns of V), computes log(λ₁), log(λ₂), and reconstructs log(A) = V log(Λ) V⁻¹. The resulting log(A) will be a real 2×2 matrix; diagonals are around ~1.55 for this example (exact entries depend on reconstruction and rounding).
Consider A = [[-1, 0], [0, 2]]. The eigenvalues are −1 and 2. Because one eigenvalue is negative, the real natural logarithm is not defined for that eigenvalue, and a real-valued log(A) does not exist in the usual sense. A complex logarithm exists but is multi-valued due to branch choices (log(−1) = iπ + 2kπi). This calculator will warn and stop rather than returning a misleading result.
| Matrix type (2×2) | Eigenvalues | Will this calculator compute log(A)? | Notes |
|---|---|---|---|
| Symmetric positive definite | Real, positive | Usually yes | Most reliable scenario; eigenvectors well-behaved in many cases. |
| Real with distinct positive eigenvalues | Real, positive, distinct | Yes | Diagonalizable; log(Λ) is real. |
| Repeated eigenvalue | Real, same value twice | Not reliably | May be diagonalizable or defective; this simplified method can be unstable or inapplicable. |
| Has a negative eigenvalue | One or more ≤ 0 | No | Real log generally not defined; complex log is branch-dependent. |
| Rotation-like / complex spectrum | Complex conjugate pair | No | Would require complex arithmetic and a branch choice. |
If you routinely need matrix logarithms outside these constraints (repeated eigenvalues, complex spectrum, larger matrices), use a full-featured numerical linear algebra package that implements a robust matrix logarithm algorithm (e.g., Schur decomposition-based methods) and supports complex arithmetic and branch control.