I'm working with this Cauchy problem:
$$\begin{cases} y'(x)=(y-2)^{2}\sin x \\ y(0)=a\\ \end{cases}$$ With $a\in\mathbb{R}$.
I have to find all the solutions as functions of $a$ and verify for which values of $a$ the solution has the domain the whole $\mathbb{R}$.
I started with separation of variables
$$\int_{y}^{a}\frac{1}{(t-2)^{2}}dt=\int_0^{x}\sin v dv$$ Obtaining: $$\frac{1}{2-a}-\frac{1}{2-y}=-\cos x+1$$ Changing the sign of both terms: $$\frac{1}{y-2}-\frac{1}{a-2}=\cos x-1$$
Ok, this should be the solution (maybe after some algebra it would be looks better).
For check the domain as funcion of $a$ I decided to rewrite the solution in this way: $$(y-2)^{-1}-(a-2)^{-1}=\cos x-1$$ And $$(y-2)^{-1}=(a-2)^{-1}+\cos x-1$$
Now, assuming I have done all right, how should I have to choose the range of values for $a$? Thank you very much :).
If $a=2$, the solution is a constant $y(x) = 2$. This has domain $\Bbb R$
If $a\ne 2$, the equation separates to
$$ \frac{dy}{(y-2)^2} = \sin x\ dx $$ $$ \frac{1}{y-2} = \cos x + C $$
where $C = \frac{1}{a-2}-1$. The general solution is
$$ y(x) = 2 + \frac{1}{\cos x - 1 + \frac{1}{a-2}} $$
In order to have a domain of $\Bbb R$, you want to exclude all possible singularities, therefore the denominator has to be strictly positive or strictly negative. You also have
$$ \frac{1}{a-2}-2 < \cos x - 1 + \frac{1}{a-2} < \frac{1}{a-2} $$
There are two cases
Strictly negative: $\frac{1}{a-2} < 0 \implies a < 2$
Strictly positive: $0< \frac{1}{a-2}-2 \implies a < 2.5$
All of the above combined gives a range of $a < 2.5$