MatrixLog[m]
gives the matrix logarithm of a matrix m.
MatrixLog
MatrixLog[m]
gives the matrix logarithm of a matrix m.
Details and Options
- MatrixLog is effectively the functional inverse of MatrixExp, so that MatrixExp[MatrixLog[m]] is m for a nonsingular matrix.
- MatrixLog works only on square nonsingular matrices.
- MatrixLog works on SparseArray objects and structured arrays.
- The following option can be given:
-
Method Automatic method to use - Possible values for the option Method include:
-
Automatic automatic selection "Jordan" Jordan decomposition "Schur" Schur decomposition for inexact numerical matrices "SpectralBasis" spectral method for exact matrices » - The default setting of Method->Automatic uses the Schur decomposition for inexact numerical matrices and, based on matrix contents, selects between the Jordan method and the spectral basis method for exact and symbolic matrices.
- The "Schur" method can also be specified by Method->{"Schur",Tolerance->tol}, where eigenvalues with a relative magnitude less than tol are effectively considered as 0 so that the matrix is considered as singular. Use Tolerance->0 to allow any nonzero eigenvalue, no matter how small.
Examples
open all close allBasic Examples (1)
Scope (4)
Use exact arithmetic to compute the matrix logarithm:
m = {{1, 1 / 2, 1 / 3, 1 / 4}, {0, 1, 1 / 3, 1 / 4}, {0, 0, 1, 1 / 4}, {0, 0, 0, 1}};MatrixLog[m]//MatrixFormMatrixLog[N[m]]//MatrixFormUse 24-digit-precision arithmetic:
MatrixLog[N[m, 24]]Compute a matrix logarithm of a complex matrix:
m = RandomComplex[1 + I, {3, 3}];MatrixLog[m]//MatrixFormA matrix logarithm of a symbolic matrix:
m = {{E, 0, 0}, {0, 4 E, -4 E}, {0, 4 E, 4 E}};MatrixLog[m t]//FullSimplify[#, t > 0]&//MatrixFormA matrix logarithm of a sparse 10×10 matrix applied to a vector:
MatrixLog[SparseArray[{Band[{1, 1}] -> 2, Band[{1, 2}] -> -1}, {10, 10}]].Range[10]Options (4)
Method (4)
The method "Jordan" can work with exact and inexact matrices:
MatrixLog[{{2, 1}, {3, 2}}, Method -> "Jordan"]//SimplifyMatrixLog[{{2., 1.}, {3., 2.}}, Method -> "Jordan"]//ChopThe method "Schur" works only with inexact matrices:
MatrixLog[{{2, 1}, {3, 2}}, Method -> "Schur"]MatrixLog[{{2., 1.}, {3., 2.}}, Method -> "Schur"]//ChopEigenvalues with relatively very small magnitude are treated as zero:
m = {{10.^10, 10.}, {0., 2 10.^-4}};
MatrixLog[m]Use Tolerance->0 to include nonzero eigenvalues of any magnitude:
MatrixLog[m, Method -> {"Schur", Tolerance -> 0}]When it is applicable, "SpectralBasis" can be orders of magnitude faster than "Jordan":
mat = {{0, 0, 0, -2, -2, 0, 2, -1}, {0, -2, 4, 2, -2, 2, 5, 2}, {4, 0, 0, 2, 4, -3, -2, 6}, {-2, -2, 2, -2, -1, -4, 0, 2}, {0, -2, 2, -1, 0, 2, -2, -2}, {0, -4, 1, 2, -2, 2, -4, 0}, {0, 1, 0, 0, 2, 0, -4, 0}, {-1, 0, -2, 0, 0, 0, -4, -2}};
AbsoluteTiming[mexp1 = MatrixLog[mat, Method -> "SpectralBasis"];]AbsoluteTiming[mexp2 = MatrixLog[mat, Method -> "Jordan"];]It can also produce much simpler results:
AbsoluteTiming[LeafCount[mexp1]]AbsoluteTiming[LeafCount[mexp2]]The two results are equal, however:
AbsoluteTiming[Chop[N[mexp1 - mexp2]]]The method is chosen automatically for matrices of exact numbers, where it excels:
MatrixQ[mat, NumberQ] && Precision[mat] == Infinity && mexp1 === MatrixLog[mat]Applications (1)
Given the vectors
,
and a number
, compute the matrix
for which
:
n = 10;
h = 1 / 10;
z = NestList[RotateLeft, Range[n], n]//N;
TableForm[{z}, TableHeadings -> {None, Range[0, n]}]Form the matrices
and
to compute the matrix
such that
:
s = Take[z, {1, -2}];
w = Take[z, {2, -1}];
A = MatrixLog[w.Inverse[s]] / h;Check that applying the matrix
iteratively starting with
generates the rest of the vectors
:
res = NestList[MatrixExp[A h].#&, z[[1]], n]//Chop;
TableForm[{res}, TableHeadings -> {None, Range[0, n]}]Properties & Relations (2)
If m is a nonsingular numeric matrix, then MatrixExp[MatrixLog[m]] is effectively equal to m:
m = {{0, 0, 1}, {0, 2, 0}, {-1, 0, 0}};
mm = MatrixExp[MatrixLog[m]];
m == mmBut it is not always true for symbolic matrices:
m = {{0, t}, {-t, -2 t}};
MatrixExp[MatrixLog[m]]The identity
does not hold in general:
m = {{6, 0, 10}, {0, 20, 0}, {-2, 0, 0}};
mm = MatrixLog[MatrixExp[m]]//Simplify;
m - mm//FullSimplifyIf a matrix is positive definite, then the identity
holds:
m = {{2, 0, 5}, {0, 1 / 2, 0}, {-1, 0, 7}};
mm = MatrixLog[MatrixExp[m]]//Simplify;
m - mm//FullSimplifyEigenvalues[m]//NPossible Issues (1)
MatrixLog does not work with singular matrices:
MatrixLog[{{0, 0, 1}, {0, 0, 0}, {-1, 0, 0}}]MatrixLog[{{0., 0., 1.}, {0., 0., 0.}, {-1., 0., 0.}}]Related Guides
Text
Wolfram Research (2012), MatrixLog, Wolfram Language function, https://reference.wolfram.com/language/ref/MatrixLog.html (updated 2026).
CMS
Wolfram Language. 2012. "MatrixLog." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2026. https://reference.wolfram.com/language/ref/MatrixLog.html.
APA
Wolfram Language. (2012). MatrixLog. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MatrixLog.html
BibTeX
@misc{reference.wolfram_2026_matrixlog, author="Wolfram Research", title="{MatrixLog}", year="2026", howpublished="\url{https://reference.wolfram.com/language/ref/MatrixLog.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_matrixlog, organization={Wolfram Research}, title={MatrixLog}, year={2026}, url={https://reference.wolfram.com/language/ref/MatrixLog.html}, note=[Accessed: 12-June-2026]}