# How to resolve this equation to another value?

Sorry guys, I don't know how to be more specific in the question without writing a way too long question...

Anyway my problem:

I have this formula to calculate the distance between two points on the earth. $$d=\operatorname{arcos}\left(\sin\theta_1\ \sin\theta_2+\cos\theta_1\ \cos\theta_2\ \cos(\phi_2-\phi_1)\right)$$

Now I need to calculate $\phi_2$.

I tried to change the formula myself but I failed to do it right. Now I am asking you guys to help me. It would be nice if someone could show me how he resolves it.

You have a formula of the form $$d=\operatorname{arcos}\left(\sin\theta_1\ \sin\theta_2+\cos\theta_1\ \cos\theta_2\ \cos(\phi_2-\phi_1)\right)$$ Now recall that $\operatorname{arcos}(x)$ is the inverse function of $\cos(\theta)$; therefore applying $\cos$ to both sides of the equation gives you the formula from the question I linked $$\cos d=\sin\theta_1\ \sin\theta_2+\cos\theta_1\ \cos\theta_2\ \cos(\phi_2-\phi_1)$$ But you actually want to know $\phi_2$ so we start by taking $\cos(\phi_2-\phi_1)$ to one side of the equality and leaving the rest on the other side $$\cos(\phi_2-\phi_1)=\frac{\cos d-\sin\theta_1\ \sin\theta_2}{\cos\theta_1\ \cos\theta_2}$$ Finally, we apply $\operatorname{arcos}$ to both sides of the equation and add $\phi_1$ \begin{align} \phi_2-\phi_1&=\operatorname{arcos}\left(\frac{\cos d-\sin\theta_1\ \sin\theta_2}{\cos\theta_1\ \cos\theta_2}\right)\\ \phi_2&=\operatorname{arcos}\left(\frac{\cos d-\sin\theta_1\ \sin\theta_2}{\cos\theta_1\ \cos\theta_2}\right)+\phi_1\\ \end{align}