ANIMATING TRANSFORMATIONS

 
Objective: In most introductory linear algebra courses, prominent applications of transformations or mappings are moving (rotating, reflecting, translating), resizing (contracting, expanding), changing the shape (shearing, projecting) objects in the plane. A typical problem in such courses is to write the matrix of a transformation that changes points in such prescribed ways. While one can easily visualize the effect of such a transformation on particular points or on easily described objects like lines or rectangles, the effect on more complicated objects like graphs of functions or general plane curves is more difficult to visualize. The goal of this demo is to help students more easily visualize such transformations on a wide class of plane objects. Furthermore, use of this demo provide students with a better intuitive feel for the interrelationship between the algebra and the geometry involved, one of the most important foundations of linear algebra.

Level: A beginning linear algebra course after calculus or possibly precalculus. (The calculus requirement is simply so that students will have a good source of plane curves upon which to call and a modest level of mathematical maturity.)

Prerequisites: To use this demo, students should know how to form a matrix of a linear transformation   ( rotation, contraction and expansion, shear, and projection given the requirements of the transformation) and a translation of plane figure. The latter operation is explained using the notion of homogeneous coordinates. (See the Instructor's Notes below.) In addition, a basic knowledge of parametrically defined curves is needed in order to enter their expressions into the supporting software. 

Platform: The activity of this demo is supported by software in MATLAB, Excel, and LiveMath. The routines in these environments share many of the same features. Further details are given in the Instructor's Notes below.

Instructor's Notes: This demo can be used whenever the modest prerequisites outlined below have been discussed in your linear algebra class. The demo can be used by the instructor as part of class discussion, for student assignments, or in a lab setting. 

The demo as part of a lecture.

We assume that the students have been introduced to the algebra and basic properties of matrices. In addition, the basic properties of linear transformations or even more generally . In particular the linearity property has been discussed; that is, for a pair of vectors v and w in the domain and any real scalars a and b, T(av + bw) = aT(v) + bT(w). Furthermore, if matrix M is 2 by 2 or, more generally m by n, M(av + bw) = aMv + bMw. That is, multiplication of a vector by a matrix defines a linear transformation. 

Depending upon the text used in your course you may want to develop the relationship between linear transformations and the m by n matrix M associated with linear transformation T. Click here for a brief discussion of this development. However, if your course first introduces "matrix transformations" and postpones a discussion of general linear transformations you can skip this item and use the following example altering the notation and language to suit the approach used in your course.

Example 1. Let be given by . Then for and we have hence 

 

and 

.

It follows from the linearity property that

.

Thus the matrix associated with linear transformation T is 

.

Once the connection between a linear transformation T and its associated matrix is made, it is not difficult to construct matrices to carry out a specific geometric tasks for . Such material is illustrated quite nicely within most texts. Many times the matrices needed for the operations of rotation, contraction and expansion, shear, and projection are listed and we do not repeat them here.

In order to perform the translation operation using matrix multiplication we introduce the notion of homogeneous coordinates for vectors in R2 and the modification of the required matrices to be of size 3 by 3. This can be done relatively painlessly using several examples. For a brief overview of this topic click here. In the software to accompany this demo students are prompted to use the correct matrix form for translations.

The goal of this demo is to help students visualize changes of plane figures brought about by applying a linear transformation. The following animations illustrate such changes and were chosen to show a sequential transition from the original figure to the final image. The transition steps are included for emphasis; the action of a linear transformation is usually represented by showing only the initial and final figures. (The animations were captured from a MATLAB routine which is discussed below. The displays from the supported software are similar.)

Animation 1 illustrates rotating a parabola. The frames show entering a parametric expression for the parabola, an interval for the parameter, and the entries of the rotation matrix in terms of sines and cosines with radian arguments.

Animation 2 illustrates shearing an ellipse.

Animation 3 illustrates translating a triangle. This set of images shows entering data to produce a polygon and then using homogeneous coordinate techniques to translate the figure.

As the animations illustrate, students will be able to see graphically the geometric effects of applying transformations to plane curve and figures. The equations of the parametric representation of the curve or figure are specified in in expressions x(t) and y(t), along with an applicable domain for parameter t. The transformation matrix M is then entered. The demo then plots the original figure as a set of ordered pairs (x(t), y(t)) and the image of the transformed figure. A progression of images shows a step-by-step transition from the original figure to the final image.

Uses for the demo.

  • The matrix M associated with the transformation may be prescribed by the instructor or by a textbook exercise to perform a specified task. (For example, rotate the plane figure counter clockwise through an angle of . See Animation 1.) In this type of exercise, the students construct the appropriate matrix, execute the demo, and verify that their matrix does indeed perform the assigned task. 

  • Another use for the demo is to give students a matrix and have them predict the action of an figure. They can then use the demo software to verify their prediction and when necessary revise their prediction. 

  • This demo can also be used for experimentation; for example, choose a matrix. See its effect on a figure. See if there is any pattern to the changes as you alter one or more of the entries of the matrix. Another type of experiment is based on specifying the original figure and the final image of the figure. The task then is to determine a matrix that will perform the transition from the original figure to the final figure. This is a nice way to introduce composite transformations and the product of the corresponding matrix representations of the actions needed to perform the transition between figure.

Software

There three programs that can be used to illustrate the ideas in this demo. Programs in MATLAB, LiveMath, and Excel, each with similar (but not the same) functionality. In the MATLAB and LiveMath versions the transition actions are animated automatically. In Excel, the student controls the animated movement manually by dragging a slider with a mouse.

General Instructions:

  1. Enter expressions for the parametric definition of the figure, one for x(t) and the another for y(t).

  2. Enter a beginning value for parameter t and an ending value.

  3. When using expressions involving trigonometric, exponential, logarithmic, etc. functions be sure to enclose the argument in parentheses. Use cos(t), not cost. Use exp(t) for et. (Each software may have particular syntax that must be used. For example in MATLAB, the natural log function is denoted log(t), not ln(t).)

  4. To indicate multiplication, use the *. Thus t*cos(t) not tcos(t). For division, use the slash, /. Thus type cos(t)/t for .

  5. Read the directions or help files for each implementation before using the software.

To help your students prepare for data entry the following form is easy to use. It contains the features outlined above and can be used for any of the three platforms with minor adjustments. Click here for a pdf file containing this form.

 

     Examples:

  1. To use the curve y = x2, set x(t) = t and y(t) = t^2.

  2. To use the ellipse , set x(t) = 3*cos(t) and y = 5*sin(t). To get the full ellipse set the values for t from 0 to , but 0 to 7 is just as good.

  3. To create a rose curve, set x(t) = cos(3*t)*cos(t) and y(t) = cos(3*t)*sin(t). The domain for t can be 0 to 7 for convenience.

  4. To create a spiral, code the expressions 

.

The MATLAB version will accept polygonal figures defined by the coordinates of the vertices. See Animation 3 for an example. Click here for a pdf file describing the MATLAB program.

The Excel version has its directions embedded in the display when the file executes. The transition from original to final figure requires the user to drag sliders.

To use the LiveMath version you need to download the LiveMath Viewer. (A free download; click here.) The contents of the LiveMath notebook can be changed to perform various operations.

Click in the appropriate box to download a version of software that accompanies this demo.

 

Credits:  This demo was submitted by 

James Uebelacker juebelacker@newhaven.edu and
Thurmon Whitley twhitley@newhaven.edu

at the University of New Haven, West Haven, CT, and is included in Demos with Positive Impact with their permission.

The MATLAB routine was written by David R. Hill, Temple University, and is included with his permission.


DRH          1/24/2003          Last updated 5/6/2004  (DRH)

Since 1/24/2003