Presentation is loading. Please wait.

Presentation is loading. Please wait.

6.837 Linear Algebra Review Rob Jagnow Monday, September 20, 2004.

Similar presentations


Presentation on theme: "6.837 Linear Algebra Review Rob Jagnow Monday, September 20, 2004."— Presentation transcript:

1 6.837 Linear Algebra Review Rob Jagnow Monday, September 20, 2004

2 6.837 Linear Algebra Review Overview Basic matrix operations (+, -, *) Cross and dot products Determinants and inverses Homogeneous coordinates Orthonormal basis

3 6.837 Linear Algebra Review Additional Resources 18.06 Text Book 6.837 Text Book 6.837-staff@graphics.csail.mit.edu Check the course website for a copy of these notes

4 6.837 Linear Algebra Review What is a Matrix? A matrix is a set of elements, organized into rows and columns n columns m rows m×n matrix

5 6.837 Linear Algebra Review Basic Operations Transpose: Swap rows with columns

6 6.837 Linear Algebra Review Basic Operations Addition and Subtraction Just add elements Just subtract elements A B A B A+B A A -B A-B A A B

7 6.837 Linear Algebra Review Basic Operations Multiplication Multiply each row by each column An m×n can be multiplied by an n×p matrix to yield an m×p result

8 6.837 Linear Algebra Review Multiplication Is AB = BA ? Maybe, but maybe not! Heads up: multiplication is NOT commutative!

9 6.837 Linear Algebra Review Vector Operations Vector: n × 1 matrix Interpretation: a point or line in n- dimensional space Dot Product, Cross Product, and Magnitude defined on vectors only x y v

10 6.837 Linear Algebra Review Vector Interpretation Think of a vector as a line in 2D or 3D Think of a matrix as a transformation on a line or set of lines V V’

11 6.837 Linear Algebra Review Vectors: Dot Product Interpretation: the dot product measures to what degree two vectors are aligned A B A B A=B If A and B have length 1 … A·B = 0A·B = 1 A·B = cos θ θ

12 6.837 Linear Algebra Review Vectors: Dot Product Think of the dot product as a matrix multiplication The magnitude is the dot product of a vector with itself The dot product is also related to the angle between the two vectors

13 6.837 Linear Algebra Review Vectors: Cross Product The cross product of vectors A and B is a vector C which is perpendicular to A and B The magnitude of C is proportional to the sin of the angle between A and B The direction of C follows the right hand rule if we are working in a right-handed coordinate system B A A×BA×B

14 6.837 Linear Algebra Review Vectors: Cross Product The cross-product can be computed as a specially constructed determinant A B A×BA×B

15 6.837 Linear Algebra Review Inverse of a Matrix Identity matrix: AI = A Some matrices have an inverse, such that: AA -1 = I Inversion is tricky: (ABC) -1 = C -1 B -1 A -1 Derived from non- commutativity property

16 6.837 Linear Algebra Review Determinant of a Matrix Used for inversion If det(A) = 0, then A has no inverse Can be found using factorials, pivots, and cofactors! Lots of interpretations – for more info, take 18.06

17 6.837 Linear Algebra Review Determinant of a Matrix For a 3×3 matrix: Sum from left to right Subtract from right to left Note: In the general case, the determinant has n! terms

18 6.837 Linear Algebra Review Inverse of a Matrix 1.Append the identity matrix to A 2.Subtract multiples of the other rows from the first row to reduce the diagonal element to 1 3.Transform the identity matrix as you go 4.When the original matrix is the identity, the identity has become the inverse!

19 6.837 Linear Algebra Review Homogeneous Matrices Problem: how to include translations in transformations (and do perspective transforms) Solution: add an extra dimension

20 6.837 Linear Algebra Review Orthonormal Basis Basis: a space is totally defined by a set of vectors – any point is a linear combination of the basis Orthogonal: dot product is zero Normal: magnitude is one Orthonormal: orthogonal + normal Most common Example:

21 6.837 Linear Algebra Review Change of Orthonormal Basis Given: coordinate frames xyz and uvn point p = (p x, p y, p z ) Find: p = (p u, p v, p n ) p x y z v u x y v u n p x y u v

22 6.837 Linear Algebra Review Change of Orthonormal Basis (x. u) u (y. u) u (z. u) u (x. v) v (y. v) v (z. v) v (x. n) n (y. n) n (z. n) n xyzxyz ====== ++++++ ++++++ x y z v u n x. u x. v y. v y. u x y v u

23 6.837 Linear Algebra Review Change of Orthonormal Basis (x. u) u (y. u) u (z. u) u (x. v) v (y. v) v (z. v) v (x. n) n (y. n) n (z. n) n xyzxyz ====== ++++++ ++++++ p = (p x, p y, p z ) = p x x + p y y + p z z (x. u) u (y. u) u (z. u) u (x. v) v (y. v) v (z. v) v (x. n) n (y. n) n (z. n) n ++++++ ++++++ p x [ p y [ p z [ ] + ] Substitute into equation for p: p =

24 6.837 Linear Algebra Review Change of Orthonormal Basis (x. u) u (y. u) u (z. u) u (x. v) v (y. v) v (z. v) v (x. n) n (y. n) n (z. n) n p =++++++ ++++++ p x [ p y [ p z [ ] + ] p x (x. u) p x (x. v) p x (x. n) p y (y. u) p y (y. v) p y (y. n) p z (z. u) p z (z. v) p z (z. n) ++++++ ++++++ [[[[[[ ] u + ] v + ] n Rewrite: p =

25 6.837 Linear Algebra Review Change of Orthonormal Basis p x (x. u) p x (x. v) p x (x. n) pupvpnpupvpn ====== ++++++ ++++++ p y (y. u) p y (y. v) p y (y. n) p z (z. u) p z (z. v) p z (z. n) p = p x (x. u) p x (x. v) p x (x. n) p y (y. u) p y (y. v) p y (y. n) p z (z. u) p z (z. v) p z (z. n) ++++++ ++++++ [[[[[[ ] u + ] v + ] n Expressed in uvn basis: p = (p u, p v, p n ) = p u u + p v v + p n n

26 6.837 Linear Algebra Review Change of Orthonormal Basis pupvpnpupvpn = pxpypzpxpypz uxvxnxuxvxnx uyvynyuyvyny uzvznzuzvznz In matrix form: u x = x. u where: etc. u y = y. u p x (x. u) p x (x. v) p x (x. n) pupvpnpupvpn ====== ++++++ ++++++ p y (y. u) p y (y. v) p y (y. n) p z (z. u) p z (z. v) p z (z. n)

27 6.837 Linear Algebra Review Change of Orthonormal Basis What's M -1, the inverse? u x = x. u = u. x = x u pupvpnpupvpn = pxpypzpxpypz xuyuzuxuyuzu xvyvzvxvyvzv xnynznxnynzn = M pxpypzpxpypz M -1 = M T pupvpnpupvpn = pxpypzpxpypz uxvxnxuxvxnx uyvynyuyvyny uzvznzuzvznz

28 6.837 Linear Algebra Review Caveats Right-handed vs. left-handed coordinate systems –OpenGL is right-handed Row-major vs. column-major matrix storage. –matrix.h uses row-major order –OpenGL uses column-major order row-majorcolumn-major

29 6.837 Linear Algebra Review Questions? ?


Download ppt "6.837 Linear Algebra Review Rob Jagnow Monday, September 20, 2004."

Similar presentations


Ads by Google