Skip to main content

Section 7 Matrix Transformations

Subsection Application: Computer Graphics

As we will discuss, left multiplication by an m×n matrix defines a function from Rn to Rm. Such a function defined by matrix multiplication is called a matrix transformation. In this section we study some of the properties of matrix transformations and understand how, using the pivots of the matrix, to determine when the output of a matrix transformation covers the whole space Rm or when a transformation maps distinct vectors to distinct outputs.

Matrix transformations are used extensively in computer graphics to produce animations as seen in video games and movies. For example, consider the dancing figure at left in Figure 7.1. We can identify certain control points (e.g., the point at the neck, where the arms join the torso, etc.) to mark the locations of important points. Using just the control points we can reconstruct the figure. Each control point can be represented as a vector, and so we can manipulate the figure by manipulating the control points with matrix transformations. We will explore this idea in more detail later in this section.

Figure 7.1. A dancing figure and a rotated dancing figure.

Subsection Introduction

In this section we will consider special functions which take vectors as inputs and produce vectors as outputs. We will use matrix multiplication to produce the output vectors.

If A is an m×n matrix and x is a vector in Rn, then the matrix-vector product Ax is a vector in Rm. (Pick some specific n,m values to understand this statement better.) Therefore, left multiplication by the matrix A takes an input vector x in Rn and produces an output vector Ax in Rm, which we will refer to as the image of x under the transformation. This defines a function T from Rn to Rm where

T(x)=Ax.

These functions are the matrix transformations.

Definition 7.2.

A matrix transformation is a function T:RnRm defined by

T(x)=Ax

for some m×n matrix A.

Many of the transformations we consider in this section are from R2 to R2 so that we can visualize the transformations. As an example, let us consider the transformation T defined by

T([x1x2])=[1001][x1x2].

