TITLE: How to find the zeros of this function?
QUESTION [9 upvotes]: There is a function, called $f(x)$, where:
$$ f(x) = 2(x-a) + 2\cos x (\sin x - b) $$
$a$ and $b$ are constants. I would like to find all the possible values of $x$ where $ f(x) = 0 $

I've tried to solve it this way:
First I simplified the equation:
$$ 2x - 2a + 2\cos x\sin x - 2b\cos x = 0 $$
Then I replaced the $2\cos x\sin x$ to $\sin 2x$, and moved it to the other side:
$$ 2a - 2x + 2b\cos x = \sin 2x$$
After that I used the arcsine function:
$$ x_1 = \frac{1}{2} \arcsin(2a - 2x + 2b\cos x) + 2n\pi$$
$$ x_2 = \pi - \frac{1}{2} \arcsin(2a - 2x + 2b\cos x) + 2n\pi$$
I don't know how to continue it. It is probably a dead end. Could you please give me hints about how should I solve it?
I would like to express $x$ without using $x$.

REPLY [6 votes]: This is not an answer (as it does not really solve the stated question), but perhaps the different viewpoint is useful to someone.
The original equation
$$ 2 (x - a) + 2 \cos(x)(\sin(x) - b) = 0$$
can also be simplified to
$$ x = a + b \cos(x) - \cos(x) \sin(x)$$
and since $\cos(x) \sin(x) = \sin(2 x)/2$, to
$$ x = a + b \cos(x) - 1/2 \sin(2x)$$
or
$$ x - a = b \cos(x) - 1/2 \sin(2x) \tag{1}\label{1}$$
This also means that the range of possible solutions are well limited,
$$ a - \lvert b \rvert - 1/2 \; \le \; x \; \le a + \lvert b \rvert + 1/2 $$
i.e. to a $2 \lvert b \rvert + 1$ -sized range around $a$:
$$ \lvert x - a \rvert \; \le \; \lvert b \rvert + 1/2 $$
Note that the left side of equation $\eqref{1}$ is a straight line with slope $1$ ($y = x - a$). The right side is a $2 \pi$-periodic function with amplitude $\lvert b \rvert+1/2$ (unless $b = 0$, in which case the right side is a $\pi$-periodic sine wave with amplitude $1/2$). The solutions are their intersections. When finding numerical solutions for the general case (i.e., $a$ and $b$ are given numerically), this approach yields very good starting points intuitively, so that simple iterative methods can be used to find all solutions rapidly.