I have three related questions (labeled Q1, Q2, and Q3 below):
Exercise A. At $x=0$, $y=2$. Also, $\frac{\mathrm{d}y}{\mathrm{d}x}=y\left(1-y\right)$. Find $y$ in terms of $x$.
Attempt I
Rearrange: $\frac{\mathrm{d}x}{\mathrm{d}y}=\frac{1}{y\left(1-y\right)}$
Integrate: $x=\int\frac{1}{y\left(1-y\right)}\mathrm{d}y=\int\frac{1}{y}+\frac{1}{1-y}\mathrm{d}y=\ln\left|y\right|-\ln\left|1-y\right|+C_{1}=\ln\left|\frac{y}{1-y}\right|+C_{1}$
Rearrange: $\ln\left|\frac{y}{1-y}\right|=x-C_{1}$ or $\left|\frac{y}{1-y}\right|=\mathrm{e}^{x-C_{1}}\overset{1}{=}C_{2}\mathrm{e}^{x}$ (set $C_{2}=\mathrm{e}^{-C_{1}}$).
Given $\left(x,y\right)=\left(0,2\right)$, $C_{2}=2$. Now $\left|\frac{y}{1-y}\right|=2e^{x}$.
- If $0\leq y<1$, then $\left|\frac{y}{1-y}\right|=\frac{y}{1-y}=2\mathrm{e}^{x}$ or $\frac{1-y}{y}=\frac{1}{2\mathrm{e}^{x}}$ or $\frac{1}{y}=\frac{1+2\mathrm{e}^{x}}{2\mathrm{e}^{x}}$ or $y\overset{2}{=}\frac{2\mathrm{e}^{x}}{1+2\mathrm{e}^{x}}$. But $\left(x,y\right)=\left(0,2\right)$ does not satisfy $\overset{2}{=}$. And so,
Q1: Here we can simply discard $\overset{2}{=}$? (It's true that $\left(x,y\right)=\left(0,2\right)$ does not satisfy $\overset{2}{=}$, but how do I know that $\overset{2}{=}$ is now completely irrelevant to my answer?)
- If instead $y<0$ or $y>1$, then $\left|\frac{y}{1-y}\right|=\frac{y}{y-1}=2\mathrm{e}^{x}$ or $\frac{y-1}{y}=\frac{1}{2\mathrm{e}^{x}}$ or $\frac{-1}{y}=\frac{1-2\mathrm{e}^{x}}{2\mathrm{e}^{x}}$ or $y\overset{3}{=}\frac{2\mathrm{e}^{x}}{2\mathrm{e}^{x}-1}$. We verify that $\left(x,y\right)=\left(0,2\right)$ satisfies $\overset{3}{=}$. And so,
Q2: Here we may conclude $\overset{3}{=}$ is our answer? (Again, related to Q1, how do I know that $\overset{2}{=}$ is completely irrelevant?)
Attempt II
Rewrite $\overset{1}{=}$ as $\frac{y}{1-y}\overset{4}{=}\pm C_{2}\mathrm{e}^{x}=C_{3}\mathrm{e}^{x}$ (set $C_{3}\overset{5}{=}\pm C_{2}$). Given $\left(x,y\right)=\left(0,2\right)$, $C_{3}=-2$. So, $\frac{y}{1-y}=-2\mathrm{e}^{x}$ or $y\overset{3}{=}\frac{2\mathrm{e}^{x}}{2\mathrm{e}^{x}-1}$. So, same as Attempt 1, we conclude $\overset{3}{=}$ is our answer. This seems to work, but
Q3: Is the procedure given in $\overset{4}{=}$ and $\overset{5}{=}$ legitimate? How is it that we seem to be able to get rid of the $\pm$ simply by making a substitution?
Consider Example B: Say instead I'm given the equation $q^{2}=p+1$ and that at $p=0$, $q=1$. I take square roots: $q=\pm\sqrt{p+1}$. Now similarly, can I legitimately write $q=C\sqrt{p+1}$ (where I've set $C=\pm1$)? Given $\left(p,q\right)=\left(0,1\right)$, $C=1$ and so I conclude $q=\sqrt{p+1}$? This doesn't seem legit to me. (Is there maybe some difference between Example B and Exercise A?)
Related: Question regarding usage of absolute value within natural log in solution of differential equation Removing absolute value signs when solving differential equations and constant solutions