# 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 allclose all

## Basic Examples(4)

Square a symbolic matrix:

This is :

Square the inverse of a symbolic matrix:

This is :

Raise a matrix to the 10th power:

Notice that this is different from raising each entry to the 10th power:

Compute a symbolic matrix power:

## Scope(12)

### Basic Uses(7)

Raise a machine-precision matrix to a positive integer power:

Raise it to a fractional power:

Square a complex matrix:

Raise an exact matrix to an integer power:

Raise it to a fractional power:

Raise an arbitrary-precision matrix to a negative integer power:

Raise it to an irrational power:

Raise a symbolic matrix to an integer power:

Raise a matrix to a symbolic power:

Raising large machine-precision matrices to a power is efficient:

Directly applying the power to a single vector is even more efficient:

### Special Matrices(5)

The result of raising a sparse matrix to a positive integer power is returned as a sparse matrix:

Format the result:

Raising a sparse matrix to a other powers will typically produce a normal matrix:

Directly apply the power of of a sparse matrix to a sparse vector:

Raising a structured array to a power will be returned as a structured array if possible:

This is not always possible:

IdentityMatrix raised to any power is itself:

More generally, the power of any diagonal matrix is the power of its diagonal elements:

Raise HilbertMatrix to a negative power:

## Applications(5)

Find the fundamental solution for the constant coefficient system of difference equations :

Define fundamental solution using MatrixPower:

Show that it satisfies the equation:

It satisfies the initial condition for a fundamental solution:

Find the matrix exponential for a matrix without a full set of eigenvectors:

Compute the exponential as the power series for each term:

Construct a rotation matrix as a limit of repeated infinitesimal transformations:

Inverse power iteration for the smallest eigenvalue of a sparse positive definite matrix:

Check the error in m.v-val v:

Shifted inverse power iteration for the largest eigenvalue:

Check the error in m.v-val v:

An easy way to evaluate a matrix polynomial:

Evaluate a characteristic polynomial:

## Properties & Relations(10)

For a positive integer power , MatrixPower[m,n] is equivalent to ( times):

Write the formula more compactly with Apply (@@):

For a negative integer power , MatrixPower[m,-n] is equivalent to ( times):

Write the formula more compactly with Apply:

In particular, negative matrix powers are not defined for singular matrices: For a nonsingular matrix m, MatrixPower[m,0] is the identity matrix:

If m is nonsingular, MatrixPower[m, n].MatrixPower[m,-n] is the identity:

For noninteger powers, MatrixPower effectively uses the power series, with Power replaced by MatrixPower:

Equivalently, MatrixPower is MatrixFunction applied to the appropriate function for the power:

The matrix power of a diagonal matrix is a diagonal matrix with the diagonal entries raised to that power:

For any power and diagonalizable matrix , MatrixPower[m,s] equals :

Use JordanDecomposition to find a diagonalization:

Confirm the identity:

For a real symmetric matrix s and integer power n, MatrixPower[s,n] is also real and symmetric:

The analogous statement is true for Hermitian matrices:

For am orthogonal matrix o and any power s, MatrixPower[o,s] is also orthogonal:

The analogous statement is true for unitary matrices: can be computed from the JordanDecomposition as :

Moreover, is zero except in upper-triangular blocks delineated by s in the superdiagonal: