TITLE: Question about polar coordinates
QUESTION [2 upvotes]: I'm just learning about polar coordinates now, and I understand the basics pretty well, but I get confused at a particular part.
I understand the following relations:
$x = r\cos(\theta)$ 
$y = r\sin(\theta)$
$r^2 = x^2 + y^2$
$\tan(\theta)$ = y / x 
but then it says:
$\tan(\theta) = (y/x) + \pi$  if $x < 0$
and
$\tan(\theta) = +- (\pi/2)$ if $x = 0$
and I do not understand why those last two are the way they are... Why does the value of $x$ matter?

REPLY [1 votes]: Suppose you have $x$ and $y$, and want to find $\theta$. One way you might do this is to take $\tan^{-1}$ of $y/x$, but you have to be careful; the range of $\tan{-1}$ is $(-\pi/2,\pi/2)$, so if $\theta$ is actually in the $3$rd or $4$th quadrant (i.e. $x < 0$), some additional care is needed.
For example, if $x = -3, y = 3$ then $y/x = -1$, with $\tan^{-1}(-1) = -\pi/4$. But if you sketch that point, you see that $\theta$ is actually $3\pi/4$. Thus the "$+\pi$".
In other words

if $x>0$ then $\theta = \tan^{-1}(y/x)$, if $x < 0$ then $\theta = \tan^{-1}(y/x) + \pi$.

Now, if $x=0$, we have a different problem! In this case, $y/x$ isn't even defined, so we don't even bother with $\tan^{-1}$. But, you can just use geometric reasoning here. If you're talking about a point $(x,y)$ with $x=0$, then the angle has to be $\pi/2$ or $-\pi/2$.
Thus

If $x = 0$, then $\theta = \pm \pi/2$ $\quad( \pi/2$ if $y>0$ and $-\pi/2$ if $y<0$).
{"set_name": "stack_exchange", "score": 2, "question_id": 567696}