TITLE: Rigorous separation of variables.
QUESTION [11 upvotes]: Let $I \subseteq \mathbb{R}$ denote an open, non-empty subinterval of the real line. We're given functions:
$$f : I \rightarrow \mathbb{R}, \;\;g : \mathbb{R} \rightarrow \mathbb{R}.$$
Now suppose we're interested in finding the set $A$, defined below, by the method of separation of variables. Basically, this involves finding the sets $B$ and $C$ (also defined below) and then using the fact that $A = B \cup C$.

Question. What constraints on $f$ and $g$ allow us to conclude that $A = B \cup C$?

Definitions.

$A = $ the set of all differentiable functions $y : I \rightarrow \mathbb{R}$ satisfying 

$$y'(x) = f (x) g(y(x)).$$

$B = $ as above, except we demand the stronger condition:

$$\forall x \in I, g(y(x)) \neq 0\qquad \frac{y'(x)}{g(y(x))} = f(x).$$

$C = $ the set of all constant functions $y : I \rightarrow \mathbb{R}$ of the form $$y(x) = c,$$ such that $c \in \mathbb{R}$ satisfies $g(c)=0$.

REPLY [3 votes]: I have written a long Section of a Chapter on this, in my ODEs book, but it is in Greek. If you understand I can send it to you. The spirit is the following: How to make separation of variables rigorous. 
However, I wish to make a comment. There are solutions which do not belong in your sets when uniqueness is violated. For example: Let the equation
$$
y'=\lvert y\rvert^{1/2}.
$$
Then one solution of the above is
$$
\varphi(x)=\left\{\begin{array}{lll}0 & \text{if} & x\le 0, \\ x^2/4 & \text{if} & x>0.\end{array}\right.
$$
Note that that $g(\varphi(x))$ vanishes for $x\le 0$, and is positive for $x>0$.