Finding the angle between two points given their Azimuth and Elevation angles I have two points in the sky and I have their coordinates in Azimuth and Elevation angles with respect to position O. I want to find the scalar angle between the two points w.r.t. position O. Thank you so much for your help!
 A: The simplest is to convert from spherical to Cartesian coordinates and take the dot product (cosine of the angle).
https://en.wikipedia.org/wiki/Spherical_coordinate_system#Cartesian_coordinates
A: The angle may be calculated as the angle between the two unit vectors starting at position $O$ and pointing to each location in the sky. The angle between any two vectors with the same origin may be calculated using the dot product in Cartesian coordinates but since we just have unit vectors, we can simplify the math a bit.
The angle $\theta$ between any two vectors with the same origin $\vec{v}$ and $\vec{u}$ is
$$\theta_{u,v}=\cos^{-1}\left(\frac{\vec{v}\cdot\vec{u}}{\|\vec{v}\|\|\vec{u}\|}\right).$$
However, since we have unit vectors, i.e., $\|\vec{v}\| = 1$ and $\|\vec{u}\|=1$, we can simplify to
$$\theta_{u,v}=\cos^{-1}\left(\vec{v}\cdot\vec{u}\right),$$
which in Cartesian coordinates is
$$\theta_{u,v}=\cos^{-1}\left(x_vx_u+y_vy_u+z_vz_u\right).$$
To get Cartesian coordinates from the $Az$ and $El$ angles (remembering that we are using unit vectors so $r$ is 1):
$$x = \cos El \cos Az,$$
$$y = \cos El \sin Az,$$
and
$$z = \sin El.$$
Note that here $El$ is defined as the angle from the $x$-$y$ plane. Thus, if we have two points in the sky defined by ($Az_1$,$El_1$) and $Az_2$,$El_2$ relative to some location $O$, the angle between them may be calculated as
$$\theta_{u,v}=\cos^{-1}\left[ \cos El_1 \cos El_2 (\cos Az_1 \cos Az_2 + \sin Az_1 \sin Az_2) + \sin El_1 \sin El_2 \right].$$
