Math 272: Linear Transformations
Names: 

When you have finished, upload your completed file to Moodle: https://lms.ats.amherst.edu/mod/assign/view.php?id=358153

This lab covers the material from Section 4.6.

A transformation T is function from a vector space V to a vector space W. A matrix transformation T from (R^n) to (R^m) is a function such that for every vector v in (R^n), T(v)=Av, where A is an m x n matrix.

The matrix transfomation corresponding to a 90 degree counter-clockwise rotation is given by: (({{0, -1}, {1,   0}})).

A={{0,-1},{1,0}}
A//MatrixForm

To find the image of a point, such as (1,2) under this transformation, we multiply A and the position vector {1,2}.

v={1,2}

A.v

We can also plot the point v and its image under A to visualize this transformation.

ListPlot[{v,A.v},PlotRange->{{-3,3},{-3,3}}]

However, transformations can be hard to understand if you’re only looking at one point. Let’s apply this to something more complex.

Suppose we wish to apply our rotation matrix A to the parallelogram with corners at the points (0,0), (2,0), (3,1) and (1,1). Rather than going through the above process for each point at a time, we first set up a matrix with these points as its columns, repeating the last point for reasons we will see in the next step.

v=Transpose[{{0,0},{2,0},{3,1},{1,1},{0,0}}]
v//MatrixForm

Then we can plot these points, with lines connecting them, using the following command. (If we don’t repeat the last point, the plot does not draw the last line connecting back to the origin!)

ListPlot[Transpose[v],PlotJoined->True,PlotRange->{{-5,5},{-5,5}}]

OK, now we are ready to see how the matrix affects this entire picture! To see how the points are transformed, we compute the product Av. The columns of this new matrix give the images of each point under the transformation.

A.v //MatrixForm

Now lets plot these new points, by replacing v with Av in our plot command.

ListPlot[Transpose[A.v],PlotJoined->True,PlotRange->{{-5,5},{-5,5}}]

Unfortunately, Mathematica’s axes scaling distorts the picture. This is fixed by adding in the AspectRatio option. Below, we plot both pictures at once with both axes scaled the same way.

ListPlot[{Transpose[v],Transpose[A.v]},PlotJoined->True,PlotRange->{{-5,5},{-5,5}},AspectRatio->1]

We will now explore some more matrix transformations. For each of the three matrices below, apply the transformation to the parallelogram P with corners (0,0), (2,0), (3,1) and (1,1). Then describe the effect of the transformation in words. (If you’re unable to figure out what the transformation is doing by looking at the picture, try seeing what it does to some other parallelograms with different corners as well. For example, you could also check what it does to the unit square.)


Exercise 1.  (({{2, 0}, {0, 2}}))

Description: 

Exercise 2.   (({{-1, 0}, {  0, 1}}))

Description: 

Exercise 3.  (({{(1/(Sqrt[2])), (1/(Sqrt[2]))}, {  ((-1)/(Sqrt[2])), (1/(Sqrt[2]))}}))

Description:

An orthogonal matrix is an invertible matrix that has the property (A^(-1))=(A^t). An orthogonal transformation is one produced by an orthogonal matrix. (Such transformations preserve lengths, distances and angles.) 

Exercise 4.  Determine whether each of the matrices in exercises 1-3 are orthogonal or not. (Note that the command to find the inverse of a matrix A is Inverse[A].)

A linear transformation is any transformation T with the property that if u,v are vectors and c is a scalar, then: 
T(u+v)=T(u)+T(v)    (preserves addition)
T(cu)=cT(u)   (preserves scalar multiplication)

Theorem. Let (Subscript[e, 1]),(Subscript[e, 2]),...,(Subscript[e, n]) be the standard basis vectors of (R^n). Then any linear transformation T on (R^n) can be expressed as a matrix transfromation with standard matrix A, whose columns are given by T((Subscript[e, 1])),T((Subscript[e, 2])),...,T((Subscript[e, n])). 

To see an example of this, let’s take another look at the matrix transfomation corresponding to a 90 degree counter-clockwise rotation: (({{0, -1}, {1,   0}})). 
The first column is the image of the point (1,0) under this transformation, and the second column is the image of the point (0,1). (The set {(1,0), (0,1)} is the standard basis of (R^2).)

Find the standard matrix of each of the following linear transformations, and then verify that your matrix is correct by applying it to the parallelogram P with corners (0,0), (2,0), (3,1) and (1,1).

Exercise 5. reflection in the y-axis

Exercise 6.  rotation of 90 degrees clockwise

Exercise 7.  contraction to 1/4 of the original size of the vector

Exercise 8.  projection onto the x-axis

A translation is a transformation defined by T(v)=v+w, for some fixed vector w. Note that in this case, T(v) cannot be performed via matrix multiplication.

Exercise 9. Translate the parallelogram P with corners (0,0), (2,0), (3,1) and (1,1) by the vectors (2,3), and then plot it. (Note that each vector has to be translated individually here, instead of at once through matrix multiplication.)

Computer Graphics and Homogenous Coordinates

An affine linear transformation T is one that has the form T(v)=Av+w, for some matrix A and some fixed vector w. 

Such transformations are used frequently when working with computer graphics. However, since translating each vector would be very tedious, it is common to use homogeneous coordinates for these. The homogeneous coordinates of a point (x,y) are (x,y,1). This allows us to perform translations using matrix multiplication as well! The matrix for a translation by w=(a,b) is given by: (({{1, 0, a}, {0, 1, b}, {0, 0, 1}})).

All matrix transformations also need to be extended to 3x3 matrices to apply them to homogeneous coordinates, which we do by adding all 0s into the third row and column, except for in the (3,3) position, where we add a 1. Thus, the matrix for a 90 degree counter clockwise rotation now becomes: (({{0, -1, 0}, {1, 0, 0}, {0, 0, 1}})).

Exercise 10. Rewrite the matrix v for the parallelogram P so that it is in homogeneous coordinates. To plot this parallelogram, we now need to use the following modified command. (This allows us to ignore the third coordinate while plotting, since it is just there for the convenience of transforming.)

ListPlot[Transpose[{v[[1]],v[[2]]}],PlotJoined->True,PlotRange->{{-5,5},{-5,5}}]

Use this new method of homogeneous coordinates to plot the image of the parallelogram P obtained after doubling its size, reflecting in the y-axis, and then translating by the vector (4,1).