Solving Trigonometric Equations Algebraically