Matrix operations, a jump ahead

We begin by formally defining operations of matrices which will permit our equations to be meaningful. As stated above, our equations are to be thought of as [Maple Math] where, in our example, we have

> A:=matrix(3,3,[0,1,2,1,-1,3,2,1,11]),X=matrix(3,1,[x,y,z]),B=matrix(3,1,[1,3,1]);

[Maple Math]

Clearly, we want the quantity [Maple Math] to denote the column of the three left hand sides of the equations. This suggests that we define the matrix [Maple Math] times the column [Maple Math] as obtained by multiplying each row of [Maple Math] by the column [Maple Math] and stacking up the answers. Further each row times the column is obtained by multiplication of corresponding entries and adding up the result. Thus [Maple Math]

More generally a matrix [Maple Math] and a matrix [Maple Math] can be multiplied to produce [Maple Math] where each entry in the [Maple Math] -th row and [Maple Math] -th column of [Maple Math] is produced by multiplying the [Maple Math] -th row of [Maple Math] with the [Maple Math] -th column of [Maple Math] .

It is essential that the rows of [Maple Math] and columns of [Maple Math] have the same sizes. For example:

> U:=matrix(3,2,[1,2,3,4,5,6]):V:=matrix(2,2,[a,b,c,d]):
op(U),op(V),evalm(U&*V);

[Maple Math]

Here is a formal precise definition. Let [Maple Math] and [Maple Math] be the entries of the matrices [Maple Math] in the [Maple Math] -position. Then the entry in the [Maple Math] -position of the product [Maple Math] can be defined as [Maple Math] where it is understood that [Maple Math] has [Maple Math] columns and [Maple Math] has [Maple Math] rows. The entries [Maple Math] give the [Maple Math] -th row of [Maple Math] as [Maple Math] runs from [Maple Math] to [Maple Math] , while the entries [Maple Math] , give the [Maple Math] -th column of [Maple Math] .

There is another way of thinking of the product which is very useful. The matrix [Maple Math] can be thought of as three columns augmented together and each is a coefficient of one of the variables. So the equations become:

> A:=matrix(3,3,[0,1,2,1,-1,3,2,1,11]):B=matrix(3,1,[1,3,1]):

> x*submatrix(A,1..3,[1])+y*submatrix(A,1..3,[2])+z*submatrix(A,1..3,[3])=B;

[Maple Math]

>

Thus in general, we can think of the product [Maple Math] as giving the various combinations columns of [Maple Math] where the coefficients of each combination come from the entries of columns of [Maple Math] .

A similar explanation can be given as combinations of rows of [Maple Math] stacked together. Compare the example above.

All these views have useful applications.

The column combinations noted above, suggest a natural way to add matrices, namely add two matrices together, if they have the same sizes. The rule shall be to simply add the corresponding entries and arrange in the same shape.

Also, if we wish to multiply a matrix by a single number, it seems natural to multiply all entries by the same number. Thus, for example:

> L1:=matrix(2,2,[1,2,3,4]);L2:=matrix(2,2,[4,3,2,1]);

[Maple Math]

[Maple Math]

> `L1+L2`=evalm(L1+L2),`3L1`=evalm(3*L1),`2L1-3L2`=evalm(2*L1-3*L2);

[Maple Math]

>