Simplifying and solving trigonometric equations