TITLE: Why does the absolute value disappear when taking $e^{\ln|x|}$
QUESTION [8 upvotes]: I have noticed that if you have an equation (after integrating) such as
$$\ln|y| = \ln|x| + c,$$
and you further simplify it using the law of exponents, you get
$$e^{\ln|y|} = e^{\ln|x|+с},$$
which is the same as $y = cx$.
My question is why the absolute value disappears all of a sudden.
Edit: The original questions is:

Solve the separable differential equation: $(1+x)dy - ydx = 0$.
Final solution: $y = c(1+x)$.

REPLY [3 votes]: An example where this occurs is solving the differential equation $\dfrac{dy}{dx} = \dfrac{y}{x}$ which goes like this
\begin{align*}
\frac{1}{y}\frac{dy}{dx} &= \frac{1}{x}\\
\int\frac{1}{y}\frac{dy}{dx}dx &= \int\frac{1}{x}dx\\
\int\frac{1}{y}dy &= \ln|x|+c\\
\ln|y| &= \ln|x|+c\\
e^{\ln|y|} &= e^{\ln|x|+c}\\
|y| &= K|x|
\end{align*}
where $K = e^c > 0$. Note, for a fixed $x_0$ in the domain (which is a subset of $\mathbb{R}\setminus\{0\}$), we have $y = K|x_0|$ or $y = -K|x_0|$. As we are solving a differential equation, $y$ is differentiable and hence continuous. Therefore, if $y = -K|x_0|$ for some fixed $x_0$, we must have $y = -K|x|$ for all $x$ in a neighbourhood of $x_0$ (likewise if $y = K|x_0|$). 
Suppose now that the domain is connected - $\mathbb{R}\setminus\{0\}$ is not connected but $(-\infty, 0)$ and $(0, \infty)$ are, they are the connected components of $\mathbb{R}\setminus\{0\}$ (the largest connected subsets of $\mathbb{R}\setminus\{0\}$). Then we must have $y = K|x|$ or $y = -K|x|$ on the entire domain. Note, we can combine these two families of solutions into one: $y = A|x|$ where $A \in \mathbb{R}\setminus\{0\}$. However, the domain is connected if and only if it is a subset of $(-\infty, 0)$ or $(0, \infty)$. Depending on which of the two sets the domain is contained in, we either have $|x| = -x$ or $|x| = x$, so that the family of solutions can be written as $y = -Ax$ for $A \in \mathbb{R}\setminus\{0\}$ or $y = Ax$ for $A \in \mathbb{R}\setminus\{0\}$. Again, we can combine these two families of solutions into one: $y = Bx$ where $B \in \mathbb{R}\setminus\{0\}$. Note, this family gives all the solutions on any connected domain. If the domain is not connected, we have to consider potentially different solutions on each connected component. For example,
$$y = \begin{cases}
x &\ \text{if}\ x > 0\\
-x &\ \text{if}\ x<0
\end{cases}$$
is a solution to the differential equation but is not of the form $y = Bx$ for some universal constant $B$; it is however of the form $y = B(x)x$ for some locally constant function $B$.