Section 1.3

Matrices and their Algebra

Matrix Notation

A matrix is an ordered rectangular array of numbers, usually enclosed in parentheses or

square brackets.

> A:=matrix(3,4,[]): print(A);

The double subscripts are commonly used to indicate location of an entry in a matrix that is not

a row or column vector.

Algebra of Matrices

Equality of matrices

******************************************************************

Two matrices A and B are equal if their corresponding entries are equal.

******************************************************************

> A:=matrix(3,3): B:=matrix(3,3):

> evalm(A=B);

The set of real numbers is closed under addition; that is, the sum a + b of any two real

numbers a and b is a real number. The set of all mxn matrices is also closed under addition.

Example 1: Consider two matrices:

> A:=matrix(3,3): B:=matrix(3,3):

and their sum

> A+B=evalm(A+B);

>

Example 2: Consider two matrices:

> A:=matrix([[1, -2, 3, 4],[5, 6, 3, 4]]);

> B:=matrix([[7, 0, 9, 2],[2, -3, 1, -1]]);

and their sum

> A+B=evalm(A+B);

>

Example 3: Consider two matrices of different sizes

> A:=matrix([[4,1,2,7],[1,5,3,4]]); B:=matrix([[1,6,3],[5,6,8]]);

>

> A+B=evalm(A+B);

```Error, (in linalg[matadd]) matrix dimensions incompatible
```

>

***********************************************************

We can only add matrices of the same size. The resulting matrix is obtained by

adding the corresponding entries of the given matrices.

The set of all mxn matrices is, therefore, closed under the operation of addition. ************************************************************

Recall: the set of real numbers under addition satisfies the following the:

commutative property a + b = b + a;

associative property (a + b) + c = a + (b + c);

additive identity property a + 0 = a + 0 = a; and

additive inverse property a + -a = (-a) + a = 0.

The set of all mxn matrices also satisifies similar properties.

The zero matrix.

> Z := matrix(2,2,0);

**************************************************************

The set of all mxn matrices is closed under addition.

The commutative property holds: A + B = B + A

The associative property holds: (A + B) + C = A + (B + C)

The zero matrix Z is the identity element under addition: A + Z = Z + A = A

The additive inverse of the matrix A is - A: A + (-A) =(-A) + A = Z

***************************************************************

Multiplication by a Scalar

What is the effect of multiplying a matrix by a real scalar?

Example 4: Consider the matrix:

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

>

Multiply the matrix A by the scalar k

> k*A=evalm(k*A);

>

Example 5: Consider the matrix A

> A:=matrix([[1,2,3],[3,4,5],[5,7,9]]);

> k*A=evalm(k*A);

>

How do the entries of the matrix relate to the entries of matrix A?

*************************************************************

The multiplication of a matrix by a scalar results in a matrix whose entries

are obtained by multiplying each entry of the given matrix by the given scalar.

*************************************************************

Properties of multiplication by a scalar

******************************************

Scalar Multiplication Properties for Matrices

r(A+B) = rA + rB

(r+s)A = rA + sA

(rs)A = r(sA)

(rA)B = A(rB) = r(AB)

*****************************************

Matrix Multiplication

Example 6: Consider the matrices:

> A:=matrix([[4,1,2,7]]); B:=matrix([[1],[6],[3]]);

>

A is a 1x4 matrix and B is 3x1 matrix. Let us consider the two products and .

> BA:=multiply(B,A);

>

What does this tell us about product ? Product is a 3x4 matrix obtained by

multiplying a 3x1 matrix B and a 1x4 matrix A. What if we multiply A with B?

> AB=multiply(A,B);

```Error, (in multiply) non matching dimensions for vector/matrix product
```

>

In this case the product is not defined.

Example 7: Consider now the matrices:

> A:=matrix([[a1,a2,a3]]);
B:=matrix([[b1],[b2],[b3]]);

>

> AB=multiply(A,B);

>

The result is a real number.

***************************************************************

Let us raise some Questions :

Is matrix multiplication always well-defined?

Is the product of two matrices (whenever defined) a matrix?

Is product equal to product for any two matrices A and B?

*****************************************************************

How does this multiplication process work?

Example 8: Consider the two matrices:

> A:=matrix([[a11,a12,a13],[a21,a22,a23],
[a31,a32,a33]]);

> B:=matrix([[b11,b12],[b21,b22],[b31,b32]]);

and their product AB

> matrixmul(A,B);

`< type ; and press Enter to continue ?topic for help  exit; to quit >`

;

`Multiply row 1 of the matrix A and column 1 of the matrix B`

`to get the (1,1)-th entry of the product AB `

`< type ; and press Enter to continue ?topic for help  exit; to quit >`

;

`Multiply row 1 of the matrix A and column 2 of the matrix B`

`to get the (1,2)-th entry of the product AB `

`< type ; and press Enter to continue ?topic for help  exit; to quit >`

;

`Multiply row 2 of the matrix A and column 1 of the matrix B`

`to get the (2,1)-th entry of the product AB `

`< type ; and press Enter to continue ?topic for help  exit; to quit >`

;

`Multiply row 2 of the matrix A and column 2 of the matrix B`

`to get the (2,2)-th entry of the product AB `

`< type ; and press Enter to continue ?topic for help  exit; to quit >`

;

`Multiply row 3 of the matrix A and column 1 of the matrix B`

`to get the (3,1)-th entry of the product AB `

`< type ; and press Enter to continue ?topic for help  exit; to quit >`

;

`Multiply row 3 of the matrix A and column 2 of the matrix B`

