Upcoming SlideShare
Loading in …5
×

# Matrices 2

2,487 views

Published on

http://www2.esc.auckland.ac.nz/teaching/ENGSCI111FC/

Published in: Education, Technology
0 Comments
1 Like
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
Your message goes here
• Be the first to comment

No Downloads
Views
Total views
2,487
On SlideShare
0
From Embeds
0
Number of Embeds
883
Actions
Shares
0
Downloads
50
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

### Matrices 2

1. 1. Matrices MM1 module 3, lecture 2 David Godfrey
2. 2. Matrices lecture 2 objectives <ul><li>After this lecture you should have a clear understanding of: </li></ul><ul><ul><li>Representing sets of points in matrix form; </li></ul></ul><ul><ul><li>What the unit square is; </li></ul></ul><ul><ul><li>Performing and classifying matrix transformations; </li></ul></ul><ul><ul><li>Performing combined matrix transformations; </li></ul></ul><ul><ul><li>The effect of an inverse matrix; </li></ul></ul><ul><ul><li>The relationship between the the determinant of a transformation and the change in area of a shape; </li></ul></ul><ul><ul><li>The effect of a transformation using a singular matrix. </li></ul></ul>
3. 3. Transformations and transitions <ul><li>This lecture considers the use of matrices to describe transformations and transitions. </li></ul><ul><li>2D and 3D transformations are widely used in computer graphics. We will only consider 2D transformations in this lecture. </li></ul><ul><li>State transitions are often used to model large complex systems. Such systems can be described using a set of state variables that undergo changes in value only at discrete time points. These changes can often be represented using matrix equations. </li></ul><ul><li>We will first consider transformations. </li></ul>
4. 4. Matrices and transformations <ul><li>A coordinate system can be used to uniquely identify points in m-dimensional space as column vectors (m    1 matrices). </li></ul><ul><li>e.g. in 2-dimensional space the points A , B , and C are represented as: </li></ul>
5. 5. Multiple points <ul><li>The position of n points in space can be characterised by a grouping of n column vectors forming an m    n matrix. </li></ul><ul><li>e.g. in 2-dimensional space the triangle with vertices A , B , and C can be represented by the matrix: </li></ul>
6. 6. Matrix transformations… <ul><li>Matrices can also be used to represent transformations of points. </li></ul><ul><li>e.g. the matrix will transform A , B , and C to A ’, B ’, and C ’. </li></ul>
7. 7. … Matrix transformations… <ul><li>i.e. </li></ul>
8. 8. … Matrix transformations… <ul><li>Or, more succinctly in matrix form: </li></ul>
9. 9. … Matrix transformations… <ul><li>Note: the determinant of the transformation matrix gives the scale of the area change. </li></ul><ul><li>e.g. area [ A , B , C ] = 5, area [ A ´, B ´, C ´] = 15 </li></ul>
10. 10. … Matrix transformations… <ul><li>e.g. transform the shape with vertices </li></ul><ul><li>by the matrix </li></ul><ul><li>Note that the determinant gives the scale factor for the change in area </li></ul>
11. 11. … Matrix transformations <ul><li>All four vertices can be transformed using a single matrix equation </li></ul><ul><li>Negative determinant reverses the ordering of vertices. </li></ul>
12. 12. The unit square <ul><li>It is instructive to look at the effect of transformations on a simple shape such as the unit square. </li></ul><ul><li>The matrix for the unit square is given by </li></ul>
13. 13. Transforming the unit square <ul><li>Transforming the unit square gives information about the transformation matrix </li></ul><ul><li>i.e. transforming the unit square results in [zeros, original matrix, sums of rows] </li></ul>
14. 14. Transformations: uniform scaling <ul><li>The general form of uniform scaling by k is: </li></ul><ul><li>e.g. uniform scaling by 2 is given by </li></ul>
15. 15. Transformations: stretch… <ul><li>The general form of a stretch by k in the x–direction is: </li></ul><ul><li>e.g. x–direction stretch by 2 is given by </li></ul>
16. 16. … Transformations: stretch <ul><li>The general form of a stretch by k in the y–direction is: </li></ul><ul><li>e.g. y–direction stretch by -2 is given by </li></ul>
17. 17. Transformations: shear… <ul><li>The general form of a shear by k in the x–direction is: </li></ul><ul><li>e.g. x–direction shear by 1.5 is given by </li></ul>
18. 18. … Transformations: shear <ul><li>The general form of a shear by k in the y–direction is: </li></ul><ul><li>e.g. y–direction shear by -1 is given by </li></ul>
19. 19. Transformations: reflection <ul><li>The general forms of reflections in the x–axis and y–axis are: </li></ul><ul><li>e.g. an x–axis reflection is given by </li></ul>
20. 20. Transformations: rotation… <ul><li>The general form of a rotation by k about the origin is: </li></ul>
21. 21. … Transformations: rotation <ul><li>e.g. the matrices representing rotations of 90° and –30° are: </li></ul>
22. 22. Combined transformations… <ul><li>If the matrices A and B represent two transformations, then the matrix product AB represents the combined transformation of first applying B and then applying A . </li></ul><ul><li>i.e. let the matrix U represent the unit square. Then BU represents the transformation B applied to the unit square. Now A ( BU ) represents the transformation A applied to the unit square transformed by B . This sequence of transformations is the same as the combined transformation ( AB ) applied to U (matrix multiplication is associative) ABU  =  A ( BU ) = ( AB ) U </li></ul>
23. 23. … Combined transformations… <ul><li>e.g. let the matrices A and B represent x–shear by 1 and y–stretch by 2 transformations </li></ul>
24. 24. … Combined transformations <ul><li>Note that combined transformations are not commutative. i.e. AB  ≠  BA e.g. </li></ul>
25. 25. Inverse transformations… <ul><li>Let A be a transformation, so AU  =  V represents the transformation A applied to the unit square. </li></ul><ul><li>Now if we premultiply the equation by A -1 , the inverse of A , we get A -1 AU  =  A -1 V </li></ul><ul><li>But A -1 A  =  I , so U  =  A -1 V . In other words A -1 reverses the transformation A . </li></ul><ul><li>A -1 (if it exists) is thus the inverse transformation of A . </li></ul>
26. 26. … Inverse transformations <ul><li>e.g. y–shear by -1 is given by </li></ul>
27. 27. Inverse transformations: singular… <ul><li>What if the transformation is singular? e.g. </li></ul>
28. 28. … Inverse transformations: singular <ul><li>Singular transformations collapses the unit square into a straight line (or a single point). </li></ul><ul><li>Singular transformations cannot be reversed because there isn’t a one-to-one mapping between the original and transformed spaces. </li></ul>
29. 29. Transition matrices <ul><li>Consider a system that can be characterised by a set of m variables, called state variables . </li></ul><ul><li>Furthermore, these state variables are allowed to change value only at discrete time points, called transitions . </li></ul><ul><li>If the system state variables at transition i are linearly related related to the state variables at transition ( i  – 1) the transition can be described using a transition matrix . </li></ul><ul><li>Examples of such systems include Markov chains, where the transition matrix elements represent probabilities of changing from one state to another. </li></ul>
30. 30. Transition matrices: example 1… <ul><li>e.g. A railway has 600 wagons carrying goods from point A to point B. At the end of each week it finds that 30% of the wagons that started the week at A are at B and 20% of the wagons that have started at B are now at A. </li></ul><ul><ul><li>How many wagons are at A and B at the end of two weeks if 300 wagons started at A and 300 started at B? </li></ul></ul><ul><ul><li>If there are 400 wagons at A and 200 at B at the end of a week, how many wagons were there at A and at B at the start of the week? </li></ul></ul><ul><ul><li>How many wagons would need to be at A and at B at the start of the week if there were to be the same numbers at the end of the week? </li></ul></ul>
31. 31. … Transition matrices: example 1… <ul><li>The transition matrix describes the way the distribution of wagons changes from the start to the end of each week. It does not describe all the changes that may take place during the week. </li></ul><ul><li>Think of the columns of the matrix representing “from” and the rows representing “to” </li></ul>
32. 32. … Transition matrices: example 1… <ul><li>A railway has 600 wagons carrying goods from point A to point B. At the end of each week it finds that 30% of the wagons that started the week at A are at B and 20% of the wagons that have started at B are now at A. </li></ul><ul><li>Fill in the elements of the matrix remembering that if 0.3 of A's wagons end up at B then 0.7 remain at A (i.e. go from A to A). </li></ul>
33. 33. … Transition matrices: example 1… <ul><li>How many wagons are at A and B at the end of two weeks if 300 wagons started at A and 300 started at B? </li></ul><ul><li>Construct a vector representing the numbers of wagons: </li></ul><ul><li>Calculate the numbers of wagons at the end of week 1: </li></ul><ul><li>Calculate the numbers of wagons at the end of week 2: </li></ul><ul><li>i.e. there are 255 wagons at A and 345 at B. </li></ul>
34. 34. … Transition matrices: example 1… <ul><li>If there are 400 wagons at A and 200 at B at the end of a week, how many wagons were there at A and at B at the start of the week? </li></ul><ul><li>If the transition matrix represents the forward process, the inverse represents the reverse process. </li></ul><ul><li>Calculate the inverse of the transition matrix: </li></ul><ul><li>Apply the inverse transformation: </li></ul><ul><li>i.e. there were 560 wagons at A and 40 at B. </li></ul>
35. 35. … Transition matrices: example 1… <ul><li>How many wagons would need to be at A and at B at the start of the week if there were to be the same numbers at the end of the week? </li></ul><ul><li>This is called the steady state problem: </li></ul>
36. 36. … Transition matrices: example 1… <ul><li>How many wagons would need to be at A and at B at the start of the week if there were to be the same numbers at the end of the week? </li></ul><ul><li>Since the total number of wagons is 600, the steady state distribution is: </li></ul>
37. 37. … Transition matrices: example 1 <ul><li>How many wagons would need to be at A and at B at the start of the week if there were to be the same numbers at the end of the week? </li></ul><ul><li>Check that the answer is the steady state solution: </li></ul>
38. 38. Transition matrices: example 2… <ul><li>e.g. A company has 2 warehouses with initial stock 20,000 and 10,000 in warehouse A and B, respectively. At the end of each week 70% of stock in A is sold and 2% transferred to B, while 85% of stock in B is sold and 1% transferred to A. How much stock is left in each warehouse at the end of 2 weeks? </li></ul><ul><li>Construct the transition matrix: </li></ul><ul><li>Note: we need an extra row and column to track movement between A, B, and outside. </li></ul>
39. 39. … Transition matrices: example 2 <ul><li>How much stock is left in each warehouse at the end of 2 weeks? </li></ul><ul><li>Construct a vector representing the stock: </li></ul><ul><li>Calculate the stock at the end of week 1: </li></ul><ul><li>Calculate the stock at the end of week 2: </li></ul>
40. 40. Matrices lecture 2 objectives <ul><li>After this lecture you should have a clear understanding of: </li></ul><ul><ul><li>Representing sets of points in matrix form; </li></ul></ul><ul><ul><li>What the unit square is; </li></ul></ul><ul><ul><li>Performing and classifying matrix transformations; </li></ul></ul><ul><ul><li>Performing combined matrix transformations; </li></ul></ul><ul><ul><li>The effect of an inverse matrix; </li></ul></ul><ul><ul><li>The relationship between the the determinant of a transformation and the change in area of a shape; </li></ul></ul><ul><ul><li>The effect of a transformation using a singular matrix. </li></ul></ul>