Home - Contacts - Terms -

Mi Islita

Matrix Tutorial 2: Basic Matrix Operations

This tutorial covers matrix operations like addition, substractions, and multiplication of matrices. An introduction to multiplication and division of matrices by a scalar is provided. Includes determinants.

Dr. E. Garcia
Mi Islita.com
Email | Last Update: 07/09/06

Topics

Learning by Doing

Matrix Operations at Once

Addition and Substraction of Matrices

Multiplication of Matrices

Multiplication and Division of Matrices by a Scalar

Orthogonal Matrices

Transpose and Inverse Properties

Determinants

Tutorial Review

References

Learning by Doing

In Part 1 of this tutorial we introduced the reader to different type of matrices, digraphs, and markov chains. We used lots of graphics to help users visualize the concepts. Now is time to discuss matrix operations. As mentioned before, only the most common and basic operations will be covered. Here we will use a learning-by-doing approach. Thus, rather than staring at some equations, you must do your part.

We recommend you to grab a stack of paper, a pencil and do the following.

Let's the fun begin.

Matrix Operations at Once

The rules for addition, substraction, multiplications and divisions between matrices are as follows. Let first assume that matrix A and B are used to construct matrix Z. It must follows that for

The rules for multiplication and division of a matrix by a scalar (a real number) are simpler. If matrix Z is constructed by multiplying all elements of matrix A by a scalar c, then its elements are zij = c*aij. In an analogous manner, dividing matrix A by c gives zij = (1/c)*aij.

All these operations are illustrated in Figure 1. Let's revisit these one by one.

 Some matrix operations

Figure 1. Some matrix operations.

Addition and Substraction of Matrices

To add or substract matrices these must be of identical order. This just means that the matrices involved must have the same number of rows and columns. If they don't have the same number of rows and columns we cannot add or substract these.

The expression

zij = aij + bij

means "to element in row i, column j of matrix A add element in row i, column j of matrix B". If we do this with each element of A and B we end with matrix Z. An example is given in Figure 2.

Addition

Figure 2. Addition operation.

Substraction is performed in analogous manner. The expression

zij = aij - bij

means "to element in row i, column j of matrix A deduct element in row i, column j of matrix B". If we do this with each element of A and B we end with matrix Z. See Figure 3.

Substraction

Figure 3. Substraction operation.

Multiplication of Matrices

Consider two matrices A and B with the following characteristics: the number of columns in A equals the number of rows in B. These are conformable with respect to one another, and they can be multiplied together to form a new matrix Z.

The expression

zij = ai1* b1j + ai2* b2j + ai3* b3j + ... aim* bnj

means "add the products obtained by multiplying elements in each i row of matrix A by elements in each j column of matrix B". Figure 4 illustrates what we mean by this statement.

Multiplication

Figure 4. Multiplication operation.

Matrix multiplication has a catch as we mentioned before. The order in which we multiply terms does matter. The reason for this is that we need to multiply row elements by column elements and one by one. Therefore A*B and B*A can produce different results. We say "can produce" because there exist special cases in which the operation is conmutative (order does not matter). An example of this is when we deal with diagonal matrices. Diagonal matrices were described in Part 1.

Multiplication and Division of Matrices by a Scalar

The rules for multiplication and division of a matrix by a scalar are similar. Since multiplying a number x by 1/c is the same as dividing x by c, lets consider these operations at once.

If all elements of matrix A are multiplied by a scalar c to construct matrix Z, hence zij = c*aij. Similarly dividing matrix A by c gives zij = (1/c)*aij. The expression

zij = c*aij

means "multiply each element in row i column j times c", and the expression

zij = 1/c*aij = aij/c

means "divide each element in row i column j by c". These two operations are shown in Figure 5, where c = 2.

Scalar multiplication and division

Figure 5. Multiplication and division of a matrix by a scalar.


Figure 6 shows that a scalar matrix is obtained when an identity matrix is multiplied by a scalar. As we will see in Part 3 of this tutorial, deducting a scalar matrix from a regular matrix is an important operation.

Scalar matrix

Figure 6. Scalar matrix obtained by multiplying an identity matrix by a scalar.

Orthogonal Matrices