`to get the (3,2)-th entry of the product AB `

Compare this with the Maple output

> AB=multiply(A,B);

>

Example 9: Consider the two matrices:

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

> B:=matrix([[1,2],[2,2],[3,2]]);

The product AB is

> matrixmul(A,B);

`< type ; and press Enter to continue ?topic for help  exit; to quit >`

;

`Multiply row 1 of the matrix A and column 1 of the matrix B`

`to get the (1,1)-th entry of the product AB `

`< type ; and press Enter to continue ?topic for help  exit; to quit >`

;

`Multiply row 1 of the matrix A and column 2 of the matrix B`

`to get the (1,2)-th entry of the product AB `

`< type ; and press Enter to continue ?topic for help  exit; to quit >`

;

`Multiply row 2 of the matrix A and column 1 of the matrix B`

`to get the (2,1)-th entry of the product AB `

`< type ; and press Enter to continue ?topic for help  exit; to quit >`

;

`Multiply row 2 of the matrix A and column 2 of the matrix B`

`to get the (2,2)-th entry of the product AB `

`< type ; and press Enter to continue ?topic for help  exit; to quit >`

;

`Multiply row 3 of the matrix A and column 1 of the matrix B`

`to get the (3,1)-th entry of the product AB `

`< type ; and press Enter to continue ?topic for help  exit; to quit >`

;

`Multiply row 3 of the matrix A and column 2 of the matrix B`

`to get the (3,2)-th entry of the product AB `

>

Compare this with the Maple output

> AB=multiply(A,B);

>

******************************************************************

The product of an mxn matrix A with an nxr matrix B is obtained by multiplying row i

of A with column j of B and substituting the result in ( i,j )-entry. This is done for each i

( i = 1,..,m ) and for each j ( j =1,..,r). The result is an mxr matrix .

******************************************************************

Properties of matrix multiplication

The set of all nonzero real numbers under multiplication satisfies the following:

the commutative property ;

the associative property ;

the distributive property ;

the multiplicative identity property = ; and

The set of all mxn matrices enjoy similar properties.

********************************************************************

Multiplication Properties for Matrices

Matrix multiplication is not always defined.

The commutative property does not always hold.

The associative property holds (AB)C = A(BC)

The distributive property holds A(B + C) = AB + AC and (A+B)C = AC + BC

********************************************************************

Special Types of matrices

Diagonal matrix

A diagonal matrix is a square matrix whose off diagonal elements are all zero.

> D2:=diag(a,b,c,d);

A 4x4 diagonal matrix with entries a, b, c and d

Identity matrix

An identity matrix is a diagonal matrix with diagonal entries all equal to 1.

The 3x3 identity matrix is:

> I3:=diag(1,1,1);

and the 4x4 identity matrix is:

> I4:=diag(1,1,1,1);

Recall, that in the set of all real numbers, the number 1 plays the role of the multiplicative

identity; that is, for any real number a, a*1 = 1*a = a. Is there an analogous statement for

matrices? What is the result of multiplying a square matrix A with its associated identity matrix?

Example 10: Consider a 3x3 matrix A and the 3x3 identity matrix

> A:=matrix([[a,b,c],[d,e,f],[g,h,i]]);

> I3:=diag(1,1,1);

> multiply(A,I3);

****************************************************************

The identity matrix plays the role of the multiplicative identity.

IA = AI = A

*****************************************************************

Transpose of a matrix

The transpose of an nxm matrix A is obtained by interchanging the rows and columns of A.

Example 12: Consider the matrix A

> A:=matrix([[1,2,3],[2,2,4],[0,1,5]]);

> B:=transpose(A);

> C:=transpose(B);

Consider a 3x4 matrix A with general entries:

> A:=matrix([[a11,a12,a13,a14],[a21,a22,a23,a24],
[a31,a32,a33,a34]]);

> A^T=transpose(A);

> (A^T)^T=transpose(transpose(A));

****************************************************************

Properties of the Transpose Operation

= A

=

*****************************************************************

NOTE: The dot product <u,v> can be written as v if u and v are column vectors.

> u := matrix(3,1,[1,5,2]); v := matrix(3,1,[2,-1,3]);

> u^T = transpose(u);

> multiply(transpose(u),v);

Symmetric matrix

Symmetric matrices arise in the formulation of many physical and engineering problems.

Let us look at the class of all matrices A that satisfy the property: A = ?

Example 13: Consider the matrix:

> A:=matrix([[1,2,5],[2,6,9],[5,9,11]]);

The transpose of A is

> A^T=transpose(A);

In general, what relations must be satisfied by the entries of a matrix A that will make A = ?

Such matrices are called symmetric matrices .

Triangular matrices

These matrices are called upper (lower) depending on whether the entries below

(above) the main diagonal are all zero.

An upper triangular matrix is:

> A :=matrix([[1,2,4],[0,5,0],[0,0,8]]);

A lower triangular matrix is:

> B:= matrix([[1,0,0],[0,5,0],[0,6,0]]);

The notion Ax=b

Consider the linear system

Linear combination of the column vectors.

> u := matrix(2,1,[1,3]);

> v := matrix(2,1,[-2,5]);

> b := matrix(2,1,[-1,19]);

> x_1*evalm(u) + x_2*evalm(v)=evalm(b);

> A := matrix(2,2,[1,3,-2,5]);

> evalm(A)*matrix(2,1,[x_1,x_2])= evalm(b);

>

This system can be written as Ax=b .

Exercises

1-15(odd), 19, 20, 21, 27, 31, 32, 45