Solution (source code)

= Solution

The <great circle> containing the pointing and celestial pole is the intersection of the <unit sphere> with the meridian plane $y=0$. The <orthogonal projection> of $\mathbf s$ onto that plane, normalized to unit length, is
$$
\boldsymbol\ell=\rho^{-1}(\cos\delta\cos\Delta,0,\sin\delta)=(\cos q,0,\sin q).
$$
Within the local meridian chart $\cos\Delta>0$, its <declination> is therefore $q$. Outside that chart, the same construction gives an oriented <great circle> parameter; the foot can lie on the opposite right-ascension half of the meridian, and $q$ need not be its ordinary <declination>.

To verify the right angle geometrically, the tangent to the <great circle> from $L$ toward $S$ is proportional to $\mathbf s-(\mathbf s\cdot\boldsymbol\ell)\boldsymbol\ell$. Since $\mathbf s\cdot\boldsymbol\ell=\rho$, that tangent has only a $y$ component. The tangent from $L$ toward the pole, $\mathbf P-(\mathbf P\cdot\boldsymbol\ell)\boldsymbol\ell$, lies in $y=0$. Their <orthogonality> proves the claimed spherical right angle. Thus \b[within the local meridian chart, $q$ is the <declination> of the perpendicular foot on the pointing meridian.]

There are antipodal perpendicular feet on the complete <great circle>. On the local meridian chart, the telescope field selects the foot near the pointing; the cotangent equation alone determines $q$ only modulo $\pi$. At a coincident foot or pole, the corresponding angle is understood by continuity rather than by a nonzero tangent vector.