Solving for angles using trigonometric functions