Solving for x in trigonometric equations