Visual Linear Algebra Online, Section 1.4
We have already alluded to the idea of linear transformations in two dimensions at various points in the first three sections. One example we encountered, in Section 1.1, “Points, Coordinates, and Graphs in Two Dimensions”, consisted of a system of linear equations that transformed rectangular coordinates to slanted coordinates.
Other examples of a linear transformations in two dimensions arose in the exercises of that section. There, for example, a system of linear equations transformed rectangular coordinates to rotated coordinates.
We also saw rotations arise as ways to visualize the process of elimination in Section 1.3, “Systems of Linear Equations in Two Dimensions”. However, because the rotations considered in that section are not about the origin, it turns out that those transformations are not linear. The reasons for that will be explored in this section.
Linear Functions and Linear Transformations
Linear Functions in Calculus
In calculus and its prerequisite subjects, a linear function is one whose graph, in rectangular coordinates, is a straight line. This is equivalent to the formula for the function being of the form for some constants and . The constant is called the slope of the line. And the constant is called the -intercept of the line. Take note of the fact that, in the equation , both and appear to the first power.
Linear Transformations as Mappings and Vector Fields
This definition of a linear function is simple, but in linear algebra we choose to define a linear function differently. We also tend to give it a different name — a linear transformation.
The words “transformation” and “function” are basically synonyms in mathematics. However, the word “transformation” has a connotation to its meaning that is a bit more geometric/visual.
We are especially interested in visualizing linear transformations in two ways, described below. These descriptions introduce a bit more terminology that we will explore in the examples to follow.
- Linear transformations are linear mappings (or linear maps, for short), which take a given set of points and “send” or “map” these points to another set of points.
- Linear transformations are linear vector fields which take a given set of points and “attach” vectors to them.
We now commence with our exploration through examples.
Examples of Linear Transformations
Within each example of this section, we start by describing transformations geometrically. We also consider what makes each transformation linear or not. Most of these are examples of linear transformations in two dimensions.
We will find it helpful to use a special symbol for the two-dimensional rectangular (Cartesian) coordinate plane. The symbol we use is standard. It is .
We also use the standard notation for a function (transformation) whose domain is and whose codomain is .
Example 1: Reflection about the horizontal axis
Define a transformation geometrically in the following way. Map a point with rectangular coordinates to a point that is its reflection across the horizontal axis.
In other words, if the input of has rectangular coordinates , the output will have rectangular coordinates . This can be written in function notation as (which is a simplification of ). We will also write it with “maps to” notation , or .
If we let be the first coordinate/component of the output and let be the second coordinate/component of the output , this transformation can also be written as the following system of linear equations.
Visualizing the Mapping
This transformation can be visualized as shown below.
Alternatively, via the natural association between points and vectors discussed in Section 1.2 “Vectors in Two Dimensions”, we can view this as a transformation of vectors. This can be written , or as . It can be visualized as shown below.
The Image of a Set of Points
Suppose we are given a set of points in the domain of . It is often important to determine the set of all outputs of as the inputs vary over this set.
This set of outputs is called the image of under , and is denoted by . It is defined by the equation . Read this as “the set of all points as the points vary over the set ” (the symbol means “is an element of” or “is in”).
For example, suppose . With a bit of algebra work, you will see that is the parallelogram bounded by the lines , , and .
An animation showing being transformed into its image is shown below. The quantity is just an “animation parameter” that has no meaning. It is just a tool to help us visualize the reflection.
While it is useful and relatively simple to consider images of parallelograms, we need not be constrained by them. We can consider the image of a more complicated set, such as the “butterfly curve”. Once again, is just an animation parameter with no meaning.
From these examples, you can start to get an inkling of how linear algebra is useful for computer graphics!
What Makes the Reflection Linear?
But why is this reflection a linear transformation? For one thing, in its formula, the output contains the input variables only to the first power: .
A more important (related) reason is this: for any vectors and any scalars (numbers) (just a plain , with no “2” in its “exponent”, is the symbol for the set of all real numbers).
To see why this is true, let and . Then, by the definition of vector addition and scalar multiplication, .
Then
.
On the other hand,
.
Hence, for any vectors and any scalars (numbers) .
What Makes This Work?
It is, in part, the first powers of and that allow for this computation to work out in the way that it does. Also, this computation works out because there are no constants that are being added (by themselves with no variable attached) in the formula for .
You should take the time to check that there are vectors and scalars such that (note the not equal to!) for the following two examples. You only have to come up with one example in each case to show the transformations are not linear!
- .
- .
Now you might ask: why not allow linear transformations to include situations where constants are being added? The short answer is this. Defining a linear transformation purely by the property allows us to: both 1) state various properties more clearly and 2) generalize the idea of linearity to many other situations.
Example 2: Reflection about the line y = x
Define a transformation geometrically in the following way. Map a point with rectangular coordinates to a point that is its reflection across the line .
If you think carefully, you will see that the formula for is (swap the coordinates). In “maps to” notation, we write or . With vectors, we write (swap the components).
As a system of linear equations, is defined by
The figure below shows how the transformation acts on both the point and the vector . Note that the green dashed line is a perpendicular bisector of the black dashed line from to its image .
Also, make sure you don’t get confused by the notation. For the image point , the value of is indeed its -coordinate (first coordinate) and vice versa.
The Images of Sets of Points
We now consider the images of the parallelogram and the butterfly curve defined in Example 1.
Here is the relevant animation for the parallelogram .
And here is the relevant animation for the butterfly curve.
What Makes the Reflection Linear?
Once again, the key fact that makes this reflection linear is that for any vectors and any scalars (numbers) . You should check this as an exercise.
We take the time to note that this condition is equivalent to the following two facts being true.
- for any vectors , and
- for any vector and any scalar
We also remark that mathematical induction can be used to prove that, for an arbitrary collection of vectors and scalars,
.
Using Sigma (summation) notation, this property can be written like this:
.
Once you know a given transformation is linear, you may use these equations any time you need it. These facts are all related and do have a name. Any of them can be called an operation-preserving property of a linear transformation.
Example 3: Expansion (Dilation) Away From the Origin
Define a transformation geometrically in the following way. Map the point to another point along the same ray from the origin, but twice as far from the origin.
This means the formula for can be written as or .
As a system of linear equations, is defined by
The figure below shows the action of this transformation on a generic point/vector.
The Images of Sets of Points
We again consider the images of the parallelogram and the butterfly curve defined in Example 1. First, an animation of for the parallelogram.
And here is the animation for the butterfly curve.
Take the time to check linearity. Check that for any vectors and any scalars .
Example 4: Rotation About the Origin
Define a transformation geometrically in the following way. Map the point/vector to a point/vector that is a counterclockwise rotation about the origin.
The formula for this turns out to be or .
As a system of linear equations, is defined by
This is best shown with a picture.
The Images of Sets of Points
Here is an animation of the image of our parallelogram.
And here is an animation for the butterfly curve.
You should once again take the time to check linearity.
Example 5: Shear Transformation
Another kind of transformation that is linear is a “shear transformation”. One basic example of this type maps the horizontal vector to itself while mapping the vertical vector to .
It is important to imagine the geometric effect of this transformation on the vertical vector as “pushing” (“shearing”) the vector to the right so that it stays the same height but gets more and more slanted. It is also important to realize that similar behavior is going on below the horizontal axis, but in the leftward direction. This means the downward-pointing vertical vector gets mapped to .
The resulting formula for this turns out to be or .
As a system of linear equations, is defined by
Checking the linearity (operation-preserving) condition is a tiny bit more work in this case. Take the time to do so before looking at the visuals below.
The Images of Sets of Points
The “pushing effect” is easier to see when we look at our old friends, the parallelogram and the butterfly curve.
Example 6: Translation (a Nonlinear Transformation!)
A geometric translation (shift) is certainly a simple transformation. For example, we could take all the points in the plane and shift them to the right by 3 units and upward by 2 units.
As a mapping , the formula for this would be or .
This certainly looks both simple and linear. However, according to our “new” definition of linearity, it is nonlinear. To see this, we only need to find one example of scalars and vectors such that .
Probably any example you pick will be sufficient. For example, suppose , , and . Then
.
On the other hand,
.
We can still think about images of sets of points with such a transformation. In fact, for translations, this is relatively easy. But still, the larger point holds: this transformation is actually nonlinear.
Example 7: Rotation About a Point that is Not the Origin (a Nonlinear Transformation!)
A rotation of points about a given point that is not the origin is likewise a simple transformation that is nonlinear.
To find a formula for such a transformation, it is best to think in stages. For example, suppose we want to rotate points by counterclockwise about the point .
We could start by using a translation that maps to the origin. This mapping could be represented as .
Next, we could rotate the resulting points about the origin (see Example 4). This mapping is .
Finally, translate the result back to be centered on the original point by using the mapping .
The composition of these three functions is the mapping we seek. In stages, it would be
.
The and the in the formula conspire to make this a nonlinear transformation according to our new sense of linearity.
Example 8: Polar Coordinates (a “Strongly” Nonlinear Transformation)
Recall our brief discussion of polar coordinates at the end of Section 1.1, “Points, Coordinates, and Graphs in Two Dimensions”. The “conversion equations” from polar coordinates to rectangular coordinates are:
This defines a transformation by the formula .
It is important to realize in the last paragraph that the on the left has rectangular coordinates that are labeled with the letters and while the on the right has rectangular coordinates labeled with the letters and . This may seem like quite a strange thing to do, but it indeed is the best way to think about it.
It is interesting to watch the butterfly curve being transformed under this mapping. Keep in mind that it is most definitely a (strongly) nonlinear mapping, which makes its behavior more difficult to understand. Take note of how the butterfly is essentially being wrapped around the origin in a strange way. In fact, the larger the initial second -coordinate is, in absolute value, the larger the amount of wrapping in the final picture.
Also note how the axes get relabeled during the animation.
Example 9: Projection Onto the Horizontal Axis
For our final example of a transformation, we return to one that is linear. Its behavior, however, is somewhat “degenerate” in certain ways.
Define a transformation by mapping every point to a point on the horizontal -axis with the same -coordinate. The formula for is . It is easy to check that is linear.
Here is a picture of the effect of this linear transformation, called a “projection”, on an arbitrary point/vector. It is called this because the image point/vector is like a “shadow” of the original points/vector. In the present example, the “light source” that causes this shadow to be cast has “light rays” that come straight down/up perpendicular to the horizontal axis.
The Images of Sets of Points
Here is an animation showing the geometric effect of this projection mapping on our parallelogram and the butterfly curve. Notice that both sets get “squashed” onto the -axis. This is the reason the mapping is “degenerate”.
Observations about the Examples
Some summary observations about these examples are in order.
- Some linear transformations are “rigid” (isometries): they preserve distances and areas. Examples of this include rotations about the origin and reflections across lines through the origin fall in this category.
- There are some nonlinear transformations that are also rigid. Translations, rotations about non-origin points, and reflections about lines that do not go through the origin fall in this category (we did not consider an example of the last type).
- Some linear transformations are not rigid. Expansions (dilations) and projections do not preserve distances or areas. Shears do not preserve distances.
- For “most” linear transformations from the plane to itself, the origin is the only point that gets mapped to the origin. This is true for all of our linear transformation examples except for the projection mapping. This is equivalent to “most” linear transformations being one-to-one.
- For “most” linear transformations from the plane to itself, every point is the image of some other point. This is true for all of our linear transformation examples except for the projection mapping. This is equivalent to “most” linear transformations being onto.
The Examples Reimagined as Vector Fields
As mentioned earlier, there is another way that transformations like these can be visualized: as vector fields. Given a transformation , we imagine “attaching” the vector (arrow) to be based at the point , for all points in the plane.
This perspective is of utmost importance in applying linear algebra to the study of differential equations. More on this topic to come in later sections of this text.
Examples 1 and 2
The formula for such a transformation as a vector field can be written in a suggestive form, with the input as a point and the output as a (column) vector. For Examples 1 and 2 above, the forms would be and .
The vector field-graphs for these two examples are shown below. For formatting reasons, we are not able to label these plots with outputs as column vectors. The big dot at the origin for each graph represents the fact that in each case. This is a “degenerate arrow” which has zero length and no well-defined direction.
Examples 3 and 4
For Examples 3 and 4, the formulas are and .
The plots for Examples 3 and 4 are shown below. The expansion one (example 3) is a bit tough to see because the arrows lie on top of each other and get so long. Once again, the big dot at the origin represents the fact that .
Examples 5 and 6
For Examples 5 and 6, the formulas are and .
The plots for Examples 5 and 6 are shown below. Note that the “big dot” for the second one is not at the origin. This is related to the fact that example 6 is a nonlinear transformation.
Finally, we look at the vector field for Example 9. Note that all the vectors that are not on the -axis are horizontal. Also, every point on the -axis has the zero vector (a big dot) attached to it.
Relationship to the Original Geometrically-Described Mapping
It may not be clear, besides having the same formula, how these vector field pictures are related to the pictures for the original mappings. This can be made clearer with yet one more animation.
Consider Example 2, the reflection across the line with formula . Here is the picture showing how we viewed this originally as a mapping:
To see how this is related to the vector field, we make an animation that transforms the “identity” vector field into the vector field . Note that each of the original vectors is being “reflected” across a line (colored pink) through the point at which it is based.
Relationship to Solutions of Differential Equations
In the study of differential equations, we seek solution curves which “follow” vector fields. When many of these solution curves are graphed, we get a picture of the “flow” of the vector field. The flow of the linear vector field is shown below.
We end this section by viewing two animations showing how the vector fields for the rotation and the shear are obtained as appropriate geometric transformations of the identity vector field .
Exercises
- Let be a function defined by the formula for some constants and . Prove that (a) and (b) for all if and only if .
- Determine a formula for a transformation that maps points to their reflection across the vertical -axis. Next, prove that is linear according to the “new” definition in this section.
- Determine a formula for a transformation that maps points to their reflection through the origin (so the output of a point under is another point the same distance from the origin, but in the opposite direction). Take note of the fact that this transformation is the same as a rotation about the origin. Next, prove that is linear according to the “new” definition in this section.
- Let , and be constants. Prove that the transformation defined by is linear.
- Give a proof that the translation transformation defined by is nonlinear.
- Prove that the transformation defined by is nonlinear.
Challenge Exercises
- (Challenge) The parallelogram from the examples can be described in terms of two parameters (numbers) and in the following way: . Use the linearity of the transformation from Example 2 to prove that .
- (Challenge) Use a picture to help you explain why the transformation defined by represents a counterclockwise rotation by an angle of about the origin.
Video for Section 1.4
Here is a video overview of the content of this section.