Direction Angle of a 2D Vector

θ=atan2⁡(vy,  vx)\theta = \operatorname{atan2}(v_y,\; v_x)

Worked example: Components (−1, 1) → direction 135° — 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?

Reading the vector →

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. Find 3 more lessons on this formula.

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

Direction Angle of a 2D Vector explained

θvyvx

Components tell you where a vector ends; the direction angle tells you which way it leans. Since tan θ = vy/vx, the naive answer is arctan(vy/vx) — and that answer is wrong half the time. The ratio for (−3, −4) is identical to the ratio for (3, 4), so a plain arctan reports a vector pointing southwest as though it pointed northeast. The fix is the two-argument function atan2(vy, vx), which keeps both signs and returns the true bearing anywhere in the full −180° to 180° sweep. It entered programming through early Fortran and is now in every standard library precisely because the quadrant bug was so pervasive.

Example: (−1, 1) points up and to the left, and atan2(1, −1) = 135° — correct, where arctan(1/−1) = −45° would have been off by exactly half a turn. Read the other way, a vector known to lie at 30° with vx = 10 must have vy = 10 tan 30° ≈ 5.774. Straight up or straight down the tangent blows up, which is the arithmetic's honest way of saying a vertical vector has no run to divide by.

Direction Angle of a 2D Vector formula

θ=atan2⁡(vy,  vx)\theta = \operatorname{atan2}(v_y,\; v_x)
Where
  • θ\theta= Direction angle from +x axis (°)
  • vxv_x= x-component
  • vyv_y= y-component