Matrix Powers

We have encountered matrix powers before:
A^2=A.A (remember, in Mathematica this is MatrixPower[A,2])
A^3=A.A.A
etc.
This can get messy. But what if we have a diagonal matrix?

In[4]:=

  d=DiagonalMatrix[{1,2,3,4}];
  MatrixForm[d]

Out[4]=

  1   0   0   0
  
  0   2   0   0
  
  0   0   3   0
  
  0   0   0   4

In[5]:=

  Table[MatrixPower[d,n],{n,4}];
  MatrixForm[%]

Out[5]=

  1     0     0     0
  0     2     0     0
  0     0     3     0
  0     0     0     4
  
  1     0     0     0
  0     4     0     0
  0     0     9     0
  0     0     0     16
  
  1     0     0     0
  0     8     0     0
  0     0     27    0
  0     0     0     64
  
  1     0     0     0
  0     16    0     0
  0     0     81    0
  0     0     0     256

Well, in your own words, how do you find the matrix power of a diagonal matrix?

Great. What if you do not have a diagonal matrix? If you can diagonalize the matrix, that is the next best thing. Consider this:
If A=S.D.Inverse[S], MatrixPower[A,2]=S.D.Inverse[S].S.D.Inverse[S]=S.D.D.Inverse[S]
=S.MatrixPower[D,2].Inverse[S].

In general, MatrixPower[A,n]=S.MatrixPower[D,n].Inverse[S].

Let's try it:

In[6]:=

  a={{1,-1,0},{-1,2,-1},{0,-1,1}};
  MatrixForm[a]

Out[6]=

  1    -1   0
  
  -1   2    -1
  
  0    -1   1

In[7]:=

  {evalues, m}=Eigensystem[a];
  s=Transpose[m];
  lambda=DiagonalMatrix[evalues];
  MatrixForm[a]
  MatrixForm[s.lambda.Inverse[s]]

Out[7]=

  1    -1   0
  
  -1   2    -1
  
  0    -1   1

Out[8]=

  1    -1   0
  
  -1   2    -1
  
  0    -1   1

In[9]:=

  MatrixForm[MatrixPower[a,4]]
  MatrixForm[s.MatrixPower[lambda,4].Inverse[s]]

Out[9]=

  14    -27   13
  
  -27   54    -27
  
  13    -27   14

Out[10]=

  14    -27   13
  
  -27   54    -27
  
  13    -27   14

As far as Mathematica is concerned, this is no big deal, but theoretically, and for hand calculations, this is wonderful, because powers of diagonal matrices are so easy to compute.

Up to Matrix Exponentials and Differential Equations