I need to convert Cartesian coordinates to lat/long coordinates or to be more specific: I have a point $P(\phi_1|\lambda_1)$ (lat/long), a heading $\theta$ (like compass heading, north is $0^{\circ}$) and a distance $d$ (from which you can calculate $\delta=d/r$). I found some formulae for this and their derivation here. However, I can't find (out) how the equation
\begin{equation}\tag{1} \cos(\delta) = \sin(\varphi_1)\sin(\varphi_2) + \cos(\varphi_1)\cos(\varphi_2)\cos(\Delta\lambda) \end{equation}
is built from the spherical law of cosines as the spherical law of cosines only gives
\begin{equation} \cos(a) = \cos(b)\cos(c) + \sin(b)\sin(c)\cos(A) \end{equation}
and their cyclic permutations for $\cos(b)$ and $\cos(c)$.
The spherical triangle you are interested in has a vertex at the north pole. The angular distance to the other two vertices is $90$ degrees minus their latitude, hence $\sin$ gets swapped with $\cos$.