If I correctly understood your question you need to find some angle "theta" or "phi" from the expression cos (phi). In order to achieve that you have to solve a trigonometric equation (simple one, by the way) where \phi (or "theta") = +- arccos \phi (or theta) + 2\pi n