Angle Between Two 2D Vectors (Components)

θ=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)

Worked example: (1, 0) and (1, 1) → 45° — press Try an example to run it live, then adjust anything.

Enter your known values, leave one input blank, and solves for the missing one. Tap a variable’s symbol to see what it means, with a typical value. Try different units for next level excitement!

Here the solver did the work — could you?

The angle between →

Grade 12Grade 12 Math

Test your skills in the Exam Room: new numbers every attempt — free lessons for students, no sign-up, just pure learning.

See your Report Card
Compete with your friends
share your results
Learning zone

Angle Between Two 2D Vectors (Components) explained

θ(ax, ay)(bx, by)

Divide the dot product by both magnitudes and what is left is a pure cosine, so the angle between any two vectors falls out of their coordinates with no drawing required. Take a = (1, 0) and b = (1, 1): the dot product is 1, the magnitudes are 1 and √2, and arccos(1/√2) = 45°, which is obviously right. Take a = (3, 4) and b = (4, 3): the dot product is 24, both magnitudes are 5, and arccos(24/25) = arccos(0.96) ≈ 16.26° — a result no sketch would give you to two decimals.

The Cauchy–Schwarz inequality guarantees the fraction never leaves the range −1 to 1, so an angle always exists. Floating-point arithmetic does not care: for two nearly parallel vectors the computed ratio can come out as 1.0000000000000002, and arccos of that is NaN. This is one of the most reported bugs in graphics and robotics code, and the fix is a one-line clamp before the arccos — which formula.expert applies. Note also that the answer runs from 0° to 180° and carries no sense of rotation; if you need to know whether b sits clockwise or counterclockwise from a, use the cross product's sign instead.

Angle Between Two 2D Vectors (Components) formula

θ=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)
Where
  • θ\theta= Angle between a and b (°)
  • axa_x= x-component of a
  • aya_y= y-component of a
  • bxb_x= x-component of b
  • byb_y= y-component of b