1 / 51

FP1: Chapter 4 Matrix Algebra

FP1: Chapter 4 Matrix Algebra. Dr J Frost (jfrost@tiffin.kingston.sch.uk) . Last modified: 10 th February 2014. Introduction. A matrix (plural: matrices) is simply an ‘array’ of numbers , e.g.

trevor
Download Presentation

FP1: Chapter 4 Matrix Algebra

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. FP1: Chapter 4 Matrix Algebra Dr J Frost (jfrost@tiffin.kingston.sch.uk) Last modified: 10th February 2014

  2. Introduction A matrix (plural: matrices) is simply an ‘array’ of numbers, e.g. On a simple level, a matrix is simply a way to organise values into rows and columns, and represent these multiple values as a single structure. But the power of matrices comes from being able to multiply matrices by vectors and matrices by matrices and ‘invert’ them: we can: representlinear transformations using matrices (e.g. rotations, reflections and enlargements) Use them to solve linear simultaneous equations. The first of these means matrices are particularly useful in 3D graphics/animation, since they allow us to rotate the camera and project 3D data onto a 2D viewing plane. But matrices are used everywhere, including robotics, computer vision, optimisation, classical and quantum mechanics, electromagnetism, optics, graph theory, statistics, ...

  3. Using matrices to represent data This is a scene from the film Good Will Hunting. Maths professor Lambeau poses a difficult* problem for his graduate students from algebraic graph theory, the first part asking for a matrix representation of this graph. Matt Damon anonymously solves the problem while on a cleaning shift. ? In an adjacency matrix, the number in the ith row and jth column is the number of edges directly connecting node (i.e. dot) i to dot j ? * It really isn’t.

  4. Using matrices to represent data In my 4th year undergraduate dissertation, I used matrices to help ‘learn’ mark schemes from GCSE biology scripts. Matrix algebra helped me to initially determine how words (and more complex semantic information) tended to occur together with other words.

  5. Using matrices to represent data In S1, you learnt how we could extend the idea of variance (i.e. how much a variable varies) to that of covariance (i.e. how much two variables vary with each other). A covariance matrix allows us to store the covariance between variables all in one convenient structure. This allows us for example to extend a Normal Distribution from one dimension (i.e. involving just one variable) to multiple dimensions. 1D 2D

  6. ζ Matrix Algebra Matrix Fundamentals Understand the dimensions of a matrix, and operations on matrices, such as addition, scalar multiplication and matrix multiplication.

  7. Matrix Fundamentals #1 Dimensions of Matrices The dimension of a matrix is its size, in terms of its number of rows and columns. Matrix Dimensions 2  3 ? 3  1 ? 1  3

  8. Matrix Fundamentals #2 Notation/Names for Matrices A matrix can have square or curvy brackets*. Column Vector (The vector you know and love) Row Vector Matrix So a matrix with one column is simply a vector in the usual sense. * The textbook only uses curvy.

  9. Matrix Fundamentals #3 Variables for Matrices If we wish a variable to represent a matrix, we use bold, capital letters.

  10. Matrix Fundamentals #4 Elements Each value within a matrix is known as an element. If A is a matrix, then we can refer to the element in the ith row and jth column as aij. c12 = 3 c21 = 4 c13 = -7 ? ? ? Note that you do not need to know this notation for referencing elements for the purposes of FP exams, but it’s worthwhile knowing.

  11. Matrix Fundamentals #5 Adding/Subtracting Matrices Simply add/subtract the corresponding methods of each matrix. They must be of the same dimension. ? ?

  12. Matrix Fundamentals #6 Scalar Multiplication A scalar is a number which can ‘scale’ the elements inside a matrix/vector. ? 1 ? 2 ? 3

  13. Matrix Fundamentals #7 Matrix Multiplication This is where things get slightly more complicated... Now repeat for the next row of the left matrix... 1 0 3 -2 2 8 4 3 7 -1 0 2 5 1 1 7 0 3 8 -3 -11 16 42 61 50 8 We start with this row and column, and sum the products of each pair. (1 x 5) + (0 x 1) + (3 x 0) + (-2 x 8) = -11 You will see in C4 that this is known as finding the “dot/scalar product” of the two vectors.

  14. Matrix Fundamentals #7 Matrix Multiplication Now you have a go... ? = ? ? ?

  15. Matrix Fundamentals #7 Matrix Multiplication Matrix multiplications are not always valid: the dimensions have to agree. ? ? ? ? ? ? ? Note that only square matrices (i.e. same width as height) can be raised to a power.

  16. Exercise 4C Q1, 3, 5, 6, 8, 9

  17. ζ Matrix Algebra Linear Transformations Appreciate what linear transformations are, and how we can use matrices to represent them.

  18. Position vectors You should be familiar with the difference between a vector and a point: Point: represents a position in space. Vector: represents a movement. A position vector allows us to treat a point as a vector. A position vector [x y] represents the movement from the origin (0,0) to the point (x,y). ? ? y Position vector [5 3] Point (5,3) x For the remainder of the chapter, when I say ‘point’, I really mean ‘position vector’.

  19. Linear Functions From GCSE, you are used to a linear function looking like the equation of a straight line: f(x) = ax + b More generally, if we had multiple inputs, a linear function is: f(x1, x2, ... , xn) = a0 + a1x1 + a2x2 + ... + anxn When the inputs and outputs of the function are vectors however, then we have a linear map/transformation if: f(ax) = af(x) f(x + y) = f(x) + f(y) The first condition ensures that if we scale the original point x, then this scales the transformed point too. The second says that if we add two vectors, then resulting vector will be the same then if we transformed each of the vectors individually then added them – we say that the transformation ‘preserves vector addition and scalar multiplication’.

  20. Linear Transformations Suppose that 0 is the 0-vector, i.e. The position vector (0,0) in 2D, (0,0,0) in 3D, etc. Then for a linear transformation f: f(0) = 0 ? This follows by letting the scalar a = 0 in f(ax) = af(x). This means that the origin is unaffected by a linear transformation. Can you express the following transformations as functions? If linear, prove it, otherwise find a counterexample. Example 1 Reflects a 2D point in the y-axis. ? ? Proof of linearity:

  21. Linear Transformations Example 2 Rotates a 2D point 90 clockwise about the origin. ? Linear? Yes (proof similar to before) ? Example 3 Enlarges by a scale factor of 3 with the origin as the centre of enlargement. ? Linear? Yes. Proof: ?

  22. Linear Transformations Example 4 Projects a 3D coordinate onto the xy-plane, almost as if you were observing a 3D point where your viewing window/eyes are the xy-plane. ? Linear? Yes (proof left as exercise) ? This is useful in 3D graphics, because you need to turn 3D data into a 2D image by projecting onto a viewing plane. Example 5 Translate a 2D point 1 unit to the right. ? Linear? No! The origin is not preserved. ?

  23. Linear Transformations As we have seen, the following transformations are linear and not linear: Linear Non-Linear • Reflection (where line of reflection goes through the origin) • Rotation (with centre at the origin) • Enlargement (with centre at the origin) • Translation. A linear transformation in general is when each output is a linear combination of the inputs, e.g: While a transformation can create or destroy dimensions, in FP1 we’ll just be dealing which transformation which transform 2D points to 2D points.

  24. Affine Transformations Linear Transformations The following examples are NOT linear transformations: (can you prove it?) (Not mentioned in FP1) Affine transformations extend linear transformations by allowing a constant term. This hence allows us to represent translations. Affine Linear

  25. Using Matrices for Linear Transformations Matrices allow us to represent all possible linear transformations. Reflection in -axis: ? Rotation 90 clockwise about the origin. ?

  26. Using Matrices for Linear Transformations Matrices allow us to represent all possible linear transformations. ? ? ? ?

  27. Basis Vectors and Vector Spaces (Not mentioned in FP1) Basic vectors are usually (but not necessarily) the unit vectors along each axis. A vector space is all possible points that can be obtained by some linear combination of the basis vectors. Example: 2D space Basic vectors: All position vectors since Vector space: Intuitively this is obvious: any point in 2D space can be obtained by some movement along the axis and some movement along the axis. Our basis vectors could have been any non-parallel vectors.

  28. Using Matrices for Linear Transformations There’s a groovy trick that allows us to work out what matrix to use for a particular transformation. Observe: Thus, each column of the matrix tells us how the unit vectors are transformed. These transformed basis vectors form the new vector space. y y First column is first basis vector transformed. Example: Reflection in -axis. ? x x

  29. Using Matrices for Linear Transformations Rotation anticlockwise about the origin. ? x x Rotation anticlockwise about the origin. ? ? ? x x

  30. Rotation for multiples of In the FP1 specification, you are only required to identify rotations for multiples of , although the rotation matrix for anticlockwise in general is in your formula booklet. ? Rotation of anticlockwise Bro Tip: To remember these without having to plug in your in the above matrix, just remember the scaling, and then just visually think how each basis vector is transformed to get the signs of the 1s correct. Rotation of clockwise ? ? Rotation of anticlockwise

  31. Using Matrices for Linear Transformations Enlargement by scale factor 2 about the origin. ? ? ? x x No change. ? This is known as the identity matrix, and is denoted by . x x

  32. A quick digression… (Not mentioned in FP1) An identity element in general is a special type of element on a set (e.g. the set of integers, or real numbers, or matrices) with respect to a binary operator on the set. An element is an identity element if for all in the set and some operator then: ? ? ? ? ? ? ?

  33. Using Matrices for Linear Transformations Reflection in the line x x ? ? Thus the vector gets transformed to We can see from the diagram above that when we reflect we can form the following triangle: Since for any line of length and inclination , the component is and component , then gradient is consequently , i.e. must be the angle between the axis and line of reflection. 1 We can do something similar to transform

  34. Exercise 4E • Describe the transformations represented by the matrix: • a) Reflection in -axis. • b) Rotation anticlockwise about . • c) Rotation clockwise about . • And for these: • a) Rotation clockwise about . • b) Enlargement scale factor 4, centre . • c) Rotation anticlockwise about . 1 Find the matrix that represents these transformations. Rotation of clockwise about . Reflection in the -axis. Enlargement centre scale factor 2. 4 ? ? ? ? ? ? 3 Find the matrix that represents these transformations. Enlargement scale factor -4 centre (0,0). Reflection in the line . Rotation about of clockwise. 5 ? ? ? ? ? ?

  35. Combined Transformations We know that for a position vector and a matrix representing some transformation, then is the transformed point. If we wanted to apply a transformation represented by a matrix followed by another represented by , what transformation matrix do we use to represent the combined transformation? ? This is because to apply the effect of followed by , we have: (because matrix multiplication is ‘associative’*) Bro Tip: Ensure that you put these matrices in the right order – the first that gets applied is on the right! * A binary operator is associative if , i.e. when we multiply matrices, the order in which we multiply them doesn’t matter.

  36. Combined Transformations Represent as a single matrix the transformation representing a reflection in the line followed by a stretch on the axis by a factor of 4. = ? ? ? Represent as a single matrix the transformation representing a rotation anticlockwise about the point followed by a reflection in the line . = ? ? ? What single transformation is this? Reflection in the axis. ?

  37. Exercise 4F Page 93 Q1, 3, 5, 7

  38. Matrix Inverses In maths, we are used to functions having an inverse. It would seem logical to have some inverse of multiplying something by a matrix, so that we can represent ‘undoing’ the transformation (e.g. the inverse of the matrix representing rotation clockwise would be a matrix representing a rotation anticlockwise). • ! If then • is the ‘inverse’ of , so that if , • since the effect of a transformation followed by its inverse has no effect.

  39. Determinants • The determinant of a matrix is • So • If , then is a singular matrix and does not exist (since we can’t divide by 0). • If , then is a non-singular matrix and exists. It’s worthwhile reflecting on the significance of the determinant: in the context of transformations, it ‘determines’ whether we can ‘undo’ a transformation. And later, we’ll see that it can tell us whether a series of simultaneous equations are solvable. ? ? ? ?

  40. Practicing the Inverse Click to Broinverse Swap NW-SE elements. Divide by determinant. Make SW-NE elements negative.

  41. Test Your Understanding For what value of is singular? Given is not this value, find the inverse. ? ? ? ? ?

  42. Using A matrix multiplied by its inverse is the identity matrix. If and are non-singular matrices, prove that ? If then The general strategy for solving these kinds of equations is to multiply whatever’s on the front of the multiplication by its inverse, to ‘cancel it out’. If and are non-singular matrices such that . Prove that . ?

  43. Exercise 4G Page 97 Q1a, c, e 2a, c 4, 6, 8, 10, 11

  44. Inverse matrices represent inverse transformations ! Suppose and are column vectors. Then if , then . The inverse matrix therefore allows us to retrieve the original point/position vector before a transformation. The triangle has vertices at , and . The matrix transforms to the triangle with vertices at and . Sketch the two triangles, and hence show that ? (4,10) (2,4) (4,3) -4 4 -1 1 So the determinant was the scale factor of the area.

  45. Area scale factor We saw in this example that: • Area of image Area of object • i.e. the determinant tells us how the area is scaled under the transformation matrix . ? ? ? ?

  46. Exam Question Edexcel FP1 - Jan 2011 4 ? ? ? ? Note that we’re given the points on the image! So use inverse transformation. So points are .

  47. Exercise 4I The matrix is used to transform the rectangle with vertices at the points , , and . a) Find the coordinates of the vertices of the image of . b) Calculate the area of the image of . A rectangle of area 5cm2 is transformed by the matrix . Find the area of the image of the rectangle when is: a) c) e) The triangle has area 6cm2 and is transformed by the matrix where is a constant, into triangle . Find in terms of . Given that the area of is 36cm2, find the possible values of . 1 Area = 40 ? 4 a) 70 c) 15 e) 90 ? 5 ?

  48. Frost Life StoriesTM In the game Assassin’s Creed II, you encounter a variety of concentric ring picture puzzles, which upon successfully completing, you unlock a segment of a secret video. Rings are connected in pairs, and must be rotated together in their pairs. The aim is to form a complete picture. Different possible pairs can be selected, for example, where there just 3 rings, you could rotate A and B together, B and C together or C and A together. Only certain pairings are available. Because I’m a massive geek, I formed simultaneous equations and used a matrix inverse to solve them, which therefore told me how many times to rotate each pair. We’ll see how we can do this.

  49. Using Matrices For Simultaneous Equations Turn the following simultaneous equations into a matrix: ? Hence, use a matrix inverse to solve these simultaneous equations. Let . Then So and . ?

  50. Test your understanding Q Solve (using matrices) the simultaneous equations: So , . ? Q Explain why the following simultaneous equations have no solution: The matrix has no inverse because the determinant is 0. ?

More Related