TITLE: finding roots of $a \sin \theta + b \cos \theta +c \sin \theta \cos \theta + d \sin^2 \theta + e \cos^2 \theta$
QUESTION [5 upvotes]: I've encountered the following function while working on a project:
$$
f(\theta) = a \sin \theta + b \cos \theta +c \sin \theta \cos \theta + d \sin^2 \theta + e \cos^2 \theta
$$
where a through e are all real non-zero numbers and $0 \leq \theta < 2 \pi$.
I know this function has at least two roots. For reasons I won't bore you with, finding the roots numerically isn't ideal for the project I'm working on.
Applying the tangent half-angle substitution described in this answer results in a fourth order polynomial, which is troublesome to find the roots of without numerical methods.
$$
0 = (e-b)t^4 + (2a-2c) t^3 - 2et^2 + (2a+2c+4d)t + (b+e)
$$
Is there a better non-numerical option for finding the roots?

REPLY [3 votes]: I don’t know whether this helps you at all, but you might consider making the substitution $y=\sin\theta$, $x=\cos\theta$, to get the equation $ay+bx+cxy+dy^2+ex^2=0$, since you’re looking for roots of $f$. The resulting curve in the plane is a conic of some shape or other, depending on the coefficients, and you want to intersect it with the circle $x^2+y^2=1$.
You thus have two conics, which intersect in four points in the complex projective plane, counting multiplicity, by Bézout’s Theorem. So the problem is, far as I can see, unavoidably quartic. Seems to me that with numerical inputs $\{a,b,c,d,e\}$ the only plausible method of finding the roots is something numerical, like Newton-Raphson. (There is a formula for the general quartic, but you Do Not want to try to use it.)
(And: I wouldn’t have gone via the tangent half-angle formulas, I would have just written $\cos\theta=\sqrt{1-\sin^2\theta\,}$ and manipulated the radicals away. You still get a quartic, likely not the same one.)

REPLY [2 votes]: Hint
A)
$$
ex^2  + dy^2  + 2\left( {\frac{c}{2}} \right)xy + bx + ay = f(x,y) = 0
$$
is a conic passing through the origin.
B)
$$
\left\{ \begin{array}{l}
 x = \cos \theta  \\ 
 y = \sin \theta  \\ 
 \end{array} \right.\quad  \Rightarrow \quad x^2  + y^2  = 1
$$
is a circle of unit radius with center at the origin
C)
the zeros of your function
$$
f(\theta) = 0 $$
correspond to the crossing of the conic with the circle, which may consist
of none, two ("most probably"), or four points.