←
Lesson 21 · The angle between
Normalise, then read the angle off
score 0

Normalise, then read the angle off

The dot product has two faces, so set them equal: axbx+ayby=∣a⃗∣ ∣b⃗∣cos⁡θa_x b_x + a_y b_y = |\vec{a}|\,|\vec{b}|\cos\theta. Everything in that sentence is known except θ\theta, so solve for it: θ=cos⁡−1(a⃗⋅b⃗∣a⃗∣ ∣b⃗∣)\theta = \cos^{-1}\left(\dfrac{\vec{a}\cdot\vec{b}}{|\vec{a}|\,|\vec{b}|}\right), read aloud theta equals inverse cos of a dot b over the magnitude of a times the magnitude of b. Three ingredients, and this lesson makes you cook all three: the dot product on top, and BOTH magnitudes multiplied underneath.

Dividing by the two lengths is called normalising, and it is the step that makes the answer depend on direction alone: double either arrow and the top and bottom double together, leaving θ\theta untouched — exactly as geometry demands. The ratio therefore always lands between −1-1 and 11; if yours does not, the arithmetic broke upstream, and no amount of retyping will fix it. One more mercy: unlike the direction angle, this one has no quadrant problem. The angle between two vectors is defined from 0∘0^\circ to 180∘180^\circ, and cos⁡−1\cos^{-1} returns exactly that range and nothing else.

θ(ax, ay)(bx, by)

θ=arccos⁡(axbx+aybyax2+ay2 bx2+by2)\theta = \arccos\left(\frac{a_x b_x + a_y b_y}{\sqrt{a_x^2+a_y^2}\,\sqrt{b_x^2+b_y^2}}\right)

  • θ\theta= Angle between a and b (angle)
  • axa_x= x-component of a
  • aya_y= y-component of a
  • bxb_x= x-component of b
  • byb_y= y-component of b
Angle Between Two 2D Vectors (Components) solver →
ayaxbybxa·b

a⃗⋅b⃗=axbx+ayby\vec{a}\cdot\vec{b} = a_x b_x + a_y b_y

  • a⃗⋅b⃗\vec{a}\cdot\vec{b}= Dot product
  • axa_x= x-component of a
  • aya_y= y-component of a
  • bxb_x= x-component of b
  • byb_y= y-component of b
Dot Product of Two 2D Vectors (Components) solver →
|v|vyvx

∣v⃗∣=vx2+vy2|\vec{v}| = \sqrt{v_x^2 + v_y^2}

  • ∣v⃗∣|\vec{v}|= Vector magnitude
  • vxv_x= x-component
  • vyv_y= y-component
Magnitude of a 2D Vector solver →