Matrices

We begin by reviewing matrix operations and the way that they are expressed using your computer algebra system. Open your computer algbera system now by clicking its icon in the navigation frame.

We are often interested in data that is most naturally written as a matrix or array.

Missing equation

For example, in chapter 1 we used matrices to represent images. Matrices are also discussed in the section on matrices in the mathematical infrastructure. In that section we discuss adding two matrices and multiplying a matrix by a real number.

Vectors can be thought of as matrices

Vectors are often thought of as either a matrix with one row

Missing equation

or as a matrix with one column.

Missing equation

We call a vector a row vector when we think of it as a matrix with one row and a column vector when we think of it as a matrix with one column.

The transpose of a matrix

It is sometimes useful to exchange the roles of the rows and columns. For example, consider the two matrices written below. The lefthand matrix describes the traffic flow each morning as commuters drive from their homes in three towns -- Oak, Elm, and Maple -- to their jobs at three companies -- ABC Co., DEF Co., and GHI Co. The table on the right shows the traffic each afternoon as commuters return home. Notice that the rows of the first matrix become the columns of the second matrix. This matrix is called the transpose of the first matrix.


   \                                                      \
    \  To      ABC Co.    DEF Co.   GHI Co.                \  To     Oak      Elm    Maple    
From \                                                 From \
      \                                                      \
Oak    \      4,000      6,000     8,000               ABC    \    4,000    5,000    1,000
Elm     \     5,000      3,000     2,000               DEF     \   6,000    3,000   12,000  
Maple    \    1,000     12,000     4,000               GHI      \  8,000    2,000    4,000

More generally, we write the transpose At of a matrix A as shown in the live image below. If you click on any element in either of the two matrices below the corresponding element of the other matrix will be outlined. Notice that each row of the original matrix becomes a column in the transpose and each column of the original matrix becomes a row in the transpose.

For example, if

Missing equation

then

Missing equation

Matrix multiplication

Now we define a new operation, called matrix multiplication, that takes an n by k matrix,

Missing equation

and a k by m matrix

Missing equation

and produces an n by m matrix

Missing equation

The elements in the ith row of C depend on the elements in the ith row of the first matrix A and the elements in the jth column of C depend on the elements of the jth column of the second matrix B as illustrated in the live picture below. Click on any element of the matrix C to see the elements in the matrices A and B that determine that element.

The matrix A must have the same number of columns as the number of rows in the matrix B. The formula that determines the elements of C is

Missing equation

For example,

Missing equation

Notice that because the matrix A has the same number of columns as the number of rows in the matrix B the summation

Missing equation

uses all the elements of the i-th row of A and the j-th column of B.


Find each of the following.


The following theorems are easy to prove.

Theorem

If A is an (n by k)-matrix, B is a (k by m)-matrix and c is any real number then

c(AB) = (cA)B = A(cB)

Theorem

If A is an (n by k)-matrix and B is a (k by m)-matrix then

(AB)t = BtAt

Theorem

If A is an (n by k)-matrix, B is a (k by m)-matrix and C is a (m by p)-matrix then

(AB)C = A(BC)

Theorem

If A is an (n by k)-matrix, B is a (k by m)-matrix and C is a (k by m)-matrix then

A(B + C) = AB + AC

Theorem

If A is an (n by k)-matrix, B is an (n by k)-matrix and C is a (k by m)-matrix then

(A + B)C = AC + BC


Prove the four theorems above.


In the last section of Chapter 1 we defined the idea of a linear transformation.


Definition

Suppose that U and V are two vector spaces. A transformation

T : U --> V

is linear if for any two vectors x and y in U and any two real numbers s and t,

T(s x + t y) = s T(x) + t T(y)


The same concept can often be expresssed in several different but equivalent ways. The concept of a linear transformation is often expressed by the definition below.


Definition

Suppose that U and V are two vector spaces. A transformation

T : U --> V

is linear if it satisfies the following two properties below.


Prove that the two definitions above are equivalent -- that is, any linear transformation satisfying the first definition satisfies the second and vice versa.


Examples


Verify each of the assertions listed as examples above.


You may have seen the tearm linear used in a different way before. For example, a function f : R --> R of the form

f(x) = m x + b,

where m and b are constants, is often called "linear." This use of the term "linear" is different from the use in this course. The following theorem shows the difference.

Theorem

A function f : R --> R of the form

f(x) = m x + b,

where m and b are constants, is linear if and only if the constant b is zero.

Proof

First, suppose that f(x) = m x. Then if x and y are any two vectors in R and s and t are any two real numbers, we have


f(s x + t y) = m (s x + t y)
             = m s x + m t y
             = s m x + t m y
             = s f(x) + t f(y)

So f is linear.

Now suppose that f : R --> r is linear and let m = f(1). Then for any vector x in R, we have


f(x) = f(x 1)
     = x f(1)
     = x m
     = m x,

which was what we wanted to show.



We can multiply two matrices A and B to obtain AB only when the number of columns of A is the same as the number of rows of B. We often have a situation when we want to multiply an (n by k)-matrix A by a k-dimensional vector x to obtain an n-dimensional vector Ax. Strictly speaking we should write this as

Missing equation

writing both vectors as column vectors. Typographically, row vectors consume less space on a page or screen than column vectors and so we often prefer using row vectors to column vectors. If we want to write both vectors as row vectors than we should write

A xt = yt

Some computer algebra systems allow themselves some typographical freedom and write, less precisely,

A x = y

For example, in the Mathematica session below notice the way that Mathematica interprets the vectors as column vectors without explicitly being told to do so.

Missing Mathematica log

We will allow ourselves the same typographical freedom.

Representing Linear Transformations by Matrices

In this subsection we show that any linear transformation

T : Rn --> Rk

can be represented by a (k by n)-matrix and that the composition of linear transformations can be represented by matrix multiplication. This is an extremely powerful tool since most computer languages and many scientific calculators have built in operations for working with matrices.

Theorem

Suppose that

T : Rn --> Rk

is a linear transformation. Then there is a (k by n)-matrix, A, such that the equation

y = T(x)

can be written

y = A x

where x and y are written as column vectors.

The proof of this theorem is available in a pdf file.

Theorem

In the first section of chapter 1 we defined several basic kinds of rigid transformations. Two of them -- reflection in the x-axis and rotation about the origin -- are linear transformations. These two rigid transformations can be represented by the following matrices.

Reflection in the x-axis:

Missing equation

Rotation about the origin:

Missing equation

In the second section of chapter 1 we defined a family of linear transformations called dilations. These linear transformations can be represented by the following matrices.

Missing equation

It is clear geometrically that these transformations are linear. The matrices above are determined as described in the preceding theorem.



The (n by n)-matrix

Missing equation

is called the identity matrix because it is the identity element for matrix multiplication.

Theorem

Suppose that S : Rn --> Rk is a linear transformation and is expressed in the form

S(x) = A x

where A is an (k by n)-matrix. Suppose that T : Rk --> Rm is a linear transformation and is exressed in the form

T : Rk --> Rm

Then the composition can be expressed by

T(S(x)) = (BA)x

Proof:

Missing equation



Copyright c 1997 by Frank Wattenberg, Department of Mathematics, Montana State University, Bozeman, MT 59717