Math 343 Fall 2012 Day 14 Transforming Graphics: An Application of Linear Transformations (Sample Solution) Background We can make use of linear transformations in the world of graphic design. A picture in a plane can be stored as a set of vertices. These vertices can then be plotted and connected with line segments. (Your childhood connect-the-dot skills will be useful!) We can store the ordered pairs of vertices as columns in a matrix. Then each successive vertex is connected with a line segment. For example: 1 3 2 1 9 9 7 9 would be a triangle. Notice, the first vertex is listed twice in order to completely connect this triangle. If we want to transform a shape, we can just worry about where these vertices need to go. Task 1: Graph the regions represented by the following matrices onto one coordinate plane: R1 = R4 = 1 3 2 1 9 9 7 9 , R2 = 5 7 6 5 9 9 7 9 , R3 = 1 2 3 4 5 6 7 6 5 4 3 2 1 3 2 3 2 3 2 3 1 2 1 2 1 3 1 4 5 3 4 6 4 4 6 , Task 2: (Dilation). Create a matrix representation for a linear transformation that will shrink the regions by a factor of 2. (Recall the geometric transf ormation that scales a f igure is called a dilation. Actually, this process has a lot of names like resizing, scaling, 2 contracting, enlarging...) You are trying to find the matrix that we can multiply R1 , R2 , R3 and R4 that will move the vertices in a way that will scale properly. Since we are in R2 , you may want to consider what is going on with the standard basis. If we are shrinking by 2, we want each coordinate to decrease by a factor of 1/2. So, L(x, y) = ( 21 x, 21 y). The matrix representation is: 1 2 0 0 1 2 . Remember, since we are working in the standard basis, the matrix representation will have columns L(e1 ) and L(e2 ). Task 3: After creating your dilation matrix, multiply the region matrices and plot your new vertices. Connect your vertices with line segments where appropriate. Verify that the new picture is half as large as the original. Region 1: 1 0 1 3 2 1 1/2 3/2 1 1/2 2 = 0 12 9 9 7 9 9/2 9/2 7/2 9/2 Region 2: 1 0 5 7 6 5 5/2 7/2 3 5/2 2 = 9/2 9/2 7/2 9/2 0 12 9 9 7 9 Region 3: 1 2 0 0 1 2 4 5 3 4 6 4 4 6 = 2 5/2 3/2 3 3 2 2 3 Region 4: 1 2 0 = 0 1 2 1 2 3 4 5 6 7 6 5 4 3 2 1 3 2 3 2 3 2 3 1 2 1 2 1 3 1/2 1 3/2 2 5/2 3 7/2 3 5/2 2 3/2 1 1/2 3/2 1 3/2 1 3/2 1 3/2 1/2 1 1/2 1 1/2 3/2 3 Task 4: (Reflection) Create a linear transformation that will reflect our picture over the x-axis. What does the matrix representation look like? Reflecting over the x-axis will cause all of the y-values to switch sign. So L(x, y) = (x, −y). Then L(e1 ) = (1, 0) and L(e2 ) = (0, −1). The matrix will look like: 1 0 . 0 −1 Task 5: Find the matrix that will reflect our vertices over the y-axis. Reflecting over the y-axis will cause all of the x-values to switch sign. So L(x, y) = (−x, y). Then L(e1 ) = (−1, 0) and L(e2 ) = (0, 1). The matrix will look like: −1 0 . 0 1 4 Task 6: (Rotation) Suppose, we wanted to rotate our picture 120 degrees counterclockwise about the origin. Find the appropriate linear transformation and matrix representation. Finding the matrix representation is a little more challenging. We can use some trig knowledge to figure out what the basis vectors will do. So L(e1 )=(cos(120◦ ), sin(120◦ )) and L(e1 )=(cos((120 + 90)◦ ), sin((120 + 90)◦ )). We can simplify a little because cos((120 + 90)◦ ) = -sin(120◦ ) and sin((120 + 90)◦ ) = cos(120◦ ) . The rotation matrix will be: cos(120◦ ) − sin(120◦ ) . sin(120◦ ) cos(120◦ ) Task 7: Our goal: reflect the original graphic over the y-axis and then rotate by 60 degrees counterclockwise about the origin. Create one matrix that will do this action. Perform the matrix multiplication on each region matrix and draw the regions using the resulting matrix. We can find the matrix representation by multiplying giving us: 5 cos(60◦ ) − sin(60◦ ) sin(60◦ ) cos(60◦ ) and −1 0 0 1 − cos(60◦ ) − sin(60◦ ) − sin(60◦ ) cos(60◦ ) To find our new coordinates, we multiply each of our regions by this matrix. Region 1: 1 3 2 1 −8.29 −9.29 −7.06 −8.29 − cos(60◦ ) − sin(60◦ ) = − sin(60◦ ) cos(60◦ ) 9 9 7 9 3.63 1.90 1.77 3.63 Region 2: − cos(60◦ ) − sin(60◦ ) 5 7 6 5 −10.29 −11.29 −9.06 −10.29 = cos(60◦ ) − sin(60◦ ) 9 9 7 9 0.17 −1.56 −1.70 0.17 Region 3: − cos(60◦ ) − sin(60◦ ) 4 5 3 4 = −7.20 −5.96 −4.96 −7.20 ◦ ◦ − sin(60 ) cos(60 ) 6 4 4 6 Region 4: = − cos(60◦ ) − sin(60◦ ) − sin(60◦ ) cos(60◦ ) 1 2 3 4 5 6 7 6 5 4 3 2 1 3 2 3 2 3 2 3 1 2 1 2 1 3 −3.10 −2.73 −4.10 −3.73 −5.10 −4.73 −6.10 −3.87 −4.23 −2.87 −3.23 −1.87 −3.10 0.63 −0.73 −1.10 −2.47 −2.83 −4.20 −4.56 −4.70 −3.33 −2.96 −1.60 −1.23 0.63 6 Task 8: (Translations) Now, we haven’t considered a major category of geometric transformations. Suppose we wanted to move our unaltered graphic over by 3. Is this process a linear transformation? If so, prove it. If not, provide a counterexample. Translating is not going to be a linear transformation. If want to move our graphic over to the right by 3, then all the x-coordinates would move by three given us the linear transformation L(x, y) = (x + 3, y). Suppose we considered L(5(1, 2)) = L(5, 10) = (8, 10). If L was a linear transformation, then 5L(1, 2) should also equal (8, 10). But 5L(1, 2) = 5(4, 2) = (20, 10). Therefore, L is not a linear transformation. Task 9: We can cheat the system by creating something called a homogenous coordinate system. We will take each vector in R2 and associate it with a vector in R3 whose third coordinate is 1. So (x1 , x2 ) would be associated with (x1 , x2 , 1). We’d just ignore the one when plotting. How does this help us? a. What would a matrix representation of a dilation be in this new system? b. How bout a reflection? c. Rotation? d. Now, suppose we wanted to translate by a vector (2, 3) meaning we want to take all of our coordinates and move the first coordinate over by 2 and the second coordinate up by 3. What matrix will do this? e. In homogenous coordinates, is a translation a linear transformation? Why or why not? a. We want the first and second coordinate to be scaled while the third is left a one. If we scale by c, the matrix would be: c 0 0 0 c 0 . 0 0 1 b. Similarly, a reflection would look like: 1 0 0 −1 0 0 0 −1 0 or 0 1 0 . 0 0 1 0 0 1 7 c. A rotation: cos(θ) − sin(θ) 0 sin(θ) cos(θ) 0 . 0 0 1 d. Since all of our coordinates have a one in the third spot, we need to use the third row operation and multiply that 1 by 2 and add it to the first component and multiply the 1 by 3 and add it to the second component. L(x, y, z) = (x + 2z, y + 3z, z). The matrix representation would be: 1 0 2 0 1 3 . 0 0 1 e. If we can represent a mapping using a matrix, it must be a linear transformation. While a translation in R2 is not a linear transformation, we can create a linear transformation that will act this way in R3 . Of course, this matrix will not all translate vectors in R3 because the transformation depends on the third coordinate. This will act nicely only on those coordinate vectors with 1 in the third component. But, that is exactly what we care about. Those are the guys we are associating with ordered pairs in R2 ! Task 10: Create a fun, witty, clever graphic. a. Encode the graphic in a matrix. b. Create a matrix that will reflect over the y-axis, rotate by 90 degrees and translate by the vector (-1,2). (Did you need to alter your matrix from part a?) c. Perform the transformations and plot the resulting region. As you’ve already experienced my stellar artwork in the previous sections, I’ll just post the matrix for part b. Since we are translating, we need to work in the homogenous coordinate system. 1 0 −1 cos(90◦ ) − sin(90◦ ) 0 −1 0 0 − cos(90) − sin(90) −1 0 1 2 sin(90◦ ) cos(90◦ ) 0 0 1 0 = − sin(90) cos(90) 2 . 0 0 1 0 0 1 0 0 1 0 0 1 Notice, I wrote the first transformation on the right. Will the order we multiply these matter? The bigger question being, do geometric transformations commute? (Hint: no.) 8
© Copyright 2026 Paperzz