Why does the absolute value disappear when taking $e^{\ln|x|}$

Solution 1:

You're getting confused because you're using $c$ for three different purposes, but thinking they're all the same.

The equation $$ e^{\ln |y|} = e^{\ln |x| + c}$$ does not simplify to $cx$ or even $c|x|$ on the right hand side: it simplifies to $$ |y| = e^c |x| $$ We could, however, introduce a new constant $c_2 := e^c$, so that we can write $$ |y| = c_2 |x| $$

Now, we can use the laws of absolute values to break apart this equation:

$$ \begin{cases} y = c_2 x & x \geq 0, y \geq 0 \\ y = -c_2 x & x \leq 0, y \geq 0 \\ -y = c_2 x & x \geq 0, y \leq 0 \\ -y = -c_2 x & x \leq 0, y \leq 0 \end{cases} $$

This simplifies to

$$ \begin{cases} y = c_2 x & x \geq 0, y \geq 0 \text{ or } x \leq 0, y \leq 0 \\ y = -c_2 x & x \leq 0, y \geq 0 \text{ or } x \geq 0, y \leq 0\end{cases} $$

If we want $y$ to be expressed as a continuous function of $x$, there are four ways to define $y = f(x)$ so that this is true:

$$ f(x) = c_2 x $$ $$ f(x) = -c_2 x $$ $$ f(x) = c_2 |x| $$ $$ f(x) = -c_2 |x| $$

If you require $f$ to be differentiable, then only the first two are possible.

So you set $c_3 := c_2$ or $c_3 := -c_2$ as appropriate. Then the solution reduces to

$$ y = c_3 x $$

(note that because the set of possible values for $c_1$ ranges over all real numbers, the set of possible values for $c_3$ ranges over all nonzero real numbers)

Solution 2:

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$.