• Show that cosθ=(u⋅v)/(|u||v|) for 2D vectors u and v.

(it is quite hard to come up with these challenges, so if you got any ideas, please post them)

  • @[email protected]
    link
    fedilink
    4
    edit-2
    6 months ago

    A good exercise to dust off trig. Hopefully no typos involving u, v, 1, 2, α, and β.

    Trigonometric solution

    By definition of |u| and Pythagoras, we can see that u1 and u2 can represent the lengths the legs of a right triangle with |u| being the length of the hypotenuse. Similarly for v. The triangles can be visualized in the usual way by plotting the vectors in the XY plane centered at the origin, with u1 and v1 constituting the X coordinates and u2 and v2 the Y coordinates of u and v, respectively.

    Let α and β be the respective angles that u and v make with the X-axis. Then, θ = β - α, and

    u1 = |u| cos α

    u2 = |u| sin α

    v1 = |v| cos β

    v2 = |v| sin β

    Now consider the expression:

    |u| |v| cos θ

    = |u| |v| cos (β - α)

    = |u| |v| (cos β cos α + sin β sin α) (cosine angle difference formula)

    = (|u| |v| cos β cos α) + (|u| |v| sin β sin α) (distribute)

    = (|u| cos α)(|v| cos β) + (|u| sin α)(|v| sin β) (commutativity, associativity)

    = (u1)(v1) + (u2)(v2) (substituting)

    = uv (definition)