# Find the number of solutions of $|\cos(x)|=\cot(x)+\frac{1}{\sin(x)}$ that lie in $[-4\pi,4\pi]$.

I came across this problem

Find the number of solutions of $|\cos(x)|=\cot(x)+\frac{1}{\sin(x)}$ that lie in $[-4\pi,4\pi]$

in a PreCalculus book and I am looking for a simple solution.

What I can say: let $\displaystyle f(x)=|\cos(x)|$ and $\displaystyle g(x)=\cot(x)+\frac{1}{\sin(x)}$

1. The functions $f$ and $g$ are $2\pi$-periodic so it is enough to study the problem on $[0,2\pi]$.
2. The function $g$ is undefined when $x$ is a multiple of $\pi$.
3. $g(x)=\frac{1+\cos(x)}{\sin(x)}$, so $g$ has the same sign than $\sin$. Therefore, there is no solution on $(\pi,2\pi)$ and e can assume that $x\in(0,\pi)$.
4. Let $c=\cos(x)$. Then $c$ is a root of $P(c)=c^4+2c+1$ and $c\in[-1,1]$. By Descartes' Rule of Signe, $P$ has no positive root and $0$ or $2$ negative roots (counted with multiplicity). $c=-1$ is one of them and Synthetic Division gives $P(c)=(c+1)(c^3-c^2+c+1)$. Let $Q(c)=c^3-c^2+c+1$. $Q(-1)\neq 0$, so $P$ has another negative root. By the Lower Bound Rule, $c=-1$ is a lower bound for the roots of $P$ and the other root, say $a$ is in $(-1,0)$.
5. This means that the original equation has at most one solution ($x=\arccos(a)$) in $(\frac{\pi}{2},\pi)$.
6. On the other hand, $f$ is decreasing $(\frac{\pi}{2},\pi)$, $g(x)=\cot(\frac{x}{2})$, so $g$ is decreasing on $(\frac{\pi}{2},\pi)$. Since $f(\frac{\pi}{2})=0<1=g(\frac{\pi}{2})$ and $f(\pi)=1>0=\cot(\frac{\pi}{2})$, we obtain that $f(x)=g(x)$ for exactly one value in $(\frac{\pi}{2},\pi)$.

Finally, there is exactly one solution in $[0,2\pi]$, so there are $4$ solutions in the given interval.

That's quite convoluted, so I was hoping for a way to shortcut the solution. Any idea?

$\cot(x) + 1/\sin(x) = (\cos(x)+1)/\sin(x) > 1$ on the interval $(0, \pi/2)$ and $< 0$ on $(\pi/2, 2 \pi)$, so it suffices to look at $[\pi/2, \pi]$. Here $|\cos(x)| = -\cos(x)$, and multiplying by $\sin(x)$ the equation becomes $$1 + \cos(x) = - \sin(x) \cos(x) = - \sin(2x)/2$$ Since $- \sin(2x)/2$ is strictly concave while $1 + \cos(x)$ is strictly convex, there are at most two solutions on this interval. One is at $x = \pi$, but this is not a solution of the original problem because $1/\sin(x)$ is undefined there. Using the Intermediate Value Theorem there is at least one other solution on the interval (and thus exactly one), because at $x=\pi/2$ we have $1+\cos(x) > -\sin(2x)/2$ while at $x = 3 \pi/4$ the inequality is reversed. So we have one solution on $[0,2\pi]$, and by periodicity four on $[-4\pi, 4\pi]$.