# Uniqueness of solutions of Cauchy problem with nonzero function

Consider the initial value problem $$y'(x)=f(x,y(x)), \\ y(x_0)=y_0,$$ where the function $f \colon D \to \mathbb R$ is defined and continuous on some open set $D \subseteq \mathbb R \times \mathbb R$ and $(x_0, y_0) \in D$. Is the following statement true?

This problem cannot have two distinct solutions on some interval $[x_0, x_1]$ if $$\forall (x,y) \in D \colon f(x, y) \ne 0.$$

If $f$ does not depend on $x$, the answer seems to be positive, i.e. we have some kind of uniqueness theorem here, but my intuition tells me that it is, generally, wrong. Can you provide a counterexample?

Your intuitions are both correct. The answer to your first question is positive, see, e.g., my answer to Existence and uniqueness of solution of IVP with separation of variables. Regarding the second, consider $$y'(x) = 1 + 2 \sqrt{\max\{y(x)-x, 0\}}$$ with initial condition $y(0) = 0$. The function $1 + 2 \sqrt{\max\{y-x, 0\}}$ is continuous and positive on $\mathbb{R} \times \mathbb{R}$. Both the functions $$\varphi(x) = x, \quad x \in \mathbb{R}$$ and $$\psi(x) = \begin{cases} x & \text{ for } x \le 0 \\ x + x^2 & \text{ for } x > 0 \end{cases}$$ satisfy the IVP.