URL http://www.mast.queensu.ca/~helena/linalg5.html

5: Transformations and Matrix Multiplication

Topics for this lecture:

Some examples of transfomations of R2
---text book 2.5
Composition of transformations
---text book 3.1
Matrix multiplication
---text book 3.1
Inner product
---text book 3.1 exercise 30, (and 7.1)
Inverses
---text book 3.2, 3.3

Some Transformations of R2

Section 4 was about how transformations can arise.

Now we're going to look at some basic examples of linear transformations, and see how they are represented by matrices.

Remember the important fact the the rows of the transformation matrix give the linear equations of the transformation, and the columns give the images of (1,0), and (0,1). The first column of the 2 by 2 matrix representing the transformation is the image of (1,0), and the second is the image of (0,1).

Then we'll go on to look at linear combinations of these, that is, composition of linear transformations.


Dilations and Contractions

The matrix which scales by 2 in three dimensions is given by:
200
020
002
By 3 In 7 dimensions:
3000000
0300000
0030000
0003000
0000300
0000030
0000003
(You have to imagine brackets round these for them to really be matrices.)

The seven dimensional transformation might correspond to multpilying the ingredients for a recipie with 7 ingredients by three, since it's only supposed to be for 3 people, but nine will come round for tea.

If you use a number smaller than one, instead of 2 or three above, you get a contraction instead of a dilation.

Shears

Above is a shear of amount s in the x direction. We'll see some more shears in class. I drew the image of the grid to help me find the image of the shape:

Stretch

The following is a stretch.

Exercise: Write down the matrix, and draw in the image of the grid, finding the images of (1,0), and (0,1) first. Use that to draw the image of the object. (The dots are a guide line, marking points distance 1 apart in vertical and horizontal direction.)

Rotation

Excercise for a rotation about the origin of 45 degrees anti-clockwise:

In the diagram below, the image of the grid is drawn.

Questions:

(We will do this in class, and other rotations, and also reflections.)


How to Compose Transformations?

What happens if we do a shear then a rotation? When we make one transformation, and then another, this is called composing transformations.

The matrix for the shear is
/11\
\01/

The matrix for the rotation is
/s-s\
\ss/
(s stands for the square root of 1/2.)

How can we describe the composition?

(x,y)=(1,0) has ended up at (z,w)=(s,s), and (0,1) has ended up at (0,2s), (where s is the square root of 1/2).

This tells us the columns of the matrix, so we know that the matrix will be
/s0\
\s2s/

Composition of tranformations and Matrix Multplication

The composition of transformations is represented by the composotion of matrices. Eg, to represent that the shear followed by the rotation is the third matrix, we write:

/s-s\/11\=/s0\
\ss/\01/\s2s/

This is called matrix multiplication. Notice that the matrices multiply from right to left, that is, the first one is right most. This makes sence because of the way we wrote the vector on the right of the matrix in matrix and vector multiplication.

There is a general rule for matrix multiplication:

/ab\/ef\=/ae+bgaf+bh\
\cd/\gh/\ce+dgcf+dh/

Check it and see this rule works for the above example. We'll see in the lectures why this rule works, and next we'll look at matrices of larger sizes.

Note, in class someone asked about is the inverse of the matrix of a rotation was the same as it's transpose. The answer is yes, and we can check this out in a couple of different ways.


Matrix Multiplication

We've seen how to compose two linear transformations in two variables, and how this corresponds to multiplying two by two matrices.

Now we'll define matrix multiplication more generally.

Recall how a matrix and vector can be multiplied, eg:
/1234\/x\/x+2y+3z+4w\
|5678||y|=|5x+6y+7z+8w|
|0102||z||0x+ y+0z+2w|
\11-11/\w/\ x+ y- z+ w/

For two matrices:

/12\/xz\
\34/\yw/

We can think of the second matrix like two columns, do the matrix vector multiplication, and combine the results:

/ 12\/x\=/x+2y\
\ 34/\y/ \3x+4y/

/ 12\/z\=/z+2w\
\ 34/\w/ \3z+4w/

So:

/12\/xz\/x+2y z+2w \
\34/\yw/\3x+4y3z+4w/

And in this process, we can think of the first matrix being split into two row. Each row of the first matrix combines with each column of the second matrix.

