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)
---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:
By 3 In 7 dimensions:
(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.


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:


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.)


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

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


(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

The matrix for the rotation is
(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

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:


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:


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:
|0102||z||0x+ y+0z+2w|
\11-11/\w/\ x+ y- z+ w/

For two matrices:


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/


/12\/xz\/x+2y z+2w \

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.


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.)

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


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 \
\ 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


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


Check that it works!

We'll use this formular in some examples.


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/\0 2/\-1 0/\01/\00/

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:

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:

Use the rules for matrix multiplication to find the products:
\01/\10/ \10/
\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:
\10/\0/ \1/
\10/\0/ \2/
\10/\1/ \1/
\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