Problem set 9, exercise 2 using Mathematica

In what follows, I demonstrate how to do problem 2 from problem set 9 using Mathematica for all the symbolic manipulations.

First, we input our matrix (note that for display, we ALWAYS need to tell Mathematica that it actually is a matrix) (yes, Mathematica is dumb):

MatrixForm[M = {{w, x}, {y, z}}]

Next, we take powers (again, we need to tell Mathematica that it actually IS a matrix, and can't just type M^2, M^5). Output of M5 is surpressed, since it's really ugly.

MatrixForm[M2 = MatrixPower[M, 2]]

MatrixForm[M5 = MatrixPower[M, 5]];

Now we convert the matrices into linear lists; this corresponds to the isomorphism R^(2x2) -> R^4. That is, now M2F, M5F are the values of maps from R^4 -> R^4.

MF = Flatten[M];

M2F = Flatten[M2];

M5F = Flatten[M5];

Now we do the work; Dt gives the total derivative, where we need to set the other variables to be constants (otherwise Mathematica assumes that x,y,z are functions of w, for instance. Note that Mathematica doesn't seems to be able to compute a symbolic Jacobian, so I need to make a list out of the terms by saying: let the i,j-th entry be the j-th derivative of the i-th entry. Again, we need to use MatrixForm.

MatrixForm[
      Table[Dt[M2F[[i]], MF[[j]], 
          Constants -> Complement[MF, {MF[[j]]}]], {i, 1, 4}, {j, 1, 
          4}]]

Here we substitute in w=a,x=0, etc.

MatrixForm[% /. {w -> a, x -> 0, y -> 0, 
          z -> b}]

We now repeat the above for M5.

MatrixForm[
        Table[Dt[M5F[[i]], MF[[j]], 
            Constants -> Complement[MF, {MF[[j]]}]], {i, 1, 4}, {j, 
            1, 4}]];

The one change is that we need to tell Mathematica to expand out the entries of the resulting matrix (er, I mean list in MatrixForm).

MatrixForm[
      Map[Expand, % /. {w -> a, x -> 0, y -> 0, 
            z -> b}]]

Now that we have the Jacobians in a nice, diagonal form, it's easy to tell when it is invertible.