Solving for a specific trigonometric function