If I have a point say $(-8,-20)$, how can I calculate the angle. It should be a little under $270$ or a little over $-90$. However when I try this in google

atan(-20/-8) in degrees

it gives me $68.1985905$ degrees.

Does anyone know what's wrong?


  • $\begingroup$ Plot the point and draw a line from the origin to it. Drop a vertical to the nearest horizontal axis. You have a triangle with height 20 and base 8. Find the angle your line makes with the horizontal P = atan(20/8). Look at your picture and decide how much you need to add/subtract to this angle to get the one you want (+180 in your case) $\endgroup$
    – Paul
    Feb 21, 2017 at 17:59
  • $\begingroup$ isn't there a formula to always get the angle starting from the right side? (instead of adding if statements to add sub angles to it after) $\endgroup$
    – omega
    Feb 21, 2017 at 18:02
  • $\begingroup$ If you don't want to have to remember that you have to add $180^\circ$ if the point is in QII or QIII or add $270^\circ$ if it's in QIV, then just use $\operatorname{atan2}(y,x)$ instead of $\arctan(\frac yx)$. The downside is, though, that I've yet to see a calculator with an $\operatorname{atan2}$ key. $\endgroup$
    – user137731
    Feb 21, 2017 at 18:03
  • $\begingroup$ Thanks, atan2 did the trick. And i'm using javascript. $\endgroup$
    – omega
    Feb 21, 2017 at 18:07

1 Answer 1


Given a particular value $a = \tan(x)$ there are two angles in the interval $(-\pi, \pi]$ or $[0, 2\pi)$ that have $a$ as their tangent. (See graph.)

To determine which angle, you'll need to look at which quadrant your point is in, and you can do this by inspection. Then, if you end up with an angle that doesn't make sense, you simply add or subtract $\pi$ to get it in the right quadrant.

Or, as suggested in the comments, you can use the "atan2" function that takes two arguments (thereby specifying the quadrant for you) and you'll get the right answer straight off.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .