Consider the function [atan2](https://en.wikipedia.org/wiki/Atan2) defined on the plane, minus the origin and the negative $x$-axis, as the unique $\theta$ such that $-\pi<\theta<\pi$ and
$$ x = r \cos \theta, \qquad y=r \sin \theta$$
where $r = \sqrt{x^2+y^2}$.

I would like to prove rigorously that `atan2` is a continuously differentiable function of $x$ and $y$ in the domain above. Two approaches which I think don't work:

1. Implicit differentiation: this doesn't help since the implicit function theorem is only local. So it cannot help us prove that `atan2` is a single $C^1$ function over the entire domain described above.
2. Replace $\mbox{atan2}(x,y)$ by $\tan^{-1}(y/x)$: this throws away information about the signs of $y$ and $x$ and hence cannot represent $\mbox{atan2}$ over the entire domain. Also, $y/x$ is undefined when $x=0$, but there are such points in the domain.

I would be grateful for an outline of the proof or a reference to a book where it can be found.