# Question regarding usage of absolute value within natural log in solution of differential equation

The problem from the book.

$\dfrac{\mathrm{d}y}{\mathrm{d}x} = 6 -y$

I understand the solution till this part.

$\ln \vert 6 - y \vert = x + C$

The solution in the book is $6 - Ce^{-x}$

My issue this that this solution, from the book, doesn't seem to resolve the issue of the abs value of $\vert 6 - y\vert$

• I always thought that the abs in this kind of context are "niceties", to ensure that the value isn't negative, and there is no need to pay too much attention to them... Commented Feb 23, 2013 at 2:01
• @Valtteri Not trying to sound rude but I don't want "niceties" I need pure mathematical reasoning otherwise, I doubt myself.
– yiyi
Commented Feb 23, 2013 at 2:02
• The absolute value is necessary. But forgetting about it will not cause grief, as long as we make a compensating mistake. Go from $\log(6-y)=x+C$ to $6-y=Ce^x$ and then forget that $e^D$ is by nature positive. Actually, we do this kind of cheating all the time, since $y=6$ is a solution but $e^D$ cannot be $0$. Furthermore, we really should not use the same constant on both sides of $6$. In a problem with an initial condition, this issue doesn't come up. Commented Feb 23, 2013 at 3:15

You should have, as your general solution, $$-\ln|6-y|=x+C\ \quad\iff\quad |6-y|=e^C e^{-x} .$$

If $y-6>0$, you have the solution $$y-6= e^Ce^{-x}\ \quad\iff\quad y=6+ e^Ce^{-x} .$$

If $y-6<0$, you have the solution $$6-y= e^Ce^{-x}\ \quad\iff\quad y=6- e^Ce^{-x} .$$

In either case, the solution can be written as $y=6- Ce^{-x}$, for some constant $C$ (different from the $C$ above).

• the $\ln|6-y|=e^C e^{-x}$ I don't understand.
– yiyi
Commented Feb 23, 2013 at 2:10
• It's worth noting that even this fails to capture the constant solution $y=6 - 0e^{-x}$, which might be said to crudely represent $C=\infty$. Commented Feb 23, 2013 at 2:13
• @ErickWong Good point. To do the separation step properly at the very beginning $y=6$ is set aside and one assumes $y\ne 6$. Commented Feb 23, 2013 at 2:19
• @ErickWong Good point. The integration method used is valid only on intervals not containing $y=6$. $y=6$ is a solution and of the form given at the end ($y=6- Ce^{-x}$). Commented Feb 23, 2013 at 2:19
• @MateenUlhaq There's a few different uses of $C$ in the answer (which is pretty normal usage). The $C$ I was referring to was the very first one: if $y=6$ then $-\ln|6-y|$ could loosely be said to be $\infty$. Commented Aug 10, 2015 at 8:42
1. Here's a clearer solution: \begin{align} &\dfrac{\mathrm{d}y}{\mathrm{d}x} = 6 -y \\ \frac1{6-y}\dfrac{\mathrm{d}y}{\mathrm{d}x} &= 1 \ \ \ \ \ \ \ \ \text{or}\ \ \ \ \ \ \ \ y=\bbox[pink]{6} \\ \int\frac{\mathrm{d}y}{6-y} &= \int1{\mathrm{d}x} \\ -\ln \lvert 6-y\rvert &= x +D \\ \lvert 6-y\rvert &= e^{-x-D} \\ 6-y= e^{-x-D}\ \ \ &\text{or}\ \ \ y-6= e^{-x-D}\\ y&=\bbox[pink]{6\pm e^{-D}e^{-x}}. \end{align} Observe that $$\pm e^{-D}$$ is a nonzero arbitrary constant.
Combining the two sub-answers (in pink) gives the general solution $$\bbox[yellow]{y=6+Ce^{-x}}$$.

2. Alternatively, this solution avoids dealing with the modulus function, and is more compact to boot: \begin{align} \dfrac{\mathrm{d}y}{\mathrm{d}x} &= 6 -y\\ \dfrac{\mathrm{d}y}{\mathrm{d}x} +y &= 6\\ \dfrac{\mathrm{d}y}{\mathrm{d}x}e^x +ye^x &= 6e^x \\ \dfrac{\mathrm{d}}{\mathrm{d}x} (ye^x) &= 6e^x\\ ye^x &= \int6e^x{\mathrm{d}x}\\ &=6e^x+C\\ \bbox[yellow]{y}&\bbox[yellow]{=6+Ce^{-x}}. \end{align}

$$\dot{y}(x)=6-y(x)$$ $$\frac{\dot{y}(x)}{6-y(x)}=1$$ $$\int{\frac{\dot{y}(x)}{6-y(x)}}dx=\int{1}dx$$ $$-\ln{|6-y(x)|}=x+c$$ $$y(x)=6-e^{-x-c}.$$

• There should be $||$ around the $6-y(x)$, to keep with the idea... Commented Feb 23, 2013 at 2:11
• Where are the differential to the intergrals?
– yiyi
Commented Feb 23, 2013 at 2:11
• Wrong differential, should it be $\mathrm{d}y$ not $\mathrm{d}x$ otherwise the intergral would equal $\frac{\dot{y}(x)}{6-y(x)}x +C$