Andromeda
Note

Angle Between Vectors

Definition

The angle θ\theta between two nonzero vectors u\mathbf{u} and v\mathbf{v} is the smallest non-negative angle (0θπ0 \leq \theta \leq \pi) formed by the vectors when placed initial-point to initial-point.

  • How to read: “Theta is between zero and pi; vectors u and v.”
  • Meaning: The smallest non-negative angle when vectors are placed initial-point to initial-point—always in [0,π][0, \pi], never the reflex angle.

Why It Matters

This angle measures the “alignment” of two forces or trends. In machine learning, it is the basis of “cosine similarity,” allowing computers to understand how “close” two pieces of text, images, or users are in a high-dimensional space.

Core Concepts

  • Computation: Derived from the geometric definition of the dot product: cosθ=uvuv\cos \theta = \frac{\mathbf{u} \cdot \mathbf{v}}{|\mathbf{u}| |\mathbf{v}|}.

    • How to read: “The cosine of theta equals the dot product of u and v, divided by the product of their magnitudes.”
    • Meaning: Dot product normalized by lengths gives cosine of the angle—works in any dimension.
  • Formula: θ=arccos(uvuv)\theta = \arccos \left( \frac{\mathbf{u} \cdot \mathbf{v}}{|\mathbf{u}| |\mathbf{v}|} \right).

    • How to read: “Theta equals the arc-cosine of the dot product of u and v, divided by the magnitude of u times the magnitude of v.”
    • Meaning: Direct computation when you have components; clamp input to [1,1][-1,1] for numerical safety.
  • Sign Significance:

    • uv>0    \mathbf{u} \cdot \mathbf{v} > 0 \implies Acute angle (0θ<π/20 \leq \theta < \pi/2).
      • How to read: “The dot product of u and v is greater than zero.”
      • Meaning: Acute angle (0θ<π/20 \leq \theta < \pi/2)—vectors point roughly the same direction.
    • uv<0    \mathbf{u} \cdot \mathbf{v} < 0 \implies Obtuse angle (π/2<θπ\pi/2 < \theta \leq \pi).
      • How to read: “The dot product of u and v is less than zero.”
      • Meaning: Obtuse angle (π/2<θπ\pi/2 < \theta \leq \pi)—vectors point in opposing directions.
    • uv=0    \mathbf{u} \cdot \mathbf{v} = 0 \implies Right angle (θ=π/2\theta = \pi/2).
      • How to read: “The dot product of u and v equals zero.”
      • Meaning: Right angle (θ=π/2\theta = \pi/2)—orthogonality test with no shared directional component.

Connected Concepts