Lecture06_Dot_Cross_Products_NEW

advertisement
Dot & Cross Product
Dot Product (2.11)
• Symbolically:
𝒗•𝒘
– NOT, NOT, NOT vector multiplication
• Numeric Interpretation #1
𝒗 • 𝒘 = 𝒗𝟏 ∗ 𝒘𝟏 + ⋯ + 𝒗𝒏 ∗ 𝒘𝒏
– Result is a scalar.
𝒗•𝒘=𝒘•𝒗
– Example:
4
0
3 • 2 = 4 ∗ 0 + 3 ∗ 2 + −1 ∗ 5
5
−1
=0+6−5
=1
D.P. Application #1
• Look at 𝑣 • 𝑣
– Numerically: 𝑣1 ∗ 𝑣1 + ⋯ + 𝑣𝑛 ∗ 𝑣𝑛
– Look familiar?
• Length, without the final square root.
• Or…the length squared
𝒗•𝒗= 𝒗 𝟐
Dot Product, cont.
• Numeric Interpretation #2:
𝑣 • 𝑤 = 𝑣 ∗ 𝑤 ∗ cos(θ)
– Where θ is the angle made when the two vectors
are placed tail-to-tail.
– Comes from the Law of Cosines
Law of Cosines
C
γ
b
a
A
α
β
c
B
c 2  a 2  b2  2ab* cos( )
Sort of like the Pythagorean theorem for any triangle (not just right triangles)
Law of Cosines => D.P. Interp #2
1. Let 𝑣 = 𝐴 − 𝐶
2. Let 𝑤 = 𝐵 − 𝐶
3. Let 𝑞 = 𝑣 − 𝑤
4. 𝑣●𝑣 = 𝑣 2 (by D.P App#1)
𝑣
𝑤
C
γ
b
a
A
– This equals b in the drawing above.
α
β
c
𝑞
B
5. Similar steps for w and q
6. 𝑐 2 = 𝑎2 + 𝑏2 − 2𝑎𝑏𝑐𝑜𝑠(γ) (Law of Cosines)
7. (𝑣 − 𝑤)●(𝑣 − 𝑤) = 𝑣●𝑣 + 𝑤●𝑤 − 2 𝑣 𝑤 cos γ
(using step 4)
8. 𝑣 − 𝑤 ● 𝑣 − 𝑤 = 𝑣●𝑣 + 𝑤●𝑤 − 2 𝑣●𝑤 (using
FOIL and distributive law of D.P., 2.13)
9. 𝑣●𝑤 = 𝑣 𝑤 cos γ (substitue r.h.s of 8 into l.f.s
of 7 and simplify)
10.Q.E.D.
Let’s look at the 5two
interpretations



10
  
v 5
Let  0 
 

w   3
and  0 
Let’s draw a picture:
v
w
θ
w

θ is ≈ 60 degrees
Example, continued
10
  
v 5
 0 
5
  
w   3
 0 
Theta is ≈ 60.0 degrees.
Let’s hypothesize that interpretation#2 and interpretation#1 are both correct,
but let’s compare the numbers for this test case…just to be sure.
 
   
Interpretation#2:v  w  v * w * cos( )

v  102  52  02  100 25  125  11.18

w  52  (3) 2  02  25  9  31  5.57
   
v  w  v * w * cos   11.18 * 5.57 * cos(60)
Interpretation#1: v  w  10* 5  5 * (3)  0 * 0  50  15  35
 31.14
(Note: We guessed on theta, and rounded off the lengths. Otherwise
they would be identical)
Application of D.P #2
(Calculation of θ)
• We can come up with an exact value for θ, given any two vectors
using a little algebra and our two definitions of dot product.
   
v  w  v * w * cos( )
 
 
v * w * cos( )
v w
  
 
v *w
v *w
 
v w
   cos( )
v *w
 
v w
1
cos (   )  cos 1 (cos( ))
v *w
 
v w
1
  cos (   )
v *w
Application of Dot Product #3

θ is the angle between v and w. In each of these
cases, think of what cos(θ) would be…
w
cos(120)=-0.5
θ≈120
w
Acute
θ
θ
θ≈45
cos(45)=0.707
v
v
θ
v
θ≈120 cos(120)=-0.5
w
w
Obtuse
θ≈180 cos(180)=-1
θ
θ
v
θ≈90
cos(90)=0
w
NOTE: We never have to deal with
v
Right
.
Application of Dot Product #3
(θ “Categorization”)
• We can classify what type of angle is made by two vectors by looking at the
sign of the dot product.
• Acute:
• Obtuse:
• Right:
 
v  w  0
v  w
 0
vw 0
If v and w are both unit-length (normalized), we can make some more observations:

 1  vˆ  w  1 ALWAYS!
vˆ  wˆ  1 if they are equal (the d.p is close to 1 if they’re in the same general direction).
vˆ  wˆ  1 if they are opposite (the d.p is close to -1 if they’re in generally opposite directions).
Application #4 (projection)

Let v,w be two vectors.

Consider a triangle
w

θ
How long is a ?

A: 𝑤 *cos(θ)
Remember: 𝑣●𝑤 = 𝑣

So…

a=
𝑣●𝑤
𝑣
a
𝑤 *cos(θ)
𝒑

The projection of 𝑤 𝑜𝑛𝑡𝑜 𝑣 is 𝑝 (whose length is a)

𝑝=𝑎∗
𝑣
𝑣
Application #4, cont.
• For any two vectors, 𝑟 and 𝑠…
– The projection of 𝑟 onto 𝑠 is
– This can be simplified to:
•
𝑟●𝑠∗𝑠
𝑠 2
•
𝑟●𝑠∗𝑠
𝑠●𝑠
𝒓●𝒔
𝒔
∗
𝒔
𝒔
Application #4, cont.
• It works even if they make an obtuse angle
𝑟
𝑝
𝑠
Cross Product (5.11)
 
• Symbolically: v  w
• Again, NOT, NOT, NOT vector multiplication!
• The result is a vector.
Cross Product (5.11)



A little trickier than dot product
Only useful (to us) in 3D
Imagine two vectors v,w




They aren't parallel (or antiparallel)
They lie in a plane
The plane has a normal. Call it n.
y
n
Define:
w
v× w= n

v
How do we compute it?

We can use a visualization
to remember...
z
x
Cross Product, Numerically
X=
Y=
Z=
x
y
z
Vx
Vy
Vz
Wx
Wy
Wz
x
y
z
Vx
Vy
Vz
Wx
Wy
Wz
x
y
z
Vx
Vy
Vz
Wx
Wy
Wz
v y * wz  vz * wy 
  

v  w   vz * wx  vx * wz 
vx * wy  v y * wx 


Another C.P. mnemonic
resultx  vy * wz  vz * wy
Increase the subscripts by 1, “wrapping” around from z=>x
resulty  vz * wx  vx * wz
Increase the subscripts by 1, “wrapping” around from z=>x
resultz  vx * wy  vy * wx
Memorize Me
Direction

Cross product is anticommutative


Meaning:
v x w = -(w x v)
Determining direction of result:

If we compute n = v x w: Use right-hand rule

Or, if in left handed space, use left-hand rule
w
n
v
Properties

Additional properties:



||v x w|| = area of parallelogram
||v x w|| = ||v|| ||w|| sin θ
v x v = (0,0,0) y
n
w
v
z
x
Download