2.5: Matrix transformations
\(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\twovec}[2]{\begin{pmatrix} #1 \\ #2 \end{pmatrix} } \) \(\newcommand{\threevec}[3]{\begin{pmatrix} #1 \\ #2 \\ #3 \end{pmatrix} } \) \(\newcommand{\fourvec}[4]{\begin{pmatrix} #1 \\ #2 \\ #3 \\ #4 \end{pmatrix} } \) \(\newcommand{\fivevec}[5]{\begin{pmatrix} #1 \\ #2 \\ #3 \\ #4 \\ #5 \end{pmatrix} } \)The past few sections introduced us to vectors and linear combinations as a means of thinking geometrically about the solutions to a linear system. Using matrix-vector multiplication, we rewrote a linear system as a matrix equation \(A\mathbf x = \mathbf b\) and used the concepts of span and linear independence to understand when solutions exist and when they are unique.
In this section, we will explore how matrix-vector multiplication defines certain types of functions, which we call matrix transformations , similar to those encountered in previous algebra courses. In particular, we will develop some algebraic tools for thinking about matrix transformations and look at some motivating examples. In the next section, we will see how matrix transformations describe important geometric operations and how they are used in computer animation.
Preview Activity 2.5.1.
We will begin by considering a more familiar situation; namely, the function \(f(x) = x^2\text{,}\) which takes a real number \(x\) as an input and produces its square \(x^2\) as its output.
- What is the value of \(f(3)\text{?}\)
- Can we solve the equation \(f(x) = 4\text{?}\) If so, is the solution unique?
- Can we solve the equation \(f(x) = -10\text{?}\) If so, is the solution unique?
- Sketch a graph of the function \(f(x)=x^2\) in Figure 2.5.1
- Remember that the range of a function is the set of all possible outputs. What is the range of the function \(f\text{?}\)
- We will now consider functions having the form \(g(x)=mx\text{.}\) Draw a graph of the function \(g(x) = 2x\) on the left in Figure 2.5.2.
- Draw a graph of the funcion \(h(x) = -\frac13 x\) on the right of Figure 2.5.2.
- Remember that composing two functions means we use the output from one function as the input into the other. That is, \(g\circ h(x) = g(h(x))\text{.}\) What function results from composing \(g\circ h(x)\text{?}\) How is the composite function related to the two functions \(g\) and \(h\text{?}\)
Matrix transformations
In the preview activity, we considered simple linear functions, such as \(g(x) = \frac12 x\) whose graph is the line shown in Figure 2.5.3. We construct a function like this by choosing a number \(m\text{;}\) when given an input \(x\text{,}\) the output \(g(x) = mx\) is formed by multiplying \(x\) by \(m\text{.}\)
In this section, we will consider functions defined through matrix-vector multiplication. That is, we will choose a matrix \(A\text{;}\) when given an input \(\mathbf x\text{,}\) the function \(T(\mathbf x) = A\mathbf x\) forms the product \(A\mathbf x\) as its output. Such a function is called a matrix transformation .
Activity 2.5.2.
In this activity, we will look at some examples of matrix transformations.
-
To begin, suppose that \(A\) is the matrix
\begin{equation*} A = \left[\begin{array}{rr} 2 & 1 \\ 1 & 2 \\ \end{array}\right]\text{.} \end{equation*}
We define the matrix transformation \(T(\mathbf x) = A\mathbf x\) so that
\begin{equation*} T\left[\twovec{-2}{3}\right] = A\twovec{-2}{3} = \left[\begin{array}{rr} 2 & 1 \\ 1 & 2 \\ \end{array}\right] \twovec{-2}{3} = \twovec{-1}{4}\text{.} \end{equation*}The function \(T\) takes the vector \(\twovec{-2}{3}\) as an input and gives us \(\twovec{-1}{4}\) as the output.
- What is \(T\left[\twovec{1}{-2}\right]\text{?}\)
- What is \(T\left[\twovec{1}{0}\right]\text{?}\)
- What is \(T\left[\twovec{0}{1}\right]\text{?}\)
- Is there a vector \(\mathbf x\) such that \(T(\mathbf x) = \twovec{3}{0}\text{?}\)
-
Suppose that \(T(\mathbf x) = A\mathbf x\) where
\begin{equation*} A=\left[\begin{array}{rrrr} 3 & 3 & -2 & 1 \\ 0 & 2 & 1 & -3 \\ -2 & 1 & 4 & -4 \end{array}\right]\text{.} \end{equation*}
- What is the dimension of the vectors \(\mathbf x\) that are inputs for \(T\text{?}\)
- What is the dimension of the vectors \(T(\mathbf x)=A\mathbf x\) that are outputs?
- Describe the vectors \(\mathbf x\) for which \(T(\mathbf x) = \zerovec\text{.}\)
- If \(A\) is the matrix \(A=\left[\begin{array}{rr} \mathbf v_1 & \mathbf v_2 \end{array}\right]\text{,}\) what is \(T\left[\twovec{0}{1}\right]\) in terms of the vectors \(\mathbf v_1\) and \(\mathbf v_2\text{?}\)
-
Suppose that \(A\) is a \(3\times 2\) matrix and that \(T(\mathbf x)=A\mathbf x\text{.}\) If
\begin{equation*} T\left[\twovec{1}{0}\right] = \threevec{3}{-1}{1}, T\left[\twovec{0}{1}\right] = \threevec{2}{2}{-1}\text{,} \end{equation*}
what is the matrix \(A\text{?}\)
Let's discuss a few of the issues that appear in this activity. First, if \(A\) is an \(m\times n\) matrix, we can form the matrix product \(A\mathbf x\) when \(\mathbf x\) is an \(n\)-dimensional vector in \(\mathbb R^n\text{.}\) The resulting product \(A\mathbf x\) is an \(m\)-dimensional vector in \(\mathbb R^m\text{.}\) If \(T(\mathbf x) = A\mathbf x\text{,}\) we therefore write \(T:\mathbb R^n\to\mathbb R^m\) meaning \(T\) takes vectors in \(\mathbb R^n\) as inputs and produces vectors in \(\mathbb R^m\) as outputs. For instance, if
then \(T:\mathbb R^4\to\mathbb R^2\text{.}\)
If we know the matrix \(A\text{,}\) then we can form the matrix transformation \(T(\mathbf x) = A\mathbf x\text{.}\) However, if we only know the values of the matrix transformation \(T\text{,}\) we can reconstruct the matrix \(A\text{.}\) The key is to remember that matrix-vector multiplication constructs a linear combination. For instance, if \(A\) is a \(m\times2\) matrix \(A=\left[\begin{array}{rr} \mathbf v_1 & \mathbf v_2 \end{array}\right]\text{,}\) then
That is, we can find the first column of \(A\) by evaluating \(T\left[\twovec{1}{0}\right]\text{.}\) Similarly, the second column of \(A\) is found by evaluating \(T\left[\twovec{0}{1}\right]\text{.}\)
More generally, we will write
so that
This means that the \(j^{th}\) column of \(A\) is found by evaluating \(T(\mathbf e_j)\text{.}\) We record this fact in the following proposition.
If \(T:\mathbb R^n\to\mathbb R^m\) is a matrix transformation given by \(T(\mathbf x) = A\mathbf x\text{,}\) then the matrix \(A\) has columns \(T(\mathbf e_j)\text{;}\) that is,
We will look at some examples of matrix transformations in the following activity.
Activity 2.5.3.
Suppose that we work for a company that produces baked goods, including cakes, donuts, and eclairs. Our company operates two plants, Plant 1 and Plant 2. In one hour of operation,
- Plant 1 produces 10 cakes, 50 donuts, and 30 eclairs.
- Plant 2 produces 20 cakes, 30 donuts, and 30 eclairs.
- If plant 1 operates for \(x_1\) hours and Plant 2 for \(x_2\) hours, how many cakes \(C\) does the company produce? How many donuts \(D\text{?}\) How many eclairs \(E\text{?}\)
- We define a matrix transformation \(T(\mathbf x) = \threevec{C}{D}{E}\) where \(\threevec{C}{D}{E}\) represents the number of baked goods produced when the plants are operated for times \(\mathbf x=\twovec{x_1}{x_2}\text{.}\) If \(T(\mathbf x) = A\mathbf x\text{,}\) what are the dimensions of the matrix \(A\text{?}\)
- Find the vector \(T\left[\twovec{1}{0}\right]\) and the vector \(T\left[\twovec{0}{1}\right]\) and use your results to write the matrix \(A\text{.}\)
- If we operate Plant 1 for 40 hours and Plant 2 for 50 hours, how many baked goods have we produced?
- Suppose the marketing department says we need to produce 1500 cakes, 4700 donuts, and 3300 eclairs. Is it possible to meet this order? If so, how long should the two plants operate?
-
Let's now consider the needed ingredients:
- Each cake requires 4 units of flour and and 2 units of sugar.
- Each donut requires 1 unit of flour and 1 unit of sugar.
- Each eclair requires 1 units of flour and 2 units of sugar.
Suppose we make \(C\) cakes, \(D\) donuts, and \(E\) eclairs. How many units of flour \(F\) are required? How many units of sugar \(S\text{?}\)
- Write a matrix \(B\) that defines the matrix transformation \(R\left[\threevec{C}{D}{E}\right] = \twovec{F}{S}\text{.}\)
- If Plant 1 operates for 30 hours and Plant 2 operates for 20 hours, how many units of flour and sugar are required?
- We can consider the matrix transformation \(P(\mathbf x) = \twovec{F}{S}\) that tells us how many units of flour and sugar are required when we operate the plants for \(x_1\) and \(x_2\) hours. Find the matrix that defines the transformation \(P\text{.}\)
In this activity, we considered two matrix transformations and constructed a third using composition. We began with the matrix transformation \(T\) that tells us the number of baked goods produced when the plants are operated for a certain amount of time. If we write the times as \(\mathbf x = \twovec{x_1}{x_2}\text{,}\) then \(\twovec{1}{0}\) represents the situation where Plant 1 operates for one hour and Plant 2 is not operated. We are told that, in this one hour, Plant 1 produces 10 cakes, 50 donuts, and 30 eclairs. We therefore have
Similarly,
which tells us that the matrix \(A\) that defines \(T\) is
In the same way, we use the matrix transformation \(R\left[\threevec{C}{D}{E}\right] = \twovec{F}{S}\) to describe the ingredients required to make a certain number of cakes, donuts, and eclairs. We see that
which means that the matrix defining \(R\) is
Finally, we wish to compose these two matrix transformations. For instance, if we operate the plants for times given by the vector \(\mathbf x\text{,}\) we would like to know the required amounts of the ingredients. To determine this, notice that \(T(\mathbf x) = A\mathbf x\) tells us how many cakes, donuts, and eclairs we produce. The ingredients required are then given by
Notice that the matrix that defines the composition is given by the product of the two matrices defining the matrix transformations.
In this case, we have
This means that the matrix transformation that tells us the required amount of ingredients given the amount of time that the plants are operated is described by
For instance, if Plant 1 operates for 30 hours and Plant 2 for 20 hours, we have
In other words, we need 6400 units of flour and 6500 units of sugar.
This activity shows that the composition of matrix transformations corresponds to the product of matrices, an important observation that we summarize in the following proposition.
If we have a matrix transformation \(T\) defined by the matrix \(A\) and a matrix transformation \(S\) defined by the matrix \(B\text{,}\) then the composition of the matrix transformations is a new matrix transformation \(S\circ T\) defined by the matrix \(BA\text{.}\)
Discrete Dynamical Systems
In Section 4.4 , we will give considerable attention to a specific type of matrix transformation, which is illustrated in the next activity.
Activity 2.5.4.
Suppose we run a company that has two warehouses, which we will call \(P\) and \(Q\text{,}\) and a fleet of 1000 delivery trucks. Every day, a delivery truck goes out from one of the warehouses and returns every evening to one of the warehouses. Every evening,
- 70% of the trucks that leave \(P\) return to \(P\text{.}\) The other 30% return to \(Q\text{.}\)
- 50% of the trucks that leave \(Q\) return to \(Q\) and 50% return to \(P\text{.}\)
We will use the vector \(\mathbf x=\twovec{P}{Q}\) to represent the number of trucks at location \(P\) and \(Q\) in the morning. We consider the matrix transformation \(T(\mathbf x) = \twovec{P'}{Q'}\) that describes the number of trucks at location \(P\) and \(Q\) in the evening.
-
Suppose that all 1000 trucks begin the day at location \(P\) and none at \(Q\text{.}\) How many trucks are at each location at the end of the day? Therefore, what is the vector \(T\left[\twovec{1000}{0}\right]\text{?}\)
Using this result, what is \(T\left[\twovec{1}{0}\right]\text{?}\)
- In the same way, suppose that all 1000 trucks begin the day at location \(Q\) and none at \(P\text{.}\) How many trucks are at each location at the end of the day? What is the result \(T\left[\twovec{0}{1000}\right]\text{?}\)
- Find the matrix \(A\) such that \(T(\mathbf x) = A\mathbf x\text{.}\)
- Suppose that there are 100 trucks at \(P\) and 900 at \(Q\) at the beginning of the day. How many are there at the two locations at the end of the day?
- Suppose that there are 550 trucks at \(P\) and 450 at \(Q\) at the end of the day. How many trucks were there at the two locations at the beginning of the day?
-
Suppose that all of the trucks are at location \(Q\) on Monday morning?
- How many trucks are at each location Monday evening?
- How many trucks are at each location Tuesday evening?
- How many trucks are at each location Wednesday evening?
- Suppose that \(S\) is the matrix transformation that transforms the distribution of trucks \(\mathbf x\) one morning into the distribution of trucks two mornings later. What is the matrix that defines the transformation \(S\text{?}\)
- Suppose that \(R\) is the matrix transformation that transforms the distribution of trucks \(\mathbf x\) one morning into the distribution of trucks one week later. What is the matrix that defines the transformation \(R\text{?}\)
- What happens to the distribution of trucks after a very long time?
This is type of situation occurs frequently. We have a vector \(\mathbf x\) that describes the state of some system; in this case, \(\mathbf x\) describes the distribution of trucks between the two locations at a particular time. Then we have a matrix \(A\) that defines a matrix transformation with \(T(\mathbf x) = A\mathbf x\) describing the state at some later time. We call \(\mathbf x\) the state vector and \(T\) the transition function, as it describes the transition of the state vector from one time to the next.
We begin in an initial state \(\mathbf x_0= \left [\twovec{0}{1000}\right]\text{.}\) The state one day later will be the vector \(\mathbf x_1 = T(\mathbf x_0) = A\mathbf x_0\text{.}\) In the example from our activity, we have
Therefore,
We can, of course, repeat this process. The vector \(\mathbf x_1\) describes the state after one day. After a second day, we have the state vector
We can continue this process finding \(\mathbf x_k\text{,}\) the state after \(k\) days using \(\mathbf x_k = A\mathbf x_{k-1} = A^k\mathbf x_0\text{.}\) In this way, we see that the long-term behavior of the state vector is determined by the powers of the matrix \(A\text{.}\)
Using Sage, we can compute \(A^k\) for some very large powers of \(A\text{.}\) For instance,
In fact, all large powers of \(A\) look very close to this matrix. Therefore, after a very long time, the state vector is very close to
This means that, eventually, 625 cars are at location \(P\) every day and 375 are at \(Q\text{.}\)
We call this sitution in which the state of a system evolves from one time to the next according to the rule \(\mathbf x_{k+1}=A\mathbf x_k\) a discrete dynamical system . In Chapter 4 , we will develop a theory that enables us to easily make long-term predictions without needing to compute large powers of the matrix.
Summary
This section introduced matrix transformations, functions that are defined by matrix-vector multiplication, such as \(T(\mathbf x) = A\mathbf x\) for some matrix \(A\text{.}\)
- If \(A\) is an \(m\times n\) matrix, then \(T:\mathbb R^n\to\mathbb R^m\text{.}\)
-
The columns of the matrix \(A\) are given by evaluating the transformation \(T\) on the vectors \(\mathbf e_j\text{;}\) that is,
\begin{equation*} A=\left[\begin{array}{rrrr} T(\mathbf e_1) & T(\mathbf e_2) & \ldots & T(\mathbf e_n) \end{array}\right]\text{.} \end{equation*}
- The composition of matrix transformations corresponds to matrix multiplication.
- A discrete dynamical system consists of a state vector \(\mathbf x\) along with a transition function \(T(\mathbf x) = A\mathbf x\) that describes how the state vector evolves from one time to the next. Powers of the matrix \(A\) determine the long-term behavior of the state vector.
Exercises 2.5.4
Suppose that \(T\) is the matrix transformation defined by the matrix \(A\) and \(S\) is the matrix transformation defined by \(B\) where
- If \(T:\mathbb R^n\to\mathbb R^m\text{,}\) what are the values of \(m\) and \(n\text{?}\) What values of \(m\) and \(n\) are appropriate for the transformation \(S\text{?}\)
- Evaluate the matrix transformation \(T\left[\threevec{1}{-3}{2}\right]\text{.}\)
- Evaluate the matrix transformation \(S\left[\threevec{-2}{2}{1}\right]\text{.}\)
- Evaluate the matrix transformation \(S\circ T\left[\threevec{1}{-3}{2}\right]\text{.}\)
- Find the matrix \(C\) that defines the matrix transformation \(S\circ T\text{.}\)
Determine whether the following statements are true or false and provide a justification for your response.
- A matrix transformation \(T:\mathbb R^4\to\mathbb R^5\) is defined by \(T(\mathbf x) = A\mathbf x\) where \(A\) is a \(4\times5\) matrix.
- If \(T:\mathbb R^3\to\mathbb R^2\) is a matrix transformation, then there are infinitely many vectors \(\mathbf x\) such that \(T(\mathbf x) = \zerovec\text{.}\)
- If \(T:\mathbb R^2\to\mathbb R^3\) is a matrix transformation, then it is possible that every equation \(T(\mathbf x) = \mathbf b\) has a solution for every vector \(\mathbf b\text{.}\)
- If \(T:\mathbb R^n\to\mathbb R^m\) is a matrix transformation, then the equation \(T(\mathbf x) = \zerovec\) always has a solution.
- If \(T:\mathbb R^n\to\mathbb R^m\) is a matrix transformation and \(\mathbf v\) and \(\mathbf w\) two vectors in \(\mathbb R^n\text{,}\) then the vectors \(T(\mathbf v + t\mathbf w)\) form a line in \(\mathbb R^m\text{.}\)
This problem concerns the identification of matrix transformations.
-
Check that the following function \(T:\mathbb R^3\to\mathbb R^2\) is a matrix transformation by finding a matrix \(A\) such that \(T(\mathbf x) = A\mathbf x\text{.}\)
\begin{equation*} T\left[\threevec{x_1}{x_2}{x_3}\right] = \left[\begin{array}{c} 3x_1 - x_2 + 4x_3 \\ 5x_2 - x_3 \\ \end{array}\right]\text{.} \end{equation*}
-
Explain why
\begin{equation*} T\left[\threevec{x_1}{x_2}{x_3}\right] = \left[\begin{array}{c} 3x_1^4 - x_2 + 4x_3 \\ 5x_2 - x_3 \\ \end{array}\right] \end{equation*}
is not a matrix transformation.
Suppose that the matrix
defines the matrix transformation \(T:\mathbb R^3\to\mathbb R^3\text{.}\)
- Describe the vectors \(\mathbf x\) that satisfy \(T(\mathbf x) = \zerovec\text{.}\)
- Describe the vectors \(\mathbf x\) that satisfy \(T(\mathbf x) = \threevec{-8}{9}{2}\text{.}\)
- Describe the vectors \(\mathbf x\) that satisfy \(T(\mathbf x) = \threevec{-8}{2}{-4}\text{.}\)
Suppose \(T:\mathbb R^3\to\mathbb R^2\) is a matrix transformation with \(T(\mathbf e_j) = \mathbf v_j\) where \(\mathbf v_1\text{,}\) \(\mathbf v_2\text{,}\) and \(\mathbf v_3\) are as shown in Figure 2.5.6.
- Sketch the vector \(T\left[\threevec{2}{1}{2}\right]\text{.}\)
- What is the vector \(T\left[\threevec{0}{1}{0}\right]\text{?}\)
- Find all the vectors \(\mathbf x\) such that \(T(\mathbf x) = \zerovec\text{.}\)
Suppose that a company has three plants, called Plants 1, 2, and 3, that produce milk \(M\) and yogurt \(Y\text{.}\) For every hour of operation,
- Plant \(1\) produces 20 units of milk and 15 units of yogurt.
- Plant \(2\) produces 30 units of milk and 5 units of yogurt.
- Plant \(3\) produces 0 units of milk and 40 units of yogurt.
- Suppose that \(x_1\text{,}\) \(x_2\text{,}\) and \(x_3\) record the amounts of time that the three plants are operated. Find expressions for the number of units of milk \(M\) and yogurt \(Y\) produced.
- If we write \(\mathbf x=\threevec{x_1}{x_2}{x_3}\) and \(\mathbf y) = \twovec{M}{Y}\text{,}\) find the matrix \(A\) that defines the matrix transformation \(T(\mathbf x) = \mathbf y)\text{.}\)
-
Furthermore, suppose that producing each unit of
- milk requires 5 units of electricity and 8 units of labor.
- yogurt requires 6 units of electricity and 10 units of labor.
Write expressions for the required amounts of electricity \(E\) and labor \(L\) in terms of \(M\) and \(Y\text{.}\)
- If we write the vector \(\mathbf z) = \twovec{E}{L}\) to record the required amounts of electricity and labor, find the matrix \(B\) that defines the matrix transformation \(S(\mathbf y)) = \mathbf z)\text{.}\)
- If \(\mathbf x = \threevec{30}{20}{10}\) describes the amounts of time that the three plants are operated, how much milk and yogurt is produced? How much electricity and labor are required?
- Find the matrix \(C\) that describes the matrix transformation \(R(\mathbf x)=\mathbf z)\) that gives the required amounts of electricity and labor when the plants are operated times given by vector \(\mathbf x\text{.}\)
Suppose that \(T:\mathbb R^2\to\mathbb R^2\) is a matrix transformation and that
- Find the vector \(T\left[\twovec{1}{0}\right]\text{.}\)
- Find the matrix \(A\) that defines \(T\text{.}\)
- Find the vector \(T\left[\twovec{4}{-5}\right]\text{.}\)
Suppose that two species \(P\) and \(Q\) interact with one another and that we measure their populations every month. We record their populations in a state vector \(\mathbf x = \twovec{p}{q}\text{,}\) where \(p\) and \(q\) are the populations of \(P\) and \(Q\text{,}\) respectively. We observe that there is a matrix
such that the matrix transformation \(T(\mathbf x)=A\mathbf x\) is the transition function describing how the state vector evolves from month to month. We also observe that, at the beginning of July, the populations are described by the state vector \(\mathbf x=\twovec{1}{2}\text{.}\)
- What will the populations be at the beginning of August?
- What were the populations at the beginning of June?
- What will the populations be at the beginning of December?
- What will the populations be at the beginning of July in the following year?
Students in a school are sometimes absent due to an illness. Suppose that
- 95% of the students who attend school will attend school the next day.
- 50% of the students are absent one day will be absent the next day.
We will record the number of present students \(p\) and the number of absent students \(a\) in a state vector \(\mathbf x=\twovec{p}{a}\text{.}\) On Tuesday, the state vector is \(\mathbf x=\left [\twovec{1700}{100}\right]\text{.}\) The state vector evolves from one day to the next according to the transition function \(T:\mathbb R^2\to\mathbb R^2\text{.}\)
- Suppose we initially have 1000 students who are present and none absent. Find \(T\left[\left( \twovec{1000}{0}\right]\text{.}\)
- Suppose we initially have 1000 students who are absent and none present. Find \(T\left[\left( \twovec{0}{1000}\right]\text{.}\)
- Use the results of parts a and b to find the matrix \(A\) that defines the matrix transformation \(T\text{.}\)
- If \(\mathbf x=\left( \twovec{1700}{100}\right]\) on Tuesday, how are the students distributed on Wednesday?
- How many students were present on Monday?
- How many students are present on the following Tuesday?
- What happens to the number of students who are present after a very long time?