The Identity for Matrix Multiplication

The Identity for matrix multiplication is a matrix of zeros, with ones on the diagonal. In order to make a functional operator which does this, we need an "if" statement. The syntax is as follows.

> f:=(m,n)->if (m=n) then 1 else 0 fi;

[Maple Math]

Note that the "if" statement must end with a "fi", which is a backwards "if".

Now let's use this to make a 10 by 10 identity matrix and call it "I10":

> I10:=matrix(10,10,f);

[Maple Math]

Let's also make a 10 by 10 matrix containing random integers from 1 to 10. This can be done with Maple's "rand" function as follows:

> g:=rand(1..10);

[Maple Math]

> G:=matrix(10,10,g);

[Maple Math]

Let's check the multiplicative identity from the left:

> evalm(G&*I10);

[Maple Math]

Let's also check the multiplicative identity from the right:

> evalm(I10&*G);

[Maple Math]

>