MatrixPower[m,n]
gives the n
matrix power of the matrix m.
MatrixPower[m,n,v]
gives the n
matrix power of the matrix m applied to the vector v.
MatrixPower
MatrixPower[m,n]
gives the n
matrix power of the matrix m.
MatrixPower[m,n,v]
gives the n
matrix power of the matrix m applied to the vector v.
Details and Options
- MatrixPower[m,n] effectively evaluates the product of a matrix with itself n times. »
- When n is negative, MatrixPower finds powers of the inverse of the matrix m. »
- When n is not an integer, MatrixPower effectively evaluates the power series for the function, with ordinary powers replaced by matrix powers. »
- MatrixPower works only on square matrices.
Examples
open all close allBasic Examples (4)
m = (| | |
| - | - |
| a | b |
| c | d |);MatrixPower[m, 2]//MatrixForm% == m.mSquare the inverse of a symbolic matrix:
m = (| | |
| - | - |
| a | b |
| c | d |);MatrixPower[m, -2]//Simplify//MatrixForm% == Inverse[m].Inverse[m]//SimplifyRaise a matrix to the 10th power:
MatrixPower[{{1, 1}, {1, 2}}, 10]Notice that this is different from raising each entry to the 10th power:
{{1, 1}, {1, 2}} ^ 10Compute a symbolic matrix power:
MatrixPower[{{0, 0, 1}, {0, 2, 0}, {-1, 0, 0}}, n]Scope (15)
Basic Uses (9)
Raise a machine-precision matrix to a positive integer power:
MatrixPower[{{1.2, 2.5, -3.2}, {0.7, -9.4, 5.8}, {-0.2, 0.3, 6.4}}, 5]Raise it to a fractional power:
MatrixPower[{{1.2, 2.5, -3.2}, {0.7, -9.4, 5.8}, {-0.2, 0.3, 6.4}}, 3 / 2]MatrixPower[{{1. + I, 2, 3 - 2 I}, {0, 4 π, 5I}, {E, 0, 6}}, 2]//MatrixFormRaise an exact matrix to an integer power:
MatrixPower[{{2, 3, 0}, {4, 9, 0}, {0, 0, 4}}, 14]//MatrixFormRaise it to a fractional power:
MatrixPower[{{2, 3, 0}, {4, 9, 0}, {0, 0, 4}}, -3 / 2]//MatrixFormRaise an arbitrary-precision matrix to a negative integer power:
m = RandomReal[1, {2, 2}, WorkingPrecision -> 20]MatrixPower[m, -5]Raise it to an irrational power:
MatrixPower[m, Pi]Raise a symbolic matrix to an integer power:
MatrixPower[{{a, b}, {0, c}}, 4]Raise a matrix to a symbolic power:
MatrixPower[{{0, a}, {b, 0}}, n]Raising large machine-precision matrices to a power is efficient:
m = RandomReal[{0, 1}, {800, 800}];MatrixPower[m, 2]; //AbsoluteTimingDirectly applying the power to a single vector is even more efficient:
MatrixPower[m, 2, Range[800]]; //AbsoluteTimingRaise a matrix with finite field elements to an integer power:
ℱ = FiniteField[29, 4];
m = {{ℱ[12], ℱ[23], ℱ[34]}, {ℱ[45], ℱ[56], ℱ[67]}, {ℱ[78], ℱ[89], ℱ[90]}};
MatrixPower[m, 123456789]//MatrixFormMatrixPower[m, -987654321]//MatrixFormRaise a CenteredInterval matrix to an integer power:
(m = Map[CenteredInterval, RandomReal[{-10, 10}, {3, 3}, WorkingPrecision -> 10], {2}])//MatrixForm(mpow = MatrixPower[m, 17])//MatrixFormFind a random representative mrep of m:
ranrep[e_CenteredInterval] := e["Center"] + RandomInteger[{-1000, 1000}] / 1000 e["Radius"]
(mrep = Map[ranrep, m, {2}])//MatrixFormVerify that mpow contains MatrixPower[mrep,17]:
MapThread[IntervalMemberQ, {mpow, MatrixPower[mrep, 17]}, 2]//MatrixFormSpecial Matrices (6)
The result of raising a sparse matrix to a positive integer power is returned as a sparse matrix:
mat = SparseArray[{{1, 3} -> 1, {2, 2} -> 2, {3, 1} -> 3}, {3, 3}]MatrixPower[mat, 2]%//MatrixFormRaising a sparse matrix to a other powers will typically produce a normal matrix:
MatrixPower[mat, 2.5]Directly apply the power of of a sparse matrix to a sparse vector:
m = SparseArray[Band[{1, 2}] -> 2, {1000, 1000}]v = SparseArray[{{1} -> 1, {-1} -> -1.5}, {1000}]MatrixPower[m, 4, v]//ShortRaising a structured array to a power will be returned as a structured array if possible:
QuantityArray[{{1, 2}, {3, 4}}, "Meters"]MatrixPower[%, 2]SymmetrizedArray[{{1, 1} -> 3, {2, 2} -> 1, {3, 1} -> -5}, {3, 3}, Symmetric[All]]MatrixPower[%, -2]IdentityMatrix raised to any power is itself:
MatrixPower[IdentityMatrix[3], n]More generally, the power of any diagonal matrix is the power of its diagonal elements:
MatrixPower[DiagonalMatrix[{a, b, c}], n]Raise HilbertMatrix to a negative power:
MatrixPower[HilbertMatrix[2], -2]//MatrixFormCompute the ![]()
power of a
matrix of univariate polynomials of degree
:
rpoly[n_] := RandomInteger[{-2 ^ 10, 2 ^ 10}, {n + 1}].x ^ Range[0, n]
SeedRandom[1234];
m = Table[rpoly[100], {10}, {10}];MatrixPower[m, 20]//Short[#, 5]&//AbsoluteTimingApplications (5)
Find the fundamental solution for the constant coefficient system of difference equations
:
a = {{0, 1, 0}, {1, 0, 0}, {0, 1, 1}};Define fundamental solution
using MatrixPower:
ϕ[n_] = MatrixPower[a, n]Show that it satisfies the equation:
Simplify[ϕ[n + 1] == a.ϕ[n]]It satisfies the initial condition for a fundamental solution:
Simplify[ϕ[0] == IdentityMatrix[3]]Find the matrix exponential for a matrix without a full set of eigenvectors:
m = {{1, 1, 1, 1}, {0, 1, 1, 1}, {0, 0, 1, 1}, {0, 0, 0, 1}};mp = MatrixPower[m, n]Compute the exponential as the power series for each term:
Sum[(%/n!), {n, 0, ∞}]% == MatrixExp[m]Construct a rotation matrix as a limit of repeated infinitesimal transformations:
MatrixPower[{{1, θ / n}, {-θ / n, 1}}, n]Limit[%, n -> Infinity] // FullSimplifyInverse power iteration for the smallest eigenvalue of a sparse positive definite matrix:
n = 100;m = SparseArray[{{i_, i_} -> 2., {i_, j_} /; Abs[i - j] == 1 -> -1.}, {n, n}, 0.]v = Normalize[MatrixPower[m, -20, RandomReal[1, n]]];
val = Norm[m.v]Norm[m.v - val v]Shifted inverse power iteration for the largest eigenvalue:
v = Normalize[MatrixPower[m - 4 MatrixPower[m, 0], -20, RandomReal[1, n]]];
val = Norm[m.v]Norm[m.v - val v]An easy way to evaluate a matrix polynomial:
mpe[p_, x_, m_] := Module[{cl = CoefficientList[p, x]},
Sum[MatrixPower[m, i - 1] cl[[i]], {i, Length[cl]}]]mpe[1 + 2 x + 3 x ^ 3, x, {{1, 2}, {3, 4}}]Evaluate a characteristic polynomial:
m = Reverse[IdentityMatrix[4]];p = CharacteristicPolynomial[m, x]mpe[p, x, m]Properties & Relations (10)
For a positive integer power
, MatrixPower[m,n] is equivalent to
(
times):
m = {{1, 2}, {π, .5}};
MatrixPower[m, 3] == m.m.mWrite the formula more compactly with Apply (@@):
MatrixPower[m, 100] == Dot@@ConstantArray[m, {100}]For a negative integer power
, MatrixPower[m,-n] is equivalent to
(
times):
m = {{1, 2}, {π, .5}};
MatrixPower[m, -3] == Inverse[m].Inverse[m].Inverse[m]Write the formula more compactly with Apply:
MatrixPower[m, -100] == Dot@@ConstantArray[Inverse[m], {100}]In particular, negative matrix powers are not defined for singular matrices:
MatrixPower[{{1, 2}, {0, 0}}, -1]For a nonsingular matrix m, MatrixPower[m,0] is the identity matrix:
m = {{1, 2}, {3, 4}};Det[m]MatrixPower[m, 0]//MatrixFormIf m is nonsingular, MatrixPower[m, n].MatrixPower[m,-n] is the identity:
m = RandomReal[1, {5, 5}];
n = RandomInteger[{1, 9}];Chop[MatrixPower[m, n].MatrixPower[m, -n]]//MatrixFormFor noninteger powers, MatrixPower effectively uses the power series, with Power replaced by MatrixPower:
a = {{1, -(1/6)}, {1, (1/6)}};MatrixPower[a, 1 / 2] == Sum[(Derivative[k][Sqrt][1]/k!) MatrixPower[a - IdentityMatrix[2], k], {k, 0, ∞}]Equivalently, MatrixPower is MatrixFunction applied to the appropriate function for the power:
MatrixPower[a, 1 / 2] == MatrixFunction[x |-> x^1 / 2, a]The matrix power of a diagonal matrix is a diagonal matrix with the diagonal entries raised to that power:
d = {1, 2, 3, 4};
s = 2 / 3;MatrixPower[DiagonalMatrix[d], s]DiagonalMatrix[d ^ s]For any power
and diagonalizable matrix
, MatrixPower[m,s] equals
:
m = {{1, 2}, {π, .5}};DiagonalizableMatrixQ[m]Use JordanDecomposition to find a diagonalization:
{v, d} = JordanDecomposition[m];m == v.d.Inverse[v]MatrixPower[m, 1 / 2]% == v.Sqrt[d].Inverse[v]For a real symmetric matrix s and integer power n, MatrixPower[s,n] is also real and symmetric:
s = {{1, 2}, {2, 1}};
{SymmetricMatrixQ[s], SymmetricMatrixQ[MatrixPower[s, -5]]}The analogous statement is true for Hermitian matrices:
h = {{1, 2 + 3 I}, {2 - 3 I, 4}};
{HermitianMatrixQ[h], HermitianMatrixQ[MatrixPower[h, 7]]}For am orthogonal matrix o and any power s, MatrixPower[o,s] is also orthogonal:
o = RotationMatrix[π / 6];
{OrthogonalMatrixQ[o], OrthogonalMatrixQ[MatrixPower[o, Sqrt[2]]]}The analogous statement is true for unitary matrices:
u = {{0, -I}, {I, 0}};
{UnitaryMatrixQ[u], UnitaryMatrixQ[MatrixPower[u, -π]]}
can be computed from the JordanDecomposition
as
:
m = {{2, 0, 0, 0}, {0, 1, 0, 0}, {1, -1, 1, 0}, {1, -1, 1, 1}};
{v, j} = JordanDecomposition[m];
MatrixPower[m, -1 / 2] == v.MatrixPower[j, -1 / 2].Inverse[v]Moreover,
is zero except in upper-triangular blocks delineated by
s in the superdiagonal:
MatrixForm /@ {j, MatrixPower[j, -1 / 2]}See Also
Dot MatrixExp LinearSolve MatrixFunction
Function Repository: MatrixPolynomial MatrixGeometricMean
Tech Notes
Related Guides
Related Links
History
Introduced in 1991 (2.0) | Updated in 2003 (5.0) ▪ 2007 (6.0) ▪ 2014 (10.0) ▪ 2022 (13.2) ▪ 2024 (14.0)
Text
Wolfram Research (1991), MatrixPower, Wolfram Language function, https://reference.wolfram.com/language/ref/MatrixPower.html (updated 2024).
CMS
Wolfram Language. 1991. "MatrixPower." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/MatrixPower.html.
APA
Wolfram Language. (1991). MatrixPower. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MatrixPower.html
BibTeX
@misc{reference.wolfram_2026_matrixpower, author="Wolfram Research", title="{MatrixPower}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/MatrixPower.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_matrixpower, organization={Wolfram Research}, title={MatrixPower}, year={2024}, url={https://reference.wolfram.com/language/ref/MatrixPower.html}, note=[Accessed: 13-June-2026]}