If we plot the input vectors u1=[10], u2=[01], u3=[12], and u4=[11] (as (blue) circles) and their images T(u1)=[1001][10]=[10], T(u2)=[01], T(u3)=[12], and T(u4)=[11] (as (red) ×'s) on the same set of axes as shown in Figure 7.3, we see that this transformation reflects the input vectors across the x-axis. We can also see this algebraically since the reflection of the point (x1,x2) around the x-axis is the point (x1,x2), and

T([x1x2])=[x1x2].
Figure 7.3. Inputs and outputs of the transformation T.

Preview Activity 7.1.

We now consider other transformations from R2 to R2.

(a)

Suppose a transformation T is defined by

T([x1x2])=[2002][x1x2].
(i)

Find T(ui) for each of u1=[10], u2=[01], u3=[12], and u4=[11]. (In other words, substitute u1,u2,u3,u4 into the formula above to see what output is obtained.)

Plot all input vectors and their images on the same axes in R2. Clearly identify which image corresponds to which input vector. Then give a geometric description of what this transformation does.

(b)

The transformation in the introduction performs a reflection across the x-axis. Find a matrix transformation that performs a reflection across the y-axis.

(c)

Suppose a transformation T is defined by

T(x)=Ax,

where

A=[1000].
(i)

Find T(ui) for each of u1=[10], u2=[01], u3=[12], and u4=[11].

(ii)

Plot all input vectors and their images on the same axes in R2. Give a geometric description of this transformation.

(iii)

Is there an input vector which produces b=[11] as an output vector?

(iv)

Find all input vectors that produce the output vector b=[10]. Is there a unique input vector, or multiple input vectors?

Subsection Properties of Matrix Transformations

A matrix transformation is a function. When dealing with functions in previous mathematics courses we have used the terms domain and range with our functions. Recall that the domain of a function is the set of all allowable inputs into the function and the range of a function is the set of all outputs of the function. We do the same with transformations. If T is the matrix transformation T(x)=Ax for some m×n matrix A, then T maps vectors from Rn into Rm. So Rn is the domain of T — the set of all input vectors. However, the set Rm is only the target set for T and not necessarily the range of T. We call Rm the codomain of T, while the range of T is the set of all output vectors. The range of a transformation will come up later, so we make a formal definition.

Definition 7.4.

The range of a matrix transformation T from Rn to Rm is the set

RangeT={T(x):xRn}.

The range is always a subset of the codomain, but the two sets do not have to be equal. In addition, if a vector b in Rm satisfies b=T(x) for some x in Rn, then we say that b is the image of x under the transformation T. For this reason we also use the term image to also mean the range of a transformation, with the corresponding notation Im(T).

Because of the properties of the matrix-vector product, if the matrix transformation T is defined by T(x)=Ax for some m×n matrix A, then

T(u+v)=A(u+v)=Au+Av

and

T(cu)=A(cu)=cAu=cT(u)

for any vectors u and v in Rn and any scalar c. So every matrix transformation T satisfies the following two important properties:

  1. T(u+v)=T(u)+T(v) and

  2. T(cu)=cT(v).

The first property says that a matrix transformation T preserves sums of vectors and the second that T preserves scalar multiples of vectors.

Activity 7.2.

Let T be a matrix transformation, and let u and v be vectors in the domain of T so that T(u)=[120] and T(v)=[314].

(a)

Exactly which vector is T(2u3v)? Explain.

(b)

If a and b are any scalars, what is the vector T(au+bv)? Why?

As we saw in Activity 7.2, we can combine the two properties of a matrix transformation T into one: for any scalars a and b and any vectors u and v in the domain of T we have

(7.1)T(au+bv)=aT(u)+bT(v).

We can then extend equation (7.1) (by mathematical induction) to any finite linear combination of vectors. That is, if v1, v2, , vk are any vectors in the domain of a matrix transformation T and if x1, x2, , xk are any scalars, then

(7.2)T(x1v1+x2v2++xkvk)=x1T(v1)+x2T(v2)++xkT(vk).

In other words, a matrix transformation preserves linear combinations. For this reason matrix transformations are examples of a larger set of transformation that are called linear transformations. We will discuss general linear transformations in a later section.

There is one other important property of a matrix transformation for us to consider. The functions we encountered in earlier mathematics courses, e.g., f(x)=2x+1, could send the input 0 to any output. However, as a consequence of the definition, any matrix transformation T maps the zero vector to the zero vector because

T(0)=A0=0.

Note that the two vectors 0 in the last equation may not be the same vector — if T:RnRm, then the first 0 is in Rn and the second in Rm. It should be clear from the context which vector 0 is meant.

Subsection Onto and One-to-One Transformations

The problems we have been asking about solutions to systems of linear equations can be rephrased in terms of matrix transformations. The question about whether a system Ax=b is consistent for any vector b is also a question about the existence of a vector x so that T(x)=b, where T is the matrix transformation defined by T(x)=Ax.

Activity 7.3.

Let T be the matrix transformation defined by T(x)=Ax where A is

[100102].
(a)

Find T([11]) and T([111]). If it is not possible to find one or both of the output vectors, indicate why.

(b)

What are the domain and codomain of T? Why? (Recall that the domain is the space of all input vectors, while the codomain is the space in which the output vectors are contained.)

(c)

Can you find a vector x for which T(x)=[236]? Can you find a vector x for which T(x)=[231]?

(d)

Which b=[abc] are the image vectors for this transformation? Is the range of T equal to the codomain of T? Explain.

(e)

The previous question can be rephrased as a matrix equation question. We are asking whether Ax=b is consistent for every b. How is the answer to this question related to the pivots of A?

If T is a matrix transformation, Activity 7.3 illustrates that the range of a matrix transformation T may not equal its codomain. In other words, there may be vectors b in the codomain of T that are not the image of any vector in the domain of T. If it is the case for a matrix transformation T that there is always a vector x in the domain of T such that T(x)=b for any vector b in the codomain of T, then T is given a special name.

Definition 7.5.

A matrix transformation T from Rn to Rm is onto if each b in Rm is the image of at least one x in Rn.

So the matrix transformation T from Rn to Rm defined by T(x)=Ax is onto if the equation Ax=b has a solution for each vector b in Rm. Since the vectors Ax are linear combinations of the columns of A, T is onto exactly when the span of the columns of A is all of Rm. Activity 7.3 shows us that T is onto if every row of A contains a pivot.

Another question to ask about matrix transformations is how many vectors there can be that map onto a given output vector.

Activity 7.4.

Let T be the matrix transformation defined by T(x)=Ax where A is

[130001].
(a)

Find T([11]) and T([111]). If it is not possible to find one or both of the output vectors, indicate why.

(b)

What are the domain and codomain of T? Why?

(c)

Find T([112]). Are there any other x's for which T(x) is this same output vector?

Hint.

Set up an equation to solve for such x's.

(d)

Assume more generally that for some vector b, there is a vector x so that T(x)=b. Write this as a matrix equation to determine how many solutions this equation has. Explain. How is the answer to this question related to the pivots of A?

The uniqueness of a solution to Ax=b is the same as saying that the matrix transformation T defined by T(x)=Ax maps exactly one vector to b. A matrix transformation T that has the property that every image vector is an image in exactly one way is also a special type of transformation.

Definition 7.6.

A matrix transformation T from Rn to Rm is one-to-one if each b in Rm is the image of at most one x in Rn.

So the matrix transformation T from Rn to Rm defined by T(x)=Ax is one-to-one if the equation Ax=b has a unique solution whenever Ax=b is consistent. Since the vectors Ax are linear combinations of the columns of A, the unique solution requirement indicates that any output vector can be written in exactly one way as a linear combination of the columns of A. This implies that the columns of A are linearly independent. Activity 7.4 indicates that this happens when every column of A is a pivot column.

To summarize, if T is a matrix transformation defined by T(x)=Ax, then T is onto if every row of A contains a pivot, and T is one-to-one if every column of A is a pivot column. It is important to note the difference: being one-to-one depends on the rows of A and being onto depends on the columns of A.

Having a matrix transformation from Rn to Rm can tell us things about m and n. For example, when a matrix transformation from Rn to Rm is one-to-one, it means that there is a unique input vector for every output vector. Since a matrix transformation preserves the algebraic structure of Rn, this implies that the collection of the images of the vectors in the domain of T form a copy of Rn inside of Rm. If we think of T as a one-to-one matrix transformation with T(x)=Ax for some m×n matrix, then every column of A will have to be a pivot column. It follows that if there is a one-to-one matrix transformation from Rn to Rm, we must have mn. Similarly, if a matrix transformation T from Rn to Rm is onto, then for each b in Rm, if we select one vector in the domain of T whose image is b, then the collection of these vectors in the domain of T is a copy of Rm inside of Rn. So if there is an onto matrix transformation from Rn to Rm, then nm. As a consequence, the only way a matrix transformation from Rn to Rm is both one-to-one and onto is if n=m.

We conclude this section by adding new equivalent conditions to Theorem 5.3 and Theorem 6.9 from Section 5 and Section 6.

We will continue to add to these theorems, which will eventually give us many different but equivalent perspectives to look at a linear algebra problem. Please keep these equivalent criteria in mind when considering the best possible approach to a problem.

Subsection Examples

What follows are worked examples that use the concepts from this section.

Example 7.9.

Let A=[111136032158] and let T(x)=Ax.

(a)

Identify the domain of T. Explain your reasoning.

Solution.

Since A is a 3×4 matrix, A has four columns. Now Ax is a linear combination of the columns of A with weights from x, so x must have four entries to correspond to the columns of A. We conclude that the domain of T is R4.

(b)

Is T one-to-one. Explain.

Solution.

Technology shows that the reduced row echelon form of A is

[102301120000].

Since A contains non-pivot columns, the homogeneous system Ax=0 has infinitely many solutions. So T is not one-to-one. In other words, if there is a column of A that is a non-pivot column, then A is not one-to-one.

(c)

Is T onto? If yes, explain why. If no, describe the range of T as best you can, both algebraically and graphically.

Solution.

Since the reduced row echelon form of A has rows of zeros, there will be vectors b in R3 such that the reduced row echelon form of [A b] will have a row of the form [0 0 0 0 c] for some nonzero scalar c. This means that T(x)=Ax=b will have no solution and T is not onto. In other words, if there is a row of A that does not contain a pivot, then T is not onto.

Example 7.10.

A matrix transformation T:R2R2 defined by

T([xy])=[cxy]

is a contraction in the x direction if 0<c<1 and a dilation in the x direction if c>1.

(a)

Find a matrix A such that T(x)=Ax.

Solution.

Since

[c001][xy]=[cxy],

the matrix A=[c001] has the property that T(x)=Ax.

(b)

Sketch the square S with vertices u1=[00], u2=[10], u3=[11], and u4=[01]. Determine and sketch the image of S under T if c=2.

Solution.

We can determine the image of S under T by calculating what T does to the vertices of S. Notice that

T(u1)=[2001][00]=[00]T(u2)=[2001][10]=[20]T(u3)=[2001][11]=[21]T(u4)=[2001][01]=[01]

Since T is a linear map, the image of S under T is the polygon with vertices (0,0), (1,0), (2,1), and (0,1) as shown in Figure 7.11. From Figure 7.11 we can see that T stretches the figure in the x direction only by a factor of 2.

Figure 7.11. The input square S and the output T(S).

Subsection Summary

In this section we determined how to represent any matrix transformation from Rn to Rm as a matrix transformation, and what it means for a matrix transformation to be one-to-one and onto.

  • A matrix transformation is a function T:RnRm defined by T(x)=Ax for some m×n matrix A.

  • A matrix transformation T from Rn to Rm satisfies

    T(au+bv)=aT(u)+bT(v)

    for any scalars a and b and any vectors u and v in Rn. The fact that T preserves linear combinations is why we say that T is a linear transformation.

  • An m×n matrix A defines the matrix transformation T via

    T(x)=Ax.

    The domain of this transformation is Rn because the matrix-vector product Ax is only defined if x is an n×1 vector.

  • If A is an m×n matrix, then the codomain of the matrix transformation T defined by T(x)=Ax is Rm. This is because the matrix-vector product Ax with x an n×1 vector is an m×1 vector. The range of T is the subset of the codomain of T consisting of all vectors of the form T(x) for vectors x in the domain of T.

  • A matrix transformation T from Rn to Rm is one-to-one if each b in Rm is the image of at most one x in Rn. If T is a matrix transformation represented as T(x)=Ax, then T is one-to-one if each column of A is a pivot column, or if the columns of A are linearly independent.

  • A matrix transformation T from Rn to Rm is onto if each b in Rm is the image of at least one x in Rn. If T is a matrix transformation represented as T(x)=Ax, then T is onto if each row of A contains a pivot position, or if the span of the columns of A is all of Rm.

Exercises Exercises

1.

Given matrix A=[121103], write the coordinate form of the transformation T defined by T(x)=Ax. (Note: Writing a transformation in coordinate form refers to writing the transformation in terms of the entries of the input and output vectors.)

2.

Suppose the transformation T is defined by T(x)=Ax where

A=[111211414].

Determine if b=[100] is in the range of T. If so, find all x's which map to b.

3.

Suppose T is a matrix transformation and

T(v1)=[12],T(v2)=[23]

Find T(2v15v2).

4.

Given a matrix transformation defined as

T([x1x2x3])=[2x1x3x1+2x2+x33x24x3]

determine the matrix A for which T(x)=Ax.

5.

Suppose a matrix transformation T defined by T(x)=Ax for some unknown A matrix satisfies

T([10])=[21] and T([01])=[13].

Use the matrix transformation properties to determine T(x) where x=[x1x2]. Use the expression for T(x) to determine the matrix A.

6.

For each of the following matrices, determine if the transformation T defined by T(x)=Ax is onto and if T is one-to-one.

(a)

A=[111123]

(c)

A=[112123112]

7.

Come up with an example of a one-to-one transformation from R3 to R4, if possible. If not, explain why not.

8.

Come up with an example of an onto transformation from R3 to R4, if possible. If not, explain why not.

9.

Come up with an example of a one-to-one but not onto transformation from R4 to R4, if possible. If not, explain why not.

10.

Two students are talking about when a matrix transformation is one-to-one.

Student 1: If we have a matrix transformation, then we need to check that Ax=b has a unique solution for every b for which Ax=b has a solution, right?
Student 2: Well, that's the definition. Each b in the codomain has to be the image of at most one x in the domain. So when b is in the range, corresponding to Ax=b having a solution, then there is exactly one solution x.
Student 1: But wouldn't it be enough to check that Ax=0 has a unique solution? Doesn't that translate to the other b vectors? If there is a unique solution for one b1, then there can't be infinitely many solutions for another b2.
Student 2: I don't know. It feels to me as if changing the right hand side could change whether there is a unique solution, or infinitely many solutions, or no solution.
Which part of the above conversation do you agree with? Which parts need fixing?

11.

Show that if T is a matrix transformation from Rn to Rm and L is a line in Rn, then T(L), the image of L, is a line or a single vector. (Note that a line in Rn is the set of all vectors of the form v+cw where c is a scalar, and v,w are two fixed vectors in Rn.)

12.

Label each of the following statements as True or False. Provide justification for your response.

(a) True/False.

The range of a transformation is the same as the codomain of the transformation.

(b) True/False.

The codomain of a transformation T defined by T(x)=Ax is the span of the columns of A.

(c) True/False.

A one-to-one transformation is a transformation where each input has a unique output.

(d) True/False.

A one-to-one transformation is a transformation where each output can only come from a unique input.

(e) True/False.

If a matrix transformation from Rn to Rn is one-to-one, then it is also onto.

(f) True/False.

A matrix transformation from R2 to R3 cannot be onto.

(g) True/False.

A matrix transformation from R3 to R2 cannot be onto.

(h) True/False.

A matrix transformation from R3 to R2 cannot be one-to-one.

(i) True/False.

If the columns of a matrix A are linearly independent, then the transformation T defined by T(x)=Ax is onto.

(j) True/False.

If the columns of a matrix A are linearly independent, then the transformation T defined by T(x)=Ax is one-to-one.

(k) True/False.

If A is an m×n matrix with n pivots, then the transformation xAx is onto.

(l) True/False.

If A is an m×n matrix with n pivots, then the transformation xAx is one-to-one.

(m) True/False.

If u is in the range of a matrix transformation T, then there is an x in the domain of T such that T(x)=u.

(n) True/False.

If T is a one-to-one matrix transformation, then T(x)=0 has a non-trivial solution.

(o) True/False.

If the transformations T1:RmRn and T2:RnRp are onto, then the transformation T2T1 defined by T2T1(x)=T2(T1(x)) is also onto.

(p) True/False.

If the transformations T1:RmRn and T2:RnRp are one-to-one, then the transformation T2T1 defined by T2T1(x)=T2(T1(x)) is also one-to-one.

Subsection Project: The Geometry of Matrix Transformations

In this section we will consider certain types of matrix transformations and analyze their geometry. Much more would be needed for real computer graphics, but the essential ideas are contained in our examples. A GeoGebra applet is available at geogebra.org/m/rh4bzxee for you to use to visualize the transformations in this project.

Project Activity 7.5.

We begin with transformations that produce the rotated dancing image in Figure 7.1. Let R be the matrix transformation from R2 to R2 defined by

R([xy])=[cos(θ)sin(θ)sin(θ)cos(θ)][xy].

These matrices are the rotation matrices.

(a)

Suppose θ=π2. Then

R([xy])=[0110][xy].
(i)

Find the images of u1=[10], u2=[2222], and u3=[01] under R.

(ii)

Plot the points determined by the vectors from part i. The matrix transformation R performs a rotation. Based on this small amount of data, what would you say the angle of rotation is for this transformation R?

(b)
>

Now let R be the general matrix transformation defined by the matrix

[cos(θ)sin(θ)sin(θ)cos(θ)].

Follow the steps indicated to show that R performs a counterclockwise rotation of an angle θ around the origin. Let P be the point defined by the vector [xy]=[cos(α)sin(α)] and Q the point defined by the vector [wz]=[cos(α+θ)sin(α+θ)] as illustrated in Figure 7.12.

Figure 7.12. A rotation in the plane.

(i)

Use the angle sum trigonometric identities

cos(A+B)=cos(A)cos(B)sin(A)sin(B)sin(A+B)=cos(A)sin(B)+cos(B)sin(A)

to show that

w=cos(θ)xsin(θ)yz=sin(θ)x+cos(θ)y.
(ii)

Now explain why the counterclockwise rotation around the origin by an angle θ can be represented by left multiplication by the matrix

[cos(θ)sin(θ)sin(θ)cos(θ)].

Project Activity 7.5 presented the rotation matrices. Other matrices have different effects.

Project Activity 7.6. Different matrix transformations.

(a)

Let S be the matrix transformation from R2 to R2 defined by

S([xy])=[10.501][xy].

Determine the entries of the output vector S([xy]) and explain the action of the transformation S on the dancing figure as illustrated in Figure 7.13. (The transformation S is called a shear in the x direction.)

Figure 7.13. A dancing figure and a sheared dancing figure.

(b)

Let C be the matrix transformation from R2 to R2 defined by

C([xy])=[0.65000.65][xy].

Determine the entries of the output vector C([xy]) and explain the action of the transformation C on the dancing figure as illustrated in Figure 7.14. (The transformation C is called a contraction.) How would your response change if each 0.65 was changed to 2 in the matrix C?

Figure 7.14. A dancing figure and a contracted dancing figure.

So far we have seen specific matrix transformations perform a rotations, shears, and contractions. We can combine these, and other, matrix transformations by composition to change figures in different ways, and to created animations of geometric figures. (As we will see later, combining transformations needs to be done carefully in order to obtain the result we want. For example, if we want to first rotate then translate, in what order should the matrices be applied?)