Creating matrices to do the desired operations on other matrices.

Here is the general principle.

To do any operation with the rows of a matrix [Maple Math] with [Maple Math] rows and [Maple Math] columns, we start with the identity matrix of size [Maple Math] , eye(n) (or [Maple Math] or just [Maple Math] if the [Maple Math] is understood) and do the desired operation to it. Then multiply the resulting matrix to [Maple Math] on the left .

If you wish to do a similar thing to the columns, then you work on the columns of a suitable identity matrix and multiply on the right .

For example : find the third row of a 5 X 5 matrix.

> ans[3]:=row(eye(5),3);

[Maple Math]

> M:=randmatrix(5,5,entries=rand(0..10));evalm(ans[3]&*M);

[Maple Math]

[Maple Math]

To find the sum of the first three rows, you can do:

> evalm(row(eye(5),1)&*M+row(eye(5),2)&*M+row(eye(5),3)&*M);

[Maple Math]

To rotate the entries of a row of 4 numbers [Maple Math] . We think of this as permuting the four columns.

> A:=eye(4);RA:=augment(col(A,2),col(A,3),col(A,4),col(A,1));

[Maple Math]

[Maple Math]

> evalm([x,y,z,w]&*RA);

>

[Maple Math]

Note the multiplication on the right! It is crucial to multiply on the correct side.

As an exercise, find matrices [Maple Math] such that for every 5 X 5 matrix [Maple Math] , we have that [Maple Math] gives the sum of all entries of [Maple Math] . Why do you need two matrices to do the job ?