$$(1+x)dy-ydx=0$$
First, we write this differential equation (DE) into the standard form:
$$y'-\frac{1}{1+x}y=0$$
So this is a first order linear differential equation.
Now, let's go back to the textbook to see the Theorem of Existence and Uniqueness (TEU) for the first order DE.


Note those symbols in the textbook are $(t, x)$, rather than $(x, y)$, if we convert your DE by using the symbols in the textbook, we get:
$$x'=f(t, x)=\frac{1}{1+t}x$$
From the TEU, we can see $t=-1$ is a discontinuous point (singularity) for this DE.
Now, switch back to your notation,
$$y'=f(x, y)=\frac{1}{1+x}y$$
So $x=-1$ is a discontinuous point (singularity) for your DE. According to TEU, it can guarantee the solution to your DE at least exists on one of the following intervals
$$x\in (-\infty, -1) ~~~\text{or}~~~ x\in (-1, \infty)$$
For simple, we denote them as
$$I_L=(-\infty, -1),~~~I_R=(-1, \infty)$$
One natural question is, which interval should we choose?
$\color{red}{\text{This depends on the initial condition of the DE.}} $
For example, if the problem says: solve this DE with the initial condition $y(2)=5$. Then we can expect the solution exists at least on interval $I_R$, since $2\in I_R$ and $2\notin I_L$
Similarly, if the problem says: solve this DE with the initial condition $y(-\pi)=7$. Then we can expect the solution exists at least on interval $I_L$, since $-\pi\in I_L$ and $-\pi\notin I_R$
Now, we are ready to go back to this DE.
$$\frac{dy}{dx}=\frac{y}{1+x}\tag{*}$$
$$\frac{1}{y}\frac{dy}{dx}=\frac{1}{1+x}$$
$$\int \frac{dy}{y}=\int \frac{dx}{1+x}$$
$$\ln|y|+c_1=\ln|1+x|+c_2\tag{0}$$
The $\color{red}{\text{mistake}}$ comes from this step. Note all steps afterwards, such as your eq.(1), eq.(2) and eq.(3) are all based on this step (I label this step as eq.(0)).
As we know, before dividing some factor, we need to guarantee this factor is non-zero. Here, you divide $y$ and $x+1$, which means you assume both of them are non-zero. So at least you lose a trivial solution.
$$y=0$$
If look at the following steps:
$$|y|=|1+x|e^c\tag{1}$$
So far so good. Now, the problems will begin.
$$y=|1+x|e^c\tag{2}$$
Since $c$ is some constant, which is a real number, hence $c\neq \pm\infty$. Also, TEU requires $x\neq -1$, hence $|x+1|>0$. Therefore,
$$e^c\neq 0\cap |x+1|>0\Longrightarrow y\neq 0$$
Look at the original DE
$$y'=\frac{1}{1+x}y$$
Obviously, $y=0$ is a solution to this DE. But your expression in $(1)$ and $(2)$ did NOT contain this trivial solution. However, if we look at the original DE, $y'=\frac{1}{1+x}y$, the TEU only requires $x\neq -1$, and there is no restriction to $y$, which means $y$ could be $0$. This is why you lose a (trivial) solution $y=0$ during your derivation.
Let's go back to your eq.(0)
$$\frac{dy}{dx}=\frac{y}{1+x}\tag{*}$$
$$\frac{1}{y}\frac{dy}{dx}=\frac{1}{1+x}$$
$$\int \frac{dy}{y}=\int \frac{dx}{1+x}$$
$$\ln|y|+c_1=\ln|1+x|+c_2\tag{0}$$
As it is pointed out by TEU, before you integrate your DE, you need to specify, on what interval you are solving your DE. Surely, this depends on the initial condition.
For example, if the problem says: solve this DE with the initial condition $y(2)=5$. Then we can expect the solution exists at least on interval $(-1,\infty)$, hence $x+1>0$, then you integrate your DE as
$$\int \frac{1}y dy=\int \frac{1}{x+1}dx$$
$$\ln|y|=\ln(x+1)+c\Longrightarrow |y|=e^c(x+1)\Longrightarrow y=\pm e^c(x+1)$$
Note, there is no absolute value on $(x+1)$, because we first claimed we integrate DE on interval $(-1,\infty)$. If we re-define a constant $A$ to absorb the $\pm$ sign and $e^c$, and note $A\neq 0$. Then we get
$$\boxed{y=A(x+1),~~~~x\in (-1, \infty)}$$
Similarly, if the problem says: solve this DE with the initial condition $y(-\pi)=7$. Then we can expect the solution exists at least on interval $(-\infty, -1)$, hence $x+1<0$, then you integrate your DE as
$$\int \frac{1}y dy=\int \frac{1}{x+1}dx$$
$$\ln|y|=\ln(-x-1)+c_2\Longrightarrow |y|=e^{c_2}(-x-1)\Longrightarrow y=\pm e^{c_2}(x+1)$$
Again, there is no absolute value on $(-x-1)$, because we first claimed we integrate DE on interval $(-\infty, -1)$. If we re-define a constant $B$ to absorb the $\pm$ sign and $e^{c_2}$, and note $B\neq 0$. Then we get
$$\boxed{y=B(x+1),~~~~x\in (-\infty, -1)}$$
One thing to emphasize: there is no relationship between the constant $A$ and $B$.
Now, let's summarize:
Case. (1) The trivial case $y=0$.
Case. (2) Non-trivial case $y\neq 0$,
$$y=A(x+1),~~~~x\in (-1, \infty),~~~A\neq 0$$
$$y=B(x+1),~~~~x\in (-\infty, -1),~~~B\neq 0$$
Surely, we can combine Case.(1) and Case.(2), by allow $A$ and $B$ to take $0$, which means $A, B\in \mathbb{R}$. So we get the general solution as:
$$\boxed{y=A(x+1),~~~~x\in (-1, \infty),~~~A\in \mathbb{R}}$$
$$\boxed{y=B(x+1),~~~~x\in (-\infty, -1),~~~B\in \mathbb{R}}$$
The constant $A$ and/or $B$ is uniquely determined by initial condition.
Finally, let's verify this result by using the same exmaple as above,
For example, if the problem says: solve this DE with the initial condition $y(2)=5$. Then we can expect the solution exists at least on interval $(-1,\infty)$,
$$5=y(2)=A(1+2)\Longrightarrow A=\frac{5}3\Longrightarrow \boxed{y=\frac{5}3(1+x), ~~~x\in(-1,\infty)}$$
Similarly, if the problem says: solve this DE with the initial condition $y(-\pi)=7$. Then we can expect the solution exists at least on interval $(-\infty, -1)$,
$$7=y(-\pi)=B(1-\pi)\Longrightarrow B=\frac{7}{1-\pi}\Longrightarrow \boxed{y=\frac{7}{1-\pi}(1+x), ~~~x\in (-\infty, -1)}$$
Finally, for the trivial case, if the problem says: solve this DE with the initial condition $y(1)=0$. Then we can expect the solution exists at least on interval $(-1,\infty)$
$$0=y(1)=A(1+1)\Longrightarrow A=0\Longrightarrow \boxed{y=0, ~~~x\in(-1,\infty)}$$
$$==========\text{Last Question}=========$$
Let's go back to this example. If we know the initial condition, such as
$y(2)=5$. Then we get the solution:
$$\boxed{y=\frac{5}3(1+x),~~~ x\in(-1,\infty)}$$
then what's the solution on the other side, namely, $x\in (-\infty, -1)$?
The answer is: we don't know, since the Uniqueness theorem only guarantee the solution is uniquely determined on the side where the initial condition specified, i.e. $x\in(-1,\infty)$ in this example. We cannot guarantee on the other side. For example, you can verify all of the following solutions satisfy this DE with initial condition $y(2)=5$
$$y=\begin{cases} \frac{5}3(1+x),\ x\in(-1,\infty)\\
\\
0,~~~~~~~~~~~~~\ x\in(-\infty, -1) \end{cases}, ~~~~~y=\begin{cases} \frac{5}3(1+x),\ x\in(-1,\infty)\\
\\
-\pi(1+x),\ x\in(-\infty, -1) \end{cases}$$
Therefore, the solution is NOT unique on the other side, i.e. $x\in(-\infty, -1)$
$$|y|=\begin{cases} (1+x)e^c,\ x\geq-1\ -(1+x)e^c,\ x<-1 \end{cases}\tag{3}$$
Do we agree on this then?
– tryingtobeastoic May 08 '23 at 12:52