Solutions of $\frac{1}{\cos \theta} = a \sin \theta - b$ One of my math professors and I are working on a physics problem involving spinning a chain, and we decided to go as simple as possible and work out the solution explicitly for that case (a long rod hanging from a hinge rotating in a horizontal circle). Then we could hopefully work up from there. In the end, we boiled it down to the point where we had an equation of this form:
$$\frac{1}{\cos \theta} = a \sin \theta - b$$
Depending on the values of $a$ and $b$, there are $0$, $1$, $2$, $3$, or $4$ solutions for $\theta$ in this equation. What I'm curious about is whether there are formulas in terms of $a$ and $b$ that will give these solutions. As an aside, this situation actually reminds me of quadratics - they have $0$, $1$, or $2$ solutions, the solutions are given by the quadratic formula, and the value of $b^2-4ac$ indicates how many real-valued solutions there are. I'm looking for something similar for the equation I've given above, and WolframAlpha is being no help (gasp!).

If we put $t=\tan \frac\theta2,\sin\theta =\frac{2t}{1+t^2},\cos\theta=\frac{1-t^2}{1+t^2}$
Then, 
$$ \frac1{\cos\theta}=a\sin\theta-b--->(1)$$
 becomes $$(b-1)t^4-2at^3-2t^2+2at-(b+1)=0--->(2)$$ which is  a quartic equation in $t$ hence will definitely have exactly four finite roots if $b-1\ne0$ .
$(1)$  If $b=1,$ the equation reduces to $2at^3+2t^2-2at+2=0--->(3)$
We can make use of this to identify the number of real roots of $(3)$ 
Clearly, each real root of $(3)$  will correspond to one real of root of of $(1)$ the reason being:
We know, $\tan A=\tan B\implies A=n\pi+B,$ so $\tan(\pi+\frac\theta2)=\tan\frac\theta2$  i.e., or $\tan\left(\frac{2\pi+\theta}2\right)=\tan\frac\theta2$
So, the periods  of $\cos\theta,\sin\theta(=2\pi)$ and $\tan \frac\theta2$ are same. 
Hence, in each $\in[2n\pi,2(n+1)\pi)$ there will be one-one correspondence between $\cos\theta,\tan \frac\theta2$  and  $\sin\theta,\tan \frac\theta2$ 
$(2)$ If $b\ne1,$ we can write  $$t^4-\frac{2a}{b-1}t^3-\frac2{b-1}t^2+\frac{2a}{b-1}t+\frac{b+1}{b-1}=0--->(4)$$
Now, we eliminate the $t^3$ term by putting $y=x-\lambda\implies x=y+\lambda$
$$(y+\lambda)^4-\frac{2a}{b-1}(y+\lambda)^3-\frac2{b-1}(y+\lambda)^2+\frac{2a}{b-1}(y+\lambda)+\frac{b+1}{b-1}=0--->(5)$$
The coefficient of  $y^3$ is $4\lambda-\frac{2a}{b-1}$
If we set this to $0,\lambda=\frac a{2(b-1)}\implies y=x+\frac a{2(b-1)}$
Now, we can utilize this to identify the number of real roots of $(5),$ hence of $(4)$ 
Clearly, each real root of $(4)$ i.e. of $(2)$ will correspond to one real of root $(1)$
