# How to get rid of the absolute value function when solving an ODE?

Problem: $y'+yx=0, \quad y(0)=-1$

We separate it:

$\frac{dy}{dx}=-yx \Rightarrow \int\frac{-1}{y}dy=\int x dx = \frac{1}{2}x^2 + C_1$

With $\int\frac{-1}{y}dy=\log(\frac{1}{|y|})+C_2$

we get

$\log(\frac{1}{|y|})=\frac{1}{2}x^2 + C$

We solve for $y$:

$|y|=e^{-\frac{1}{2}x^2}\cdot e^C=e^{-\frac{1}{2}x^2}\cdot \hat{C}$

Now, what is the best argumentation to get "rid" of $|\cdot |$?

Like I know that e.g. $|a|=b \Leftrightarrow a=\pm b$ but then I still have $\pm$. I "know" that some wil ltell me that I can "put it into $C$" but that not really an arugmentation. Maybe I just don't get how $C$ can determine if we have the positive or negative solution or why we can't have both at the same time. It just feels like I lack proper understanding to properly argument here.

• $e^{z} > 0$ if $z$ is real. – Andy Walls Jun 26 '18 at 9:09
• Just to point out why we can't have both at the same time: it violates the uniqueness principle for IVP of the form $y'=f(x,y)$ where $f$ and $f_y$ are both continuous. For a similar reason, a solution must exist. So, at some point you will have to "choose" whether $y$ is the positive or negative solution. – AlexanderJ93 Jun 26 '18 at 13:16

## 2 Answers

$$|y|=e^{-\frac{1}{2}x^2}\cdot e^C \implies y(x)=\pm e^Ce^{-x^2/2}$$ Well you can substitute $k= \pm e^C$ so that $$y(x)=ke^{-x^2/2}$$ With integrating factor that problem of the absolute value doesn't arise $$y'+yx=0, \quad y(0)=-1$$ $$\implies (ye^{x^2/2})'=0 \implies ye^{x^2/2}=C$$ $$y(x)=Ce^{-x^2/2}$$

• Yeah I guessed that this does come up, but let me quickly rephrase my thoughs: We have $y(x)=\pm e^C\cdot e^{\frac{-x^2}{2}}$ We use the starting condition and get: $y(0)=\pm e^C\overset{!}{=}-1$ so we get $C=0$ and (this is the important part to my question), we also chose the negative solution. So we get $y(x)=-e^{\frac{-x^2}{2}}$. The part about "we choose the negative solution", can I say that? – xotix Jun 26 '18 at 12:34
• its $k= \pm e^C$ then $y(0)=ke^0=k \implies k=-1$ @xotix – Aryadeva Jun 26 '18 at 12:37
• $e^C$ is always positive so with the $\pm$ we get the negative and positive solution otherwise we ony have the positive solution since $e^c>0$ – Aryadeva Jun 26 '18 at 12:38

In transforming the solution equation to $$ye^{\frac12x^2}=\pm e^C,$$ where the sign is possibly dependent on $x$, there is on the left side a continuous function, on the right a function that takes only two distinct values. There can only be equality of both sides if the common object is a constant function, $ye^{\frac12x^2}=A$ where the constant is one of $A=\pm e^C$. Inserting the condition at $x=0$ we can also write $$y(x)=y(0)e^{-\frac12x^2}$$

Another way to see this is to remark that $y=0$ is a solution, and by the uniqueness theorem no other solution can have the value zero, cross the $y=0$ axis, thus any other solution has a constant sign.

For a short interval around the initial point the function must have the same sign as the initial value by continuity.