Recall (dot product)
let a=[a1 a2 a3] , be is the same in R3.
Dot product of a⋅b=a1b1+a2b2+a3b3.
a⋅a=∣∣a∣∣2
so ∣∣a∣∣=a⋅a
Properties of dot products:
- a⋅b=b⋅a
- a⋅(b+c)=ab+ac
- (αa)⋅b=a⋅(αb),α∈R
Fact: a⋅b=∣∣a∣∣⋅∣∣b∣∣cosθ where θ is the angle between a and b.
Proof (law of cosine)
∣∣b−a∣∣2=∣∣a∣∣2+∣∣b∣∣2−2∣∣a∣∣∣∣b∣∣cosθ(b−a)(b−a)=a⋅a+b⋅b−2∣∣a∣∣∣∣b∣∣cosθ
after reduction..
−2a⋅b=−2∣∣a∣∣∣∣b∣∣cosθa⋅b=∣∣a∣∣⋅∣∣b∣∣cosθ
Corrolary: a⊥b⟺a⋅b=0
Ex:
Find the angle between u=[-1\\1\\2] and v[2\\1\\-1]
cosθ=∣∣a∣∣⋅∣∣b∣∣a⋅b
dot product works out to:
-2 + 1 - 2
= -3
∣∣u∣∣=−12+12+22=6
∣∣v∣∣=22+12+−12=6
plug into cosθ
62−3=6−3=2−1