Jordan Form and Mathematica

Now that you get the idea, here's some good news: Mathematica can do this!

In[56]:=

  ?JordanDecomposition

  JordanDecomposition[A] returns { S, J }, where A = S . J .
Inverse[S] and J is the Jordan canonical form of A. All
entries of A must have infinite precision.

In[57]:=

  MatrixForm[A]
  MatrixForm[JA]

Out[57]=

  1    1    -1
  
  0    0    2
  
  0    -1   3

Out[58]=

  1   1   0
  
  0   1   0
  
  0   0   2

In[59]:=

  {s1,j1}=JordanDecomposition[A]

Out[59]=

  {{{1, 0, 0}, {0, 2, 1}, {0, 1, 1}}, 
   
    {{1, 1, 0}, {0, 1, 0}, {0, 0, 2}}}

In[60]:=

  MatrixForm[Inverse[s1].A.s1]
  MatrixForm[j1]

Out[60]=

  1   1   0
  
  0   1   0
  
  0   0   2

Out[61]=

  1   1   0
  
  0   1   0
  
  0   0   2

In[62]:=

  MatrixForm[B]
  MatrixForm[JB]

Out[62]=

  2    -1   2    0
  
  0    3    -1   0
  
  0    1    1    0
  
  0    1    -3   5

Out[63]=

  2   1   0   0
  
  0   2   1   0
  
  0   0   2   0
  
  0   0   0   5

In[64]:=

  {s2,j2}=JordanDecomposition[B]

Out[64]=

                                                  2  5
  {{{1, 0, 0, 0}, {0, 1, 2, 0}, {0, 1, 1, 0}, {0, -, -, 1}}, 
                                                  3  9
   
    {{2, 1, 0, 0}, {0, 2, 1, 0}, {0, 0, 2, 0}, {0, 0, 0, 5}}}

In[65]:=

  MatrixForm[Inverse[s2].B.s2]
  MatrixForm[j2]

Out[65]=

  2   1   0   0
  
  0   2   1   0
  
  0   0   2   0
  
  0   0   0   5

Out[66]=

  2   1   0   0
  
  0   2   1   0
  
  0   0   2   0
  
  0   0   0   5

In[67]:=

  MatrixForm[a]
  MatrixForm[Ja]

Out[67]=

  2    -4   2    2
  
  -2   0    1    3
  
  -2   -2   3    3
  
  -2   -6   3    7

Out[68]=

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

In[69]:=

  {s3,j3}=JordanDecomposition[a]

Out[69]=

  {{{2, 0, 0, 1}, {1, 1, 1, -1}, {0, 2, 1, -1}, 
   
     {2, 0, 1, 0}}, {{2, 0, 0, 0}, {0, 2, 0, 0}, 
   
     {0, 0, 4, 1}, {0, 0, 0, 4}}}

In[70]:=

  MatrixForm[Inverse[s3].a.s3]
  MatrixForm[j3]

Out[70]=

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

Out[71]=

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

Why is this slightly different? It is simply because of the ordering of the columns in S (or s3 here). Let's rearrange s3.

In[72]:=

  MatrixForm[s3]

Out[72]=

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

In[73]:=

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

Out[73]=

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

In[74]:=

  MatrixForm[Inverse[newS].a.newS]

Out[74]=

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

Up to Jordan Canonical Form