Finding angle using trigonometric equation