Solving a first order IVP I want to solve the following initial value problem:
$$(1+x)dy + \sqrt{y}dx =0,\,\, y(0)=1~.$$ 
I notice that the equation is separable, hence, 
$$ \int \frac{1}{\sqrt{y}} dy = - \int \frac{1}{1+x} dx $$ 
so that $$ 2\sqrt{y} = -\ln|1+x| +C $$
But the initial condition suggests that $(1+x) \gt 0$. Thus we have 
$$ 2\sqrt{y} = -\ln(1+x) +C~~~~~~(*)$$ Applying the initial condition we get $C=2$ so that the solution becomes $$ 2\sqrt{y} = -\ln(1+x) + 2 \,\,\text{or}\,\, y = ( -\frac{1}{2} \ln(1+x) +1)^2~.  $$
My question is this: From (*), one could also first find $$ y =  (-\frac{1}{2} \ln(1+x) + \frac{C}{2})^2 $$ and applying the initial condition, yields
$$ 1 = \frac{C^2}{4} \implies C = \pm 2$$
Now choosing $C=2$, we obtain $y$ as before. But choosing $C =-2$ yields a different solution. How do we know which $C$ to choose? How do we reconcile the two approaches? Which approach is better?

You have to remember that the square root of a number $y$ is a non-negative number. Hence when you take $C=-2$, $-\frac{1}{2} \ln(1+x) + \frac{C}{2}$ is negative in the neighborhood of $x=0$.
Consequently the square root of $$y(x) =  (-\frac{1}{2} \ln(1+x) -2)^2 $$ is not $\sqrt{y(x)} =  -\frac{1}{2} \ln(1+x) -2$ (which is non-positive in the neighborhood of $0$) but the opposite $$\sqrt{y(x)} = \frac{1}{2} \ln(1+x) +2$$
But then $y(x)$ is no more a solution of the original IVP.
Conclusion: the IVP has only one solution with the initial condition $y(0)=1$ which corresponds to $C=2$.
