Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 08a: MATRICES Sec 2.7

Similar presentations


Presentation on theme: "Lecture 08a: MATRICES Sec 2.7"— Presentation transcript:

1 Lecture 08a: MATRICES Sec 2.7
CS1050: Understanding and Constructing Proofs Spring 2006 Lecture 08a: MATRICES Sec 2.7 This work is carried by Jarek Rossignac and one of his PhD students, Jason Williams Jarek Rossignac

2 Lecture Objectives Understand vectors, matrices, their products and properties. Illustrate these on linear transformations

3 What do coordinates mean?
Let C be a coordinate system with origin o and basis (i, j) i and j are unit length vectors orthogonal to each other Let point p have coordinates (x,y) in C Define p in terms of x, y, o, i, j: p = o + xi + yj start at o make x steps in the i direction make y steps in the j direction p y x j i o

4 How do we represent points and vectors?
Using an ordered set of coordinates in an agreed-upon, yet not specified, global coordinate system o = (xo, yo ) i = ( xi , yi ) j = ( xj , yj ) p = ( xp , yp ) o i j p x y xo yo xi yi yp xp

5 Operations on points and vectors
Subtracting two points yields a vector (displacement) ( xp , yp ) – ( xo , yo ) = ( xp– xo , po– yo ) Adding a vector to a point moves the point ( xo , yo ) + ( xj , yj ) = ( xo+xj , yo+yj ) Adding two vectors adds the corresponding coordinates ( xi , yi ) + ( xj , yj ) = ( xi+xj , yi+yj ) Multiplying a vector by a scalar multiplies its length s( xi , yi ) = ( sxi , syi ) The dot product of two vectors is the sum of the products of corresponding terms ( xi , yi )  ( xj , yj ) = ( xi xj + yiyj )

6 What is a matrix? A scalar or ordered set of matrices scalars, vectors, mxn tables are matrices For example (i , j , o ) is a 2x3 matrix often presented as a table xi xj xo yi yj yo (i , j , o ) =

7 What is a matrix-vector product?
Generalization of the dot product: Sum of products of corresponding terms (a , b , c )( x , y , z ) = ax+by+cz

8 What is the matrix form of (xp,yp) ?
p = xi + yj + o = ( i , j , o )  ( x , y , 1 ) ( xp , yp ) = x( xi , yi ) + y( xj , yj ) + ( xo , yo ) = ( xxi , xyi ) + ( yxj , yyj ) + ( xo , yo ) = ( xxi+yxj+xo , xyi+yyj+ yo ) x y 1 xp yp xi xj xo yi yj yo =

9 What is the homogeneous representation?
Add a third coordinate: 1 for points, 0 for vectors o = (xo, yo , 1) i = ( xi , yi , 0) j = ( xj , yj , 0) p = ( xp , yp , 1)

10 Homogeneous matrix form of (xp,yp) ?
p = xi + yj + o = ( i , j , o )  ( x , y , 1 ) ( xp , yp , 1) = x( xi , yi , 0) + y( xj , yj , 0) + 1( xo , yo , 1) = ( xxi+yxj+xo , xyi+yyj+ yo , 1 ) xp yp 1 xi xj xo yi yj yo 1 x y 1 =

11 Performing the multiplication
Multiply columns and add x y 1 xp yp 1 xi xj xo yi yj yo 1 =

12 How to compute (x,y) ? Let op = p – o x = op  i y = op  j xp yp yi
o = (xo, yo ), i = ( xi , yi ), j = ( xj , yj ), p = ( xp , yp ) Let op = p – o x = op  i y = op  j vi is the normal projection of vector v on the unit vector i o i j p x y xo yo xi yi yp xp

13 How to extend this to 3D ? zp yp xp o = (xo, yo , zo , 1)
i = ( xi , yi , zi , 0) j = ( xj , yj , zj , 0) p = ( xp , yp , zp , 1) p zp (0,0,1) (0,1,0) yp (1,0,0) xp

14 More general notation for matrices
A = [ aij ]rc i is the row number j is the column number We say that A is an rc matrix if it has r rows and c columns We say that an nn matrix is square. In a square matrix, aii are the diagonal elements. Their sum aij is the trace of A a11 a12 a13 a14 a21 a22 a23 a24 a31 a33 a34 A34 =

15 Operations for matrices
Equality: [ aij ]mn = [ bij ]mn when ij aij = bij Addition: [ aij ]mn + [ bij ]mn = [ aij + bij ]mn Multiplication: [ aij ]mk [ bij ]kn = [ ai*  b*j ]mn ai* is a vector made from the row elements: (ai1 , ai2 ,… aic) b*j is a vector made from the column elements: (b1j , b2j ,… brj) In general, matrix multiplication is not commutative AB≠BA

16 What is the cost of matrix multiplication?
How many multiplications, additions are performed when multiplying two nn matrices? We need to compute n2 dot products Each one requires n multiplications and n–1 additions Total: n3 multiplications and (n–1)n2 additions

17 Best order for chain multiplication?
Matrix multiplication is associative: ((Akm Bmn)Cno)Dop = Akm((BmnCno)Dop) Which order requires fewest multiplications? (Akm Bmn) requires kmn multiplications (kn  of m) ((Akm Bmn)Cno)Dop requires kmn+kno+kod Akm((BmnCno)Dop) requires mno+mop+kmp

18 What is the identity matrix?
In = [ ij ]nn where ii = 1 and ij = 0 when i≠j diagonal terms are 1, the others 0 Property of identity: AmnIn = ImAmn= Amn

19 What is the power of a square matrix?
Ann0 = In Annk = AnnAnn … Ann (product of k matrices)

20 What is the transpose of a matrix?
[ aij ]mnt = [ aji ]nm

21 When is a square matrix symmetric?
A is symmetric if A=At , i.e., ij aij = aji A mirror reflection about the diagonal will not change the matrix.

22 What are joins and meets of binary matrices?
Entries represent truth values (denoted 0 and 1 for simplicity) The join of two Boolean matrices is [ aij ]mn  [ bij ]mn = [ aij  bij ]mn The meet of two Boolean matrices is [ aij ]mn  [ bij ]mn = [ aij  bij ]mn

23 What is the Boolean product?
The dot product of two Boolean vectors is the disjunctive form [ ai ]k  [ bi ]k = a1b1  a2b2 …  akbk The Boolean product of two binary matrices is [ aij ]mk[ bij ]kn = [ ai*  b*j ]mn

24 What is the Boolean product?
The dot product of two Boolean vectors is the disjunctive form [ ai ]k  [ bi ]k = a1b1  a2b2 …  akbk The Boolean product of two binary matrices is [ aij ]mk[ bij ]kn = [ ai*  b*j ]mn

25 What is the Boolean power?
The rth Boolean power , denoted A[r], of a square binary matrix A is A[r] = AA … A (Boolean product of r terms) with A[0] = I

26 Assigned Reading 2.7

27 Assigned Exercises for Quiz
Page : 4.a, 13, 19 Changes of coordinate system Assume that you have a series of m transformations each represented in homogeneous form by a 4x4 matrix and v vertices, which you want to transform by each matrix in the series. Is it cheaper to first compute the result of multiplying the series into a single matrix and then use it to transform all the vertices, or is it cheaper to multiply each vertex by the each matrix? Does the answer depend on the values of m and v? If so, how?

28 Assigned Project


Download ppt "Lecture 08a: MATRICES Sec 2.7"

Similar presentations


Ads by Google