# Proving by calculation that $\arg(-2) = \pi$

The fact that it is true, seems very obvious, if one draws the complex number $z = (-2 + 0i)$ on the complex plane. The angle is certainly 180 degrees, or pi radians.

But how can this be proven by calculation? Using $\arg(z)=\arctan(b/a)$ or even the "extended" version $\arg(z) = \arctan(b/a) + \text{sign}(b)(1-\text{sign}(a))$ gives $0$.

-
This depends on what your definition for the argument is. Some authors consider the argument to lie in the interval $(-\pi,\pi]$; others consider the argument to lie in the interval $[0,2\pi)$; others have other variations. Likely though, it would indeed be $\pi$. – Cameron Williams Jun 18 '14 at 2:01

We can arrive at this conclusion by using the definition of $\arg(z)$. Recall that every complex number can be written in the form,

$$z = r( \cos(\theta) + i \sin(\theta) ),$$

where $r=\left| z \right|$ and $\theta = \arg(z)$. If $z=-2$ then we have two equations,

$$-2 = r \cos(\theta) \qquad 0 = r\sin(\theta)$$

The first equation tells us that $r\neq 0$ which then combined with the second equation tells us that $\sin(\theta) = 0$ which is only satisfied if theta is a multiple of $\pi$, i.e. $\theta = n\pi$. We now substitute $\theta = n\pi$ into the first equation and get,

$$-2 = r \cos(n\pi),$$

$$\Rightarrow -2 = r (-1)^n,$$

$$\Rightarrow r = 2 (-1)^{n+1},$$

but we know that $r>0$ so $n$ must be odd for the last equality to hold. Therefore we know know that $\theta$ is an odd multiple of $\pi$. In other words,

$$\arg(-2) = \pi + 2\pi k$$

-

You must use the function $\text{arctan2}(y,x)$, not $\arctan$. Simply using $\arctan y/x$ will not give you the angle that the point $(x,y)$ makes with the origin, since the $\tan$ function repeats itself every $\pi$, i.e. $\tan x = \tan (x+\pi)$, i.e. does not have an inverse on the entirety of it's domain. This means that the $\arctan$ function (as conventionally defined) can only return angles between $-\pi/2$ and $\pi/2$.

The function $\text{arctan2}(y,x)$, will however return the correct angle, as it takes into consideration what quadrant the point is in.

-
Good answer. This gives a nice definition: en.wikipedia.org/wiki/Atan2#Definition_and_computation – NotNotLogical Jun 18 '14 at 2:03
Unfortunately, we can only upvote once... I am in a personal crusade against the formula $\theta=\arctan(\frac{y}{x})$, which is, to my despair, seen everywhere. – Taladris Jun 18 '14 at 10:53

$\arg(-2)=\pi-\arctan\left( \frac{0}{-2} \right)=\pi-\arctan(0)=\pi-0=\boxed\pi$

-

More complicated than $\arctan(y/x)$, yet valid for all $z\ne0$ is $$\arg(x+iy)=\left\{\begin{array}{cl} 2\arctan\left(\frac{y}{x+\sqrt{x^2+y^2}}\right)&\text{if }y\ne0\text{ or }x\gt0\\[6pt] \pi&\text{otherwise} \end{array}\right.$$ which is based on the identity $$\tan(\theta/2)=\frac{\sin(\theta)}{1+\cos(\theta)}$$

-