Slideshow transcript
Slide 1: Lesson 3 The Dot Product and Matrix Multiplication Math 20 September 24, 2007 Announcements Problem Set 1 is on the course web site. Due September 26. Problem Sessions: Sundays 6–7 (SC 221), Tuesdays 1–2 (SC 116) My office hours: Mondays 1–2, Tuesdays 3–4, Wednesdays 1–3 (SC 323)
Slide 2: The price of breakfast Remember I eat two eggs, three slices of bacon, and two slices of toast for breakfast. Then my breakfast can be summarized by the object 2 b= 3 . 2 Suppose eggs cost $1.39 per dozen, bacon costs $2.49 per pound, and bread costs $1.99 per loaf. Assume a pound of bacon has 16 slices, as does a loaf of bread. Then the price per “unit” of breakfast is 1.39/12 0.12 p = 2.49/16 = 0.16 1.99/16 0.12
Slide 3: The price of breakfast Remember I eat two eggs, three slices of bacon, and two slices of toast for breakfast. Then my breakfast can be summarized by the object 2 b= 3 . 2 Suppose eggs cost $1.39 per dozen, bacon costs $2.49 per pound, and bread costs $1.99 per loaf. Assume a pound of bacon has 16 slices, as does a loaf of bread. Then the price per “unit” of breakfast is 1.39/12 0.12 p = 2.49/16 = 0.16 1.99/16 0.12 Question How much do I pay?
Slide 4: Answer. The answer is (0.12)(2) + (0.16)(3) + (0.12)(2) = 0.96. My breakfast costs 96 cents.
Slide 5: Answer. The answer is (0.12)(2) + (0.16)(3) + (0.12)(2) = 0.96. My breakfast costs 96 cents. In terms of the vectors 0.12 2 p = 0.16 b = 3 0.12 2 what have we done?
Slide 6: Answer. The answer is (0.12)(2) + (0.16)(3) + (0.12)(2) = 0.96. My breakfast costs 96 cents. In terms of the vectors 0.12 2 p = 0.16 b = 3 0.12 2 what have we done? We multiplied the components and added them.
Slide 7: The dot product of vectors Definition We p, q be vectors in Rn . We define the dot product (or inner product) of p and q to be the scalar p · q = p1 q1 + p2 q2 + · · · + pn qn .
Slide 8: The dot product of vectors Definition We p, q be vectors in Rn . We define the dot product (or inner product) of p and q to be the scalar p · q = p1 q1 + p2 q2 + · · · + pn qn . Observations: The dot product of two vectors is a scalar.
Slide 9: The dot product of vectors Definition We p, q be vectors in Rn . We define the dot product (or inner product) of p and q to be the scalar p · q = p1 q1 + p2 q2 + · · · + pn qn . Observations: The dot product of two vectors is a scalar. The vectors need to have the same length to multiply.
Slide 10: The dot product of vectors Definition We p, q be vectors in Rn . We define the dot product (or inner product) of p and q to be the scalar p · q = p1 q1 + p2 q2 + · · · + pn qn . Observations: The dot product of two vectors is a scalar. The vectors need to have the same length to multiply. The dot product is symmetric meaning p · q is always equal to q · p.
Slide 11: The dot product of vectors Definition We p, q be vectors in Rn . We define the dot product (or inner product) of p and q to be the scalar p · q = p1 q1 + p2 q2 + · · · + pn qn . Observations: The dot product of two vectors is a scalar. The vectors need to have the same length to multiply. The dot product is symmetric meaning p · q is always equal to q · p. q·p = q1 p1 +q2 p2 +· · ·+qn pn = p1 q1 +p2 q2 +· · ·+pn qn = p·q
Slide 13: Another Example Example 1 2 Let v = −1 and w = 2. Then 4 0 v·w
Slide 14: Another Example Example 1 2 Let v = −1 and w = 2. Then 4 0 v · w = 1 · 2 + (−1) · 2 + 4 · 0
Slide 15: Another Example Example 1 2 Let v = −1 and w = 2. Then 4 0 v · w = 1 · 2 + (−1) · 2 + 4 · 0 = 0.
Slide 16: Another Example Example 1 2 Let v = −1 and w = 2. Then 4 0 v · w = 1 · 2 + (−1) · 2 + 4 · 0 = 0. So vectors can have a zero inner product without either one being zero.
Slide 17: Dot product and Length a If v = , then b v·v
Slide 18: Dot product and Length a If v = , then b v · v = a2 + b 2
Slide 19: Dot product and Length a If v = , then b 2 v · v = a2 + b 2 = v
Slide 20: Dot product and Length a If v = , then b 2 v · v = a2 + b 2 = v Sometimes useful even if our vectors aren’t really physical in nature.
Slide 22: Orthogonality If v and w make a right angle, then 2 2 2 v + w = v+w w On the other hand, v+w 2 v+w = (v + w) · (v + w) FOIL v = v · v + 2v · w + w · w = v 2 + 2v · w + w 2 So v and w are orthogonal (perpendicular) if v · w = 0.
Slide 23: Sigma notation n p · q = p1 q1 + p2 q2 + · · · + pn qn = pi qi i=1 The symbol i is an index, a “variable” which takes all integer values between 1 and n.
Slide 24: Who else could go for some flapjacks? Ingredient Pancakes Crˆpes e Blintzes 1 1 Flour (cups) 12 2 1 1 Water (cups) 0 4 0 1 1 Milk (cups) 12 4 0 Eggs 2 2 3 Oil (Tbsp) 3 2 2 The yield for each recipe is 12.
Slide 26: Again, let’s look at what we’ve done in terms of the matrix the 1.5 0.5 1 0 0.25 0 a A = 1.5 0.25 0 and v = b (whatever they are). 2 2 3 c 3 2 2
Slide 27: Again, let’s look at what we’ve done in terms of the matrix the 1.5 0.5 1 0 0.25 0 a A= 1.5 0.25 0 and v = b (whatever they are). 2 2 3 c 3 2 2 We essentially took the dot product of v with every row of A, then formed the vectors whose components were that vector.
Slide 29: The matrix-vector product Definition v1 v Let A = [aij ] be an m × n matrix and v = 2 a n-vector . . . vn (column vector). The matrix-vector product of A and v is the w1 w2 vector Av = , where . . . wm n wk = ak1 v1 + ak2 v2 + · · · + akn vn = akj vj , j=1 the dots product of kth row of A with v.
Slide 30: Discussion Dimensional considerations?
Slide 31: Discussion Dimensional considerations? Remark The matrix-vector product Av is defined only when A is m × n and v is column vector in Rn . The result is in Rm .
Slide 32: Example Let 2 3 2 A = −1 4 and v= −1 0 3 Find Av.
Slide 33: Example Let 2 3 2 A = −1 4 and v= −1 0 3 Find Av. Solution 2 · 2 + 3 · (−1) Av = (−1) · 2 + 4 · (−1) 0 · 2 + 3 · (−1)
Slide 34: Example Let 2 3 2 A = −1 4 and v= −1 0 3 Find Av. Solution 2 · 2 + 3 · (−1) 4−1 Av = (−1) · 2 + 4 · (−1) = −2 − 4 0 · 2 + 3 · (−1) 0−3
Slide 35: Example Let 2 3 2 A = −1 4 and v= −1 0 3 Find Av. Solution 2 · 2 + 3 · (−1) 4−1 1 Av = (−1) · 2 + 4 · (−1) = −2 − 4 = −6 . 0 · 2 + 3 · (−1) 0−3 −3
Slide 36: Matrix product redefined Another way to look at the product of a matrix and a vector is this: The product of A and v is a linear combination of the columns of A using the components of v as coefficients.
Slide 37: Matrix product redefined Another way to look at the product of a matrix and a vector is this: The product of A and v is a linear combination of the columns of A using the components of v as coefficients. (A linear combination is a combination of scaling and adding vectors)
Slide 38: Matrix product redefined Another way to look at the product of a matrix and a vector is this: The product of A and v is a linear combination of the columns of A using the components of v as coefficients. (A linear combination is a combination of scaling and adding vectors) So if 2 3 2 A = −1 4 and v= −1 0 3
Slide 39: Matrix product redefined Another way to look at the product of a matrix and a vector is this: The product of A and v is a linear combination of the columns of A using the components of v as coefficients. (A linear combination is a combination of scaling and adding vectors) So if 2 3 2 A = −1 4 and v= −1 0 3 Av = a1 v1 + a2 v2 2 3 4 −3 1 = −1 · 2 + 4 · (−1) = −2 + −4 = −6 0 3 0 −3 −3
Slide 40: Matrix product redefined Another way to look at the product of a matrix and a vector is this: The product of A and v is a linear combination of the columns of A using the components of v as coefficients. (A linear combination is a combination of scaling and adding vectors) So if 2 3 2 A = −1 4 and v= −1 0 3 Av = a1 v1 + a2 v2 2 3 4 −3 1 = −1 · 2 + 4 · (−1) = −2 + −4 = −6 0 3 0 −3 −3 which is the same as above.
Slide 41: Matrix Product Suppose we are running HDS and we know that flat breakfast fried batter concoction preferences change from house to house. Maybe it’s something like this: Food Frosh Lowell Dunster Pforzheimer Pancakes 70 60 50 40 Crˆpes e 20 30 30 30 Blintzes 10 10 20 30 Let B be the matrix above. Then we can get the house breakdown of ingredients for each class.
Slide 42: The amount of ingredients we need for the freshman class is Ab1
Slide 43: The amount of ingredients we need for the freshman class is 1.5 0.5 1 0 0.25 0 70 Ab1 = 1.5 0.25 0 20 2 2 3 10 3 2 2
Slide 44: The amount of ingredients we need for the freshman class is 1.5 0.5 1 125 0 0.25 0 70 5 Ab1 = 1.5 0.25 0 20 = 110 2 2 3 10 210 3 2 2 270
Slide 45: The amount of ingredients we need for the freshman class is 1.5 0.5 1 125 0 0.25 0 70 5 Ab1 = 1.5 0.25 0 20 = 110 2 2 3 10 210 3 2 2 270 That for the Lowell House is Ab2
Slide 46: The amount of ingredients we need for the freshman class is 1.5 0.5 1 125 0 0.25 0 70 5 Ab1 = 1.5 0.25 0 20 = 110 2 2 3 10 210 3 2 2 270 That for the Lowell House is 1.5 0.5 1 0 0.25 0 60 Ab2 = 1.5 0.25 0 30 2 2 3 10 3 2 2
Slide 47: The amount of ingredients we need for the freshman class is 1.5 0.5 1 125 0 0.25 0 70 5 Ab1 = 1.5 0.25 0 20 = 110 2 2 3 10 210 3 2 2 270 That for the Lowell House is 1.5 0.5 1 115 0 0.25 0 60 7.5 Ab2 = 1.5 0.25 0 30 = 97.5 , 2 2 3 10 210 3 2 2 260
Slide 48: The amount of ingredients we need for the freshman class is 1.5 0.5 1 125 0 0.25 0 70 5 Ab1 = 1.5 0.25 0 20 = 110 2 2 3 10 210 3 2 2 270 That for the Lowell House is 1.5 0.5 1 115 0 0.25 0 60 7.5 Ab2 = 1.5 0.25 0 30 = 97.5 , 2 2 3 10 210 3 2 2 260 and so on.
Slide 49: Putting this together gives a matrix 125 115 110 105 5 7.5 7.5 7.5 Ab1 Ab2 Ab3 Ab4 = 100 97.5 82.5 67.5 210 210 220 230 270 260 250 240
Slide 50: Matrix product, defined Definition Let A be an m × n matrix and B a n × p matrix. Then the matrix product of A and B is the m × p matrix whose jth column is Abj . In other words, the (i, j)th entry of AB is the dot product of ith row of A and the jth column of B. In symbols n (AB)ij = aik bkj . k=1 Example 1.5 0.5 1 125 115 110 105 0 0.25 0 70 60 50 40 5 7.5 7.5 7.5 1.5 0.25 0 20 30 30 30 = 100 97.5 82.5 67.5 2 2 3 10 10 20 30 210 210 220 230 3 2 2 270 260 250 240
Slide 52: Remark Dimensional considerations again
Slide 53: Remark Dimensional considerations again: In order for A and B to be multipliable, the number of columns of A has to be equal to the number of rows of B. The resulting matrix as the same number of rows as A and the same number of columns as B.
Slide 54: Remark Dimensional considerations again: In order for A and B to be multipliable, the number of columns of A has to be equal to the number of rows of B. The resulting matrix as the same number of rows as A and the same number of columns as B. Am×n Bn×p = (AB)m×p
Slide 55: Example Let 2 3 3 −1 A = −1 4 and B= 1 2 0 3 Find AB.
Slide 56: Example Let 2 3 3 −1 A = −1 4 and B= 1 2 0 3 Find AB. Solution 2 3 2·3+3·1 2 · (−1) + 3 · 2 −1 4 3 −1 = (−1) · 3 + 4 · 1 (−1) · (−1) + 4 · 2 1 2 0 3 0·3+3·1 0 · (−1) + 3 · 2 6 + 3 −2 + 6 9 4 = −3 + 4 1 + 8 = 1 9 0+3 0+6 3 6
Slide 57: Conclusions The product of matrices and vectors have very useful interpretations in various models. That’s why they’re so useful. Next time we’ll make sure that certain manipulations we want to do with these products are valid. In what ways are matrix products like the product of real numbers? Is it commutative? Associative? And so on.




Add a comment on Slide 1
If you have a SlideShare account, login to comment; else you can comment as a guest- Favorites & Groups
Showing 1-50 of 1 (more)