Generally:

Dot product is defined below. Note, the dot product is often called the inner product (I like the word "dot" better personally, but the book likes "inner".)


The inner product (Also called "dot product")

We might have one vector that gives the amount of some things, like the recipie vectors in lecture 2, and some other vectors might give the prices, or callorie content, or some thing else. The dot product will tell you the total price or total callorie content, or whatever. Eg. the following tables give you amounts of ingredients of some recipies, and the average price in different countries. (Warning: These recipes have not been tested.)
ingredients
eggsfloursugarmilk
Recipie11234
21234
30752
45211
52300
CountryA1123
B4232
C1111

So, if you make recipe 1 in country B, it will cost:

(1,2,3,4).(4,2,3,2)=1*4+2*2+3*3+4*2=25

The matrix you get by multiplying the amount matrix and the price matrix will give you a table of all possible prices of the different recipes in different countries. We have to turn the second matrix on it's side for this to work:
/ 1234\/141 \
|1234||121|
|0752||231|
|5211|\321/
\ 2300/


Geometrical interpretation of Inner Product (or dot product)

This is not quite the same as addition or multiplication by a scalar, since when we take the dot product, we don't get another vector, we get a number.

Example: What are

If we write the number (1,0).(a,b) next to the point (a,b), we get something like this:

This gives us the projection of (a,b) onto (1,0), ie, the amount of (a,b) in the direction (1,0).

We'll go over the projection in more detail tomorrow.


The Inverse of a Matrix

Inverse of transformations

Geometrically, the inverse of a transformation means what transformation can you apply to get back to the original situation. Eg, if you rotate something 30 degrees anticlockwise, then to get it back to where it was, you must rotate it 30 degrees clockwise.

What are the inverse transformations of the following transformations? Describe in words.

Next question: write matrices for all the above transformations, and for their inverses.

How can we find the inverse of other transformations? Eg, what is the inverse of

/31\
\25/

How can we find an inverse? Can we even be sure there is an inverse? Can you think of some transformations where theres no way we'll be able to recover the original position?

In the class we'll look at the geometry of the above transformation, and show how to find the inverse by using row reduction.

The row reduction method we'll look at will work well in all dimensions, but there is also a formuala for 2 dimensional transformations:

The inverse of

/ab\
\cd/
is
1/(ad-bc)/d-b\
\-ca/

Check that it works!

We'll use this formular in some examples.


Assignment

This is to be handed in to be marked on Tuesday 26th May.

Also answer and hand in the following:

If the Matrix A is given by each of the following in turn:
/10\/-10\/01\/11\/01\
\10/\0 2/\-1 0/\01/\00/
Then


What will be on the quiz

On Thursday 21st of May there will be a quiz, with a question like the following:

Answer to quiz like question

The way to find what the matrices are for A and B is to think about what happens, work out what the images of (1,0) and (0,1) will be, and make the first column the image of (1,0), and the second column the image of (0,1).

A stretch of amount 2 in the x direction will make (1,0) go to (2,0), but (0,1) will not change, since it's zero distance in the x direction, so zero times zero is still zero. So the matrix A is:
/20\
\01/

A reflection in the line x=y will make (1,0) go to (0,1), and (0,1) will go to (1,0), so the matrix B is:
/01\
\10/

Use the rules for matrix multiplication to find the products:
/20\/01\=/02\
\01/\10/ \10/
/01\/20\=/01\
\10/\01/ \20/

For finding the images of A and B, this can be done just be considering the geometric definitions. For AB and BA, there are two methods, either work out geometrically, remembering that AB means do B first, and then A, or else algebraically, eg, we found AB above, so we can do the calculations to find out where (1,0), (2,0), (1,1), (2,1) get sent to:
/02\/1\=/0\
\10/\0/ \1/
/02\/2\=/0\
\10/\0/ \2/
/02\/1\=/2\
\10/\1/ \1/
/02\/2\=/2\
\10/\1/ \2/

The caluculation for BA can be made in a similar way.

Then we can draw the images on the graphs:


Lecture 4 Back to the Linear Algebra Notes Index. Lecture 6

Please send comments, questions, suggestions, corrections, ideas, to me.



Welcome Home Origami

Queen's Mathematics and Statistics
Queen's University