Theorem: Direction Angle of 2D Vector in Terms of Arctangent

Let $\mathbf a$ be a vector quantity embedded in a Cartesian plane $P$ expressed in component form as:
:$\mathbf a = x \mathbf i + y \mathbf j$
Let $\theta$ denote the direction of $\mathbf a$.
Then:
:<nowiki>$\theta = \begin{cases} 
\map \arctan {\dfrac y x} & : x > 0 \\
\map \arctan {\dfrac y x} + \pi & : x < 0 \text{ and } y \ge 0 \\
\map \arctan {\dfrac y x} - \pi & : x < 0 \text{ and } y < 0 \\
\dfrac \pi 2 & : x = 0 \text{ and } y > 0 \\
-\dfrac \pi 2 & : x = 0 \text{ and } y < 0 \\
\text{undefined} & : x = 0 \text { and } y = 0
\end{cases}$</nowiki>
where:
:$\arctan$ denotes the real arctangent function, defined on the real interval $\openint {-\dfrac \pi 2} {\dfrac \pi 2}$
:$\theta$ is conventionally measured from the positive direction of the $x$-axis in the interval $\hointl {-\pi} \pi$.

Proof:
Let $\mathbf a$ be such that one of the following holds:
:$\mathbf a$ is in Quadrant $\text{I}$ or Quadrant $\text{IV}$
:$\mathbf a$ is on the positive direction of the $x$-axis.
Then:
:$x > 0$
and:
:$-\dfrac \pi 2 < \theta < \dfrac \pi 2$
The components of $\mathbf a$ form the legs of a right triangle where:
{{begin-eqn}}
{{eqn | l = \tan \theta
      | r = \frac y x
      | c = {{Defof|Tangent Function|subdef = Definition from Triangle}}
}}
{{eqn | ll= \leadsto
      | l = \map \arctan {\tan \theta}
      | r = \map \arctan {\frac y x}
      | c = can take arctangent of both sides as $-\dfrac \pi 2 < \theta < \dfrac \pi 2$
}}
{{eqn | n = 1
      | ll= \leadsto
      | l = \theta
      | r = \map \arctan {\frac y x}
      | c = Composite of Bijection with Inverse is Identity Mapping
}}
{{end-eqn}}
{{qed|lemma}}
Let $\mathbf a$ be such that one of the following holds:
:$\mathbf a$ is in Quadrant $\text{II}$
:$\mathbf a$ is on the negative direction of the $x$-axis.
Then:
:$x < 0$
:$y \ge 0$
and:
:$\dfrac \pi 2 < \theta \le \pi$
{{begin-eqn}}
{{eqn | l = \tan \theta
      | r = \frac y x
      | c = {{Defof|Tangent Function|subdef = Definition from Triangle}}
}}
{{eqn | ll= \leadsto
      | l = \tan \paren {\theta - \pi}
      | r = \frac y x
      | c = Tangent Function is Periodic on Reals
}}
{{eqn | ll= \leadsto
      | l = \map \arctan {\tan \paren {\theta - \pi} }
      | r = \map \arctan {\frac y x}
      | c = $\dfrac \pi 2 < \theta \le \pi \implies -\dfrac \pi 2 < \theta - \pi \le 0$, can take arctangent of both sides as $-\dfrac \pi 2 < \theta - \pi < \dfrac \pi 2$
}}
{{eqn | ll= \leadsto
      | l = \theta - \pi
      | r = \map \arctan {\frac y x}
      | c = Composite of Bijection with Inverse is Identity Mapping
}}
{{eqn | n = 2
      | ll= \leadsto
      | l = \theta
      | r = \map \arctan {\frac y x} + \pi
      | c = Add $\pi$ on both sides
}}
{{end-eqn}}
{{qed|lemma}}
{{Proofread|I believe this is the better explanation}}
Let $\mathbf a$ be in Quadrant $\text{III}$.
Then:
:$x < 0$
:$y < 0$
and:
:$-\pi < \theta < \dfrac {-\pi} 2$
{{begin-eqn}}
{{eqn | l = \tan \theta
      | r = \frac y x
      | c = {{Defof|Tangent Function|subdef = Definition from Triangle}}
}}
{{eqn | ll= \leadsto
      | l = \tan \paren {\theta + \pi}
      | r = \frac y x
      | c = Tangent Function is Periodic on Reals
}}
{{eqn | ll= \leadsto
      | l = \map \arctan {\tan \paren {\theta + \pi} }
      | r = \map \arctan {\frac y x}
      | c = $-\pi < \theta < \dfrac {-\pi} 2 \implies 0 < \theta + \pi < \dfrac \pi 2$, can take arctangent of both sides as $-\dfrac \pi 2 < \theta + \pi < \dfrac \pi 2$
}}
{{eqn | ll= \leadsto
      | l = \theta + \pi
      | r = \map \arctan {\frac y x}
      | c = Composite of Bijection with Inverse is Identity Mapping
}}
{{eqn | n = 3
      | ll= \leadsto
      | l = \theta
      | r = \map \arctan {\frac y x} - \pi
      | c = Substract $\pi$ on both sides
}}
{{end-eqn}}
{{qed|lemma}}
{{Proofread}}
Let $\mathbf a$ be on the positive direction of the $y$-axis.
Then:
:$x = 0$
:$y > 0$
Then the arctangent of $\theta$ is undefined.
We have:
{{begin-eqn}}
{{eqn | n = 4
      | l = \theta
      | r = \frac \pi 2
      | c = 
}}
{{end-eqn}}
{{qed|lemma}}
Let $\mathbf a$ be on the negative direction of the $y$-axis.
Then:
:$x = 0$
:$y < 0$
Then the arctangent of $\theta$ is undefined.
We have:
{{begin-eqn}}
{{eqn | n = 5
      | l = \theta
      | r = -\frac \pi 2
      | c = 
}}
{{end-eqn}}
{{qed|lemma}}
Finally, let $\mathbf a$ be the zero vector.
We have:
:$x = 0$
:$y = 0$
and hence:
{{begin-eqn}}
{{eqn | n = 6
      | l = \theta
      | r = \text {undefined}
      | c = Zero Vector has no Direction
}}
{{end-eqn}}
Hence, $\theta$ can be described using the following piecewise function:
{{begin-eqn}}
{{eqn | l = \theta
      | r = <nowiki>\begin{cases}
\map \arctan {\dfrac y x} & : x > 0 \\
\map \arctan {\dfrac y x} + \pi & : x < 0 \text{ and } y \ge 0 \\
\map \arctan {\dfrac y x} - \pi & : x < 0 \text{ and } y < 0 \\
\dfrac \pi 2 & : x = 0 \text{ and } y > 0 \\
-\dfrac \pi 2 & : x = 0 \text{ and } y < 0 \\
\text{undefined} & : x = 0 \text { and } y = 0
\end{cases}</nowiki>
      | c = from $(1)$, $(2)$, $(3)$, $(4)$, $(5)$, and $(6)$ and the cases in which they apply
}}
{{end-eqn}}
Hence the result.
{{qed}}