When finding the direction angle with the formula $\theta = \tan^{-1} \left(\frac{y}{x}\right )$, when do you add $180$ degrees to the answer? Is it whenever the $x$ is negative, when the angle is in the third or fourth quadrant (if this is the case, how would I know the angle is there?), or just in the third quadrant (if this is the case, how would I know the angle is there)? Or something else entirely?
[Math] When do you add $180$ to the directional angle
vectors
Related Solutions
You are clearly seeking for the two-argument inverse tangent function $\left(x,y\right)\mapsto\arctan\left(x,y\right)$.
Its main difference from the plain old $\tan^{-1}$ is precisely that it takes the quadrant of the point $\left(x,y\right)$ in $\mathbb{R}^2$ into account, which is lost when the usual one-argument arctangent function version is used like you first intended due to the identities $$\frac xy=\frac{-x}{-y}$$ and $$\frac{-x}y=\frac x{-y}$$ which arise when the usual one-argument inverse tangent function is used like follows: $$\arctan\left(x/y\right).$$
To mitigate the problem, instead use the two-argument version $\arctan\left(x,y\right)$, which in most languages is known as arctan2
, atan2
or something similar.
Draw a picture beforehand and you will have some kind of idea where your angle should lie. In particular, if you know your unit circle very well, you will know what angles correspond with which quadrants.
So for the vector $\langle-10,9\rangle$, we know the $x$-component is negative meaning it goes to the left, and its $y$-component is positive, meaning it moves up. So on a coordinate plane, you know that this ends up in quadrant II. In quadrant II, you deal with angles between $90^\circ$ and $180^\circ$. So, the answer for $\approx 138^\circ$ is reasonable to leave as-is.
When you're dealing with $\langle-6,0\rangle$, if we draw a picture, the $x$-component makes the vector go left, and the $y$-component contributes nothing to the direction of the vector. So if we take the positive $x$-axis to be $0^\circ$, then the negative $x$-axis will be $180^\circ$. Hence, it is obvious that $\tan^{-1}\left({0\over-6}\right) = 0^\circ$ is not reasonable to leave as-is, and why we must add $180^\circ$ to the angle measure.
Let's try one more example, shall we? Consider the vector $\langle-3,-4\rangle$. This vector ends up in quadrant III, which means the angle should end up between $180^\circ$ and $270^\circ$. Then $\tan^{-1}\left({-4\over-3}\right) \approx 53^\circ$, which is in quadrant I. However, this does not line up with our intuition of where this vector should land. Hence, we may add $180^\circ$ to this degree measure to give us the correct angle measure which will land in quadrant III, since $53^\circ + 180^\circ = 233^\circ$.
Best Answer
If you look at this table in the Wikipedia article, you will see that in the arctangent row, the "range of usual principal value" is given as $-90^\circ<y<90^\circ$.
This means that if you give a number to the arctangent function, most calculators respond with an answer between $-90^\circ$ and $90^\circ$. This is the half-plane on the right, quadrants I and IV, so $x$ is assumed positive.
If $x$ is negative, the answer you want is $180^\circ$ away.