HallsofIvy said:
Most commonly given is: arg(x+ iy)= arctan(y/x).
Only if x>0. Else = arctan(y/x) +/- pi.
[tex]\theta = arctan(y/x) \pm \pi[/tex]
Anytime we use inverse trig we must account for the fact that the trig functions are not invertible over their entire domain. We must first restrict the domain and this restricts the range of the inverse trig functions. We must use different restrictions for different trig functions so in this case it helps to think of the tangent of the angle as the slope of the line (through the origin) at that angle. The ambiguity then is on which side of the origin lies a point on the line with given slope=tan(theta).
The convention for tangent is to work in the right half-plane, [itex]-\pi/2 \le arctan(m) \le \pi/2[/itex] (so that the domain is connected) thus we only get correct results with [itex]x\ge 0[/itex]. Again remembering we are working via tan with slopes we simply rotate the line [itex]180^o = \pi[/itex] modulo the full circle to get the other two quadrants.
For general inverse trig issues one picks a connected part of the unit circle which spans the definition of the value trig function... e.g.
[itex]-\pi/2 \le \theta \le \pi/2[/itex] for tangent and sine (slope and y-coordinate)
and
[itex]0\le \theta \le \pi[/itex] for cotangent and cosine (1/slope and x-coordinate)
This is all analogous to the [itex]\pm[/itex] ambiguity we put in a square root because the principle root is defined for the restricted domain [itex]x \ge 0[/itex] of the square function.
[itex]x^2 = a \quad \Longleftrightarrow \quad x = \pm\sqrt{a}[/itex]