A regular matrix (one whose determinant is not equal to zero) M is said to be orthogonal if when multiplied by its transpose the identity matrix I is obtained; i.e., M*MT = I. Orthogonal matrices have interesting properties. If M is orthogonal:

  1. its transpose and inverse are identical: MT = M-1.
  2. when multiplied by its transpose the product is commutative: M*MT = MT*M.
  3. its transpose is also an orthogonal matrix.
  4. when multipled by an orthogonal matrix the product is an orthogonal matrix.
  5. its determinant is +/- 1. The reverse is not necessarily true; i.e., not all matrices whose determinant is +/- 1 are orthogonal.
  6. the sum of the square of the elements in a given row or column is equal to 1.
  7. when multiplied, the corresponding elements in two rows or columns-i.e., dot product- is equal to zero.

Conversely, a square matrix (one with same number of rows and columns) is orthogonal if the following conditions both exist:

  1. the sum of the square of the elements in every row or column is equal to 1.
  2. the sum of the products of corresponding elements in every pair of rows or columns -i.e., dot products- is equal to zero.

As we can see, it is quite easy to determine if a regular or square matrix is orthogonal. Just look for any of these properties.

Transpose and Inverse Properties

The following transpose properties are observed in matrices

(ABC)T =CTBTAT

(ABCT)T = (CT)TBTAT = CBTAT

The following inverse properties are observed in matrices

(ABC)-1 =C-1B-1A-1

(ABC-1)-1 = (C-1)-1B-1A-1 = CB-1A-1

A-1A = AA-1 = I = 1

Since matrix division is not defined, it is impossible to divide a matrix expression by a given matrix. However, the desired effect is achieved by multiplying the expression by the inverse of the given matrix (2).

Determinants

Although the following is an incomplete definition, a determinant (det) can be described as a function that associates a scalar to a square matrix. This can assume any real value including zero. A matrix with a nonzero determinant is an invertible matrix (we can calculate its inverse matrix). If the determinat is zero (det = 0) is called a non invertible matrix. Don't worry about matrix inversions, yet.

To indicate that we are referring to determinant A and not to matrix A we surround the symbol A by pipes ("|"). The symbolic definition of a determinant for a matrix A is shown in Figure 7 and for m = n = 2 and m = n = 3

Some determinants

Figure 7. Some determinants.

In the figure, the second subscripts are all distinct, the number of terms is n! and v is the number of inversions of the second subscripts. Thus, the determinant of a matrix of order n=2 has two terms and 1 negative sign and the determinant of a matrix of order n=3 has 6 terms and 3 negative signs. Sample calculations are given in Figure 8.

Sample calculations

Figure 8. Sample calculations of determinants.

There are other methods for solving determinants (triangularization, reduction methods, etc). For large matrices there are plenty of software solutions to choose from.

If the determinant of a square matrix is not zero, its matrix is described as a regular matrix. If the determinant is zero, its matrix is described as a singular matrix. The problem of transforming a regular matrix into a singular matrix is referred to as the eigenvalue problem. The eigenvalue problem and two important concepts, eigenvalues and eigenvectors will be explained in Part 3 of this tutorial.

Next: Matrix Tutorial 3: Eigenvalues and Eigenvectors

Prev: Matrix Tutorial 1: Stochastic Matrices

Tutorial Review

  1. Create two different matrices A and B, both of order n = 2. Prove that A*B and B*A produce different results.
  2. Consider the m = n = 2 matrix with the follow elements; a11 = -18; a12 = 29 ; a21 = 30; a22 = 4. Calculate its trace and its determinant. Is this a regular or a singular matrix? Is this an invertible or non invertible matrix?
  3. Calculate the transpose matrices for the matrices shown in Figure 7. Calculate the determinants of the transposed matrices. Are these regular or singular matrices? Are these invertible or non invertible matrices?
References
  1. Graphical Exploratory Data Analysis; S.H.C du Toit, A.G.W. Steyn and R.H. Stumpf, Springer-Verlag (1986).
  2. Handbook of Applied Mathematics for Engineers and Scientists; Max Kurtz, McGraw Hill (1991).

Thank you for using this site.
Status of the Current Document 
W3C CSS Validation  W3C XHTML Validation
Copyright © 2006 Mi Islita.com -