Problem12:Find the inverse of each of the following matrices, where a,b,c,d, and e are all nonzero, 
> ;
[a 0 0 0] [ ] [0 b 0 0] A := [ ] [0 0 c 0] [ ] [0 0 0 d] [0 0 0 a] [ ] [0 0 b 0] B := [ ] [0 c 0 0] [ ] [d 0 0 0] [e 0 0 0] [ ] [1 e 0 0] C := [ ] [0 1 e 0] [ ] [0 0 1 e]

Well if you have maple you can just do it!
First enter the matrices to maple. 
> A := diag(a,b,c,d): B:=matrix(4,4,[0,0,0,a,0,0,b,0,0,c,0,0,d,0,0,0]):
> D1 := matrix(2,2,[e,0,1,e]); Z := matrix(2,2,0); G :=matrix(2,2,[0,1,0,0]);
[e 0] D1 := [ ] [1 e] [0 0] Z := [ ] [0 0] [0 1] G := [ ] [0 0]> C := blockmatrix(2,2,[D1,Z,G,D1]);
[e 0 0 0] [ ] [1 e 0 0] C := [ ] [0 1 e 0] [ ] [0 0 1 e]
Notice the cool way to enter A, Z, and C into maple!
Now compute the inverses. Here are three different ways: 
> Ainv := inverse(A);
[1/a 0 0 0 ] [ ] [ 0 1/b 0 0 ] Ainv := [ ] [ 0 0 1/c 0 ] [ ] [ 0 0 0 1/d]> Binv := evalm(1/B);
[ 0 0 0 1/d] [ ] [ 0 0 1/c 0 ] Binv := [ ] [ 0 1/b 0 0 ] [ ] [1/a 0 0 0 ]> Cinv := evalm(C^(1));
[ 1/e 0 0 0 ] [ ] [ 1 ] [  1/e 0 0 ] [ 2 ] [ e ] [ ] Cinv := [ 1 1 ] [    1/e 0 ] [ 3 2 ] [ e e ] [ ] [ 1 1 1 ] [     1/e] [ 4 3 2 ] [ e e e ]
But that's not the point!!
Let's get these inverses by using what we know about matrix
multiplication.

Notice that A can be obtained from the 4x4 identity by multiplying the first row by a, the second row by b, the third by c and the last by d. Let's denote by E1,E2,E3,E4 the elemtary matrices of those elementary row operations. We can then write: 
> ;
A = E4 E3 E2 E1 I
now to compute the inverse of A we can use the theorem that says that the inverse of a product of matrices is the product of the inverses in reverse order. Thus, 
> ;
1 A = F1 F2 F3 F4
where the F's are the inverses of the E's. The operation that
reverses multiplication of a row by a number is division by the same
number i.e. multiplication of the same row by one over the number.
Thus, the last formula says that the inverse of A is obtained by
dividing the last row of the 4x4 identity by d, dividing the third
row by c etc... Exactly what we got as Ainv above.
Notice that there is really nothing special about 4x4 matrices.
By the same reasoning we can see that the inverse of any nxn
diagonal matrix will exist provided that none of the diagonal
entries are zero. The inverse is then the diagonal matrix of
the inverses.

Notice that the matrix B is obtained from the 4x4 identity by first getting A (as before) and then swapping column 1 with colum 4 then swapping column 2 with column 3. It is easy to check that elementary column operations are done by POSTmultiplying by elementary matrices. We can then write: 
> ;
B = E4 E3 E2 E1 I G1 G2
where G1 and G2 are the elementary matrices that perform the swapping of columns. If we recall the the inverses of the G's are the same G's, we have, 
> ;
1 B = G2 G1 F1 F2 F3 F4
and this last equation says that the inverse of B can be obtained
by swapping rows 1 and 4 and rows 2 and 3 of the inverse of A. Notice,
that we need to swap rows and not columns since the G's are now PRE
multiplying the F's.

It is not obvious how to write C as a product of elementary
matrices. We know, however, that if C has an inverse then (and only then)
it can be written as a product of elem. matrices. The way to find
these elem. matrices is to perform elem. row operations on C until we
get the identity.
Let us suppose that it takes k elem. row operations to take C into the 4x4 identity matrix I4. Let us write the corresponding elementary matrices by E1,E3,..., Ek (don't get confused with the E's above....). We can then write: 
> ;
Ek ... E2 E1 C = I4
this shows that the inverse of C is the product (Ek...E2 E1). A standard algorithm for keeping track of this product (and therefore get the inverse of C at the end) is to perform the elementary row operations not just on C but on C augmented by I4, i.e. on 
> C_I4 := augment(C,diag(1,1,1,1));
[e 0 0 0 1 0 0 0] [ ] [1 e 0 0 0 1 0 0] C_I4 := [ ] [0 1 e 0 0 0 1 0] [ ] [0 0 1 e 0 0 0 1]
bring this augmented matrix into rref (reduced row echelon form) to obtain I4 augmented with the inverse of C. Watch, 
> rref(C_I4);
[1 0 0 0 1/e 0 0 0 ] [ ] [ 1 ] [0 1 0 0   1/e 0 0 ] [ 2 ] [ e ] [ ] [ 1 1 ] [0 0 1 0    1/e 0 ] [ 3 2 ] [ e e ] [ ] [ 1 1 1 ] [0 0 0 1      1/e] [ 4 3 2 ] [ e e e ]
the right hand 4x4 block matrix is just the product (Ek...E2 E1)
which is the inverse of C.
Extra: can you find the E's explicitly? 