Solve y'cos(y)=f(x) I am looking for the solutions $x \mapsto y(x)$ of the following ODE:
$$y' \cos(y)=f(x)$$
for some nice positive $f$ defined on $\mathbb{R}$ (say an explicit polynomial if you want).
Since the left-handside is the derivative of $\sin(y)$, I obviously get
$$\sin(y(x))= F(x)-C$$
where $F$ is a primitive of $f$. Actually, the interval $I$ on which this formula holds may depend on $C$ but my question is the following: if I want to derive an explicit formula for $y$, I use the inverse $\arcsin$ and I get for every $x \in I$
$$y(x)=\arcsin(F(x)-C)+2k_x \pi$$
OR
$$y(x)=\pi-\arcsin(F(x)-C)+2k_x \pi$$
for some $k_x \in \mathbb{Z}$.
If one imagines that $k$ must be constant on the interval, then I get some solutions of the ODE, thanks to the previous formulas. But how can I prove that I have all the solutions ?
In some sense, $x \mapsto k_x$ may not be continuous at some points...
 A: If $x_0$ is a real number, $I$ an interval containing $x_0$ on which $y' \cos y = f(x)$ holds, then, following your calculations, we have :
$$\forall x \in I, \sin y(x) -\sin y(x_0) = F(x) - F(x_0)$$
so we indeed have :
$$y(x) = \left\{\begin{array}{rll}
{\scriptstyle (a)}& \arcsin \big(\sin y(x_0) +F(x)-F(x_0)\big)+ 2\pi k_x &\text{if} \cos(y(x))\geq 0\\
\text{or}~~~\\
{\scriptstyle (b)}& \pi - \arcsin \big(\sin y(x_0) +F(x)-F(x_0)\big)+ 2\pi k'_x& \text{if }\cos(y(x)) <0
\end{array}\right.$$
We must therefore have :
$$\forall x\in I, -1 \leq \sin y(x_0) +F(x)-F(x_0)\leq 1 \qquad (*)$$

*

*When $-1 < \sin y(x_0) +F(x)-F(x_0)<1$, then $\cos y(x) \neq 0$, so the solution cannot switch from $(a)$ to $(b)$ and $k_x$ is locally constant.


*If $ \sin y(x_0) +F(x_1)-F(x_0)  = \pm 1$ at some point in the interior of $I$, then we must have $F'(x_1) = 0$. Therefore, both solutions $(a)$ and $(b)$ have $y'(x_1) = 0$. At this point, the solution can switch from one to the other (with $k$ and $k'$ being fixed by continuity).


*The end of the maximal domain of a solution is reached if $\sin y(x_0) +F(x_1)-F(x_0) = \pm 1$ with $F'(x_1) \neq 0$ (so that $(*)$ cannot hold on both sides of $x_1$).
