# Regarding the formula $\mathrm{arg}(z)=\mathrm{tan}^{-1}\left(\frac{\Im z}{\Re z}\right).$

Given a non-zero complex number $z$, write $\mathrm{arg}(z)$ for the prinicipal argument of $z$, defined as the unique $\theta \in (-\pi,\pi]$ for which there exists $r \in \mathbb{R}_{>0}$ such that $z = r e^{i\theta}.$

Then for all non-zero $z$, we have: $$\tan(\mathrm{arg}(z)) = \frac{\Im z}{\Re z}$$

Unfortunately, the "inverse" formula $$\mathrm{arg}(z)=\mathrm{tan}^{-1}\left(\frac{\Im z}{\Re z}\right)$$ only works for $\Re z \geq 0,$ due to injectivity issues.

We can fix this by introducing a correction factor. Define a function $$f : \mathbb{C}_{\neq 0} \rightarrow \mathbb{R}$$ by writing

$$f(z) = \begin{cases}\pi & \Re z < 0 \,\&\,\Im z \geq 0 \\ -\pi &\Re z < 0 \,\&\,\Im z < 0 \\ 0\end{cases}$$

Then if I'm not mistaken, we have: $$\forall(z \in \mathbb{C}_{\neq 0})\qquad \mathrm{arg}(z) = \mathrm{tan}^{-1}\left(\frac{\Im z}{\Re z}\right) + f(z).$$

More generally, for any half-open interval $I \subseteq \mathbb{R}$ of length $2\pi$, there should be a corresponding function $$f_I : \mathbb{C}_{\neq 0} \rightarrow \mathbb{R}$$ such that $$\forall(z \in \mathbb{C}_{\neq 0}) \qquad \mathrm{arg}_I(z) = \mathrm{tan}^{-1}\left(\frac{\Im z}{\Re z}\right)+f_I(z).$$

Question.

Q0. Is there a name for $f_I$, in either the special case given above corresponding to $I = (-\pi,\pi]$, or else in the general case?

Q1. What's the explicit formula for $f_I(z)$, for arbitrary $I = (a,b]$ where $b-a =2\pi$?

• In computation related contexts atan2(y, x) is often available for that precise reason. – dxiv Aug 8 '17 at 3:42
• @dxiv, that's a reasonable solution. I'd still like an answer to this question though, because I have a policy of doing things more-or-less as the book I'm reading is doing it, with small corrections like this to make things better wherever possible. That is, I don't bother completely rethinking everything until I'm pretty much done with whatever I'm reading. – goblin Aug 8 '17 at 3:44

I've always liked this one, because of its flexibility (overlapping half-planes):

$$\operatorname{Arg}(x + iy) = \operatorname{atan2}(y,\, x) = \begin{cases} \arctan\left(\frac{y}{x}\right) &\text{if } x > 0, \\ \frac{\pi}{2} - \arctan\left(\frac{x}{y}\right) &\text{if } y > 0, \\ -\frac{\pi}{2} - \arctan\left(\frac{x}{y}\right) &\text{if } y < 0, \\ \arctan\left(\frac{y}{x}\right) \pm \pi &\text{if } x < 0, \\ \text{undefined} &\text{if } x = 0 \text{ and } y = 0. \end{cases}$$

another one that is short is

$$\operatorname{Arg}(x + iy) = \operatorname{sgn}(y) \, \arccos\left( \frac{x}{\sqrt{x^2 + y^2}} \right)$$

The answer to $Q0$ is $\arg(z) = 2\tan^{-1}(y/(|z|+x))$ if $z=x+yi$ with no correction needed.

The advantage of this formula is that it only uses $\tan^{-1}$ and $|z|$ and works for all $z\neq 0$.

The answer to $Q1$ is $\:\arg(zc)/c\:$ for some $c\in C$ with $|c|=1$.

• Shouldn’t this formula be homogeneous? – Lubin Aug 8 '17 at 3:19
• @Lubin Thanks, of course, I forgot about that. – Somos Aug 8 '17 at 3:23