factoring trigonometric equations