Complex numbers: Cartesian form into polar form

Apparently I have an understanding issue regarding the topic in the title.

Let's convert a complex number $z=re^{i\varphi}=a+ib$ from cartesian into polar form. Obviously $r^2=a^2+b^2$. But for the angle $\varphi$ I have to consider 4 cases:

1. $a>0,b>0$ (1st quadrant): Then we simply have $\cos\varphi=a/r$, so $\varphi=\arccos(a/r)$.
2. $a<0,b>0$ (2nd quadrant): Then we have $\cos(\pi-\varphi)=a/r$, so $-\cos\varphi=a/r$ and therefore $\varphi=\arccos(-a/r)$.
3. $a<0,b<0$ (3rd quadrant): Then we have $\cos(\varphi-\pi)=a/r$, so $-\cos\varphi=a/r$ and therefore $\varphi=\arccos(-a/r)$.
4. $a>0,b<0$ (4th quadrant): Then we have $\cos(2\pi-\varphi)=a/r$, so $\cos(\varphi)=a/r$ and therefore $\varphi=\arccos(a/r)$.

In total I obtain $$\varphi=\begin{cases}\arccos(a/r) & ,a\geq 0\\ \arccos(-a/r) &,a<0\end{cases}$$

If I look up the "formula" in wikipedia however it says $$\varphi=\begin{cases}\arccos(a/r) & ,b\geq 0\\ -\arccos(a/r) &,b<0\end{cases}$$

Where is my error?

• In ALL cases we must have $\cos \varphi =a/r$ and $\sin \varphi=b/r$ because $a+ib =r(a/r+ib/r)=r(\cos \varphi+i\sin \varphi).$ Commented Apr 14, 2018 at 20:12
• Picture $a+ib$ as the point $(a,b)$ in $\Bbb R^2.$ If $b\ne 0$ then $|\varphi| =\angle COD$ where $C=(a,b)$ and $O=(0,0)$ and $D=(1,0).$ Commented Apr 14, 2018 at 20:18
• That is exactly what I did to obtain my formulas. I dont understand what you mean.
– Buh
Commented Apr 14, 2018 at 21:10
• In 2, you have $\cos (\pi -\varphi) =a/r$ which is incorrect. We always have $\cos \varphi =a/r.$ Commented Apr 15, 2018 at 4:45

However obvious, point is that $\,r(\cos \varphi + i \sin \varphi)=a+ib \implies r \cos \varphi = a\,$ and $\,r \sin \varphi = b\,$. The following will assume $\,r \ne 0\,$, in which case $\,\cos \varphi = a/r\,$ and $\,\sin \varphi = b/r\,$.
1. $a<0,b>0$ (2nd quadrant): Then we have $\color{red}{\cos(\pi-\varphi)=a/r}$, so $-\cos\varphi=a/r$ and therefore $\varphi=\arccos(-a/r)$.
No, because that gives $\,\cos \varphi = - \cos(\pi - \varphi) = -a/r \color{red}{\ne} a/r\,$. Remember that $\,\cos \varphi = a/r\,$ regardless of quadrant.
Instead, $\,\cos \varphi = a/r \implies \varphi = 2k\pi \pm \arccos(a/r)\,$ for some integer $\,k \in\mathbb{Z}\,$. With the usual conventions that $\,\arccos\,$ takes values in $\,[0,\pi]\,$ and the complex $\,\arg\,$ is in $\,(-\pi,\pi]\,$, this means $\,k=0\,$, and so $\,\varphi = \pm \arccos(a/r)\,$.
The choice of signs depends on the quadrant. In the first and second quadrants $\,\sin \varphi = b/r\,$ is positive, so $\,\varphi = +\arccos(a/r)\,$ when $\,b \ge 0\,$. In the third and fourth quadrants $\,\sin \varphi = b/r\,$ is negative so $\,\varphi = -\arccos(a/r)\,$ when $\,b \lt 0\,$, which is precisely what the wikipedia page says.