Trigonometric equations in quadratic form