From projection plane to celestial coordinates

The reverse operation first computes the polar coordinates in the projection plane, and the angular distance by inverting Eq. [*]:

$\displaystyle r$ $\displaystyle =$ $\displaystyle \sqrt{x^2+y^2}$ (44)
$\displaystyle p$ $\displaystyle =$ atan2$\displaystyle (x,y) - \psi$ (45)
$\displaystyle \theta$ $\displaystyle =$ $\displaystyle 2\tan^{-1}\frac{r}{2}$ (46)

Then the spherical trigonometry relations Eqs. [*] to [*] are inverted. Eqs. [*] and [*] form a linear system in $\cos\delta\cos\Delta\alpha$ and $\sin\delta$:
$\displaystyle \cos\theta$ $\displaystyle =$ $\displaystyle \sin\delta_0\sin\delta + \cos\delta_0\cos\delta\cos\Delta\alpha$  
$\displaystyle \sin\theta \cos p$ $\displaystyle =$ $\displaystyle \cos\delta_0\sin\delta - \sin\delta_0\cos\delta\cos\Delta\alpha$  

Multiplying the first equation by $\sin\delta_0$ and the second one by $\cos\delta_0$ and adding them gives $\sin\delta$, while multiplying the first one by $\cos\delta_0$ and the second one by $\sin\delta_0$ and subtracting them gives $\cos\delta\cos\Delta\alpha$ (using $\sin^2\delta_0+\cos^2\delta_0 = 1$). Eq. [*] gives $\cos\delta\sin\Delta\alpha$ directly:
$\displaystyle \sin\delta$ $\displaystyle =$ $\displaystyle \sin\delta_0\cos\theta + \cos\delta_0\sin\theta\cos p$ (47)
$\displaystyle \cos\delta\sin\Delta\alpha$ $\displaystyle =$ $\displaystyle \sin\theta \sin p$ (48)
$\displaystyle \cos\delta\cos\Delta\alpha$ $\displaystyle =$ $\displaystyle \cos\delta_0\cos\theta - \sin\delta_0\sin\theta\cos p$ (49)

The declination is in the range $-\pi/2 \le \delta \le \pi/2$, i.e. $\cos\delta \ge 0$. As a consequence, $\delta$ is obtained from its sine with the $\sin^{-1}$ function, whose range is precisely $[-\pi/2,\pi/2]$, and the non-negative factor $\cos\delta$ common to the 2 last relations does not change the quadrant of $\Delta\alpha$ returned by the atan2 function (same argument as for $\theta$ and $p$ in section [*]):
$\displaystyle \alpha$ $\displaystyle =$ $\displaystyle \alpha_0 +$   atan2$\displaystyle (\sin\theta\sin p,
\cos\delta_0\cos\theta - \sin\delta_0\sin\theta\cos p)$ (50)
$\displaystyle \delta$ $\displaystyle =$ $\displaystyle \sin^{-1}(\sin\delta_0\cos\theta + \cos\delta_0\sin\theta\cos p)$ (51)

The right ascension is undefined at the celestial poles ( $\cos\delta =
0$), where both arguments of the atan2 function vanish.

These formulae, in both directions, are valid for any reference point, including $\delta_0 = 0$ and $\delta_0 = \pm\pi/2$: no case distinction is needed.