2
$\begingroup$

This is my try.

$y(x)e^x=\int|x|e^xdx$

$=\int_x^0(-t)e^tdt+\int_0^xte^tdt$

$=2+2(x-1)e^x+c$

$y(x)=2e^{-x}+(x-1)2+ce^{-x}$.

with $y(-1)=0$ gives $c=1-\frac{3}{e}$

but later I find which is wrong. where is my mistake?

2 Answers 2

4

For $x\ge 0$ $$y' + y = x \implies y=c_1 e^{-x}+x-1$$ For $x < 0$ $$y' + y = -x \implies y=c_2e^{-x}-x+1$$
We know that $y(-1)=0$ which implies that $$0 = c_2e+2 \implies c_2=-\frac{2}{e} = -2e^{-1}$$ We now know that $|x|=|-x|$ at $x=0$ and so $$-2e^{-1}+1 = c_1 - 1 \implies c_1 = 2-2e^{-1} $$ $$\color{red}{y = \begin{cases} -2e^{-x-1}-x+1, & \text{if $x$ is negative} \\[2ex] \;\;\,(2-2e^{-1})e^{-x}+x-1 & \text{if $x$ is non-negative} \end{cases}}$$

  • 0
    even if $x$ is not differentiable at 0. $y' + y = 0$ So, $y$ is differentible there. The 2^{nd} derivative of y may not be defined.2017-02-03
  • 0
    @DougM you're right, my bad. I had the correct answer at first and doubted myself for some reason. I reverted to what I had.2017-02-03
  • 0
    I spent some time on that one, too. I had the discontinuity, and then decided that that didn't make sense. I had to think about if I was doing a numerical approximation what would happen as I crossed 0.2017-02-03
1

The homogenous equation $y' + y = 0\\ y = C_1 e^-t$

A particular solution

Suppose $y = Ax + B$

$y' = A\\ A + Ax + B = |x|\\ A = sgn x\\ B = -A$

$y = \begin{cases} C_1 e^{-t} + x - 1 & x\ge 0\\C_2 e^{-t} - x + 1 & x< 0 \end{cases}$

$y(-1) = 0$

$C_2 e + 2 = 0\\ C_2 = -2 e^{-1}$

$y(0) = $$-2e^{-1}+1 = C_1 -1\\ C_1 = -2e^{-1} + 2$

$y = \begin{cases} (-2e^{-1} + 2) e^{-t} + x - 1 & x\ge 0\\ -2e^{-t-1} - x + 1 & x< 0 \end{cases}$

$y(1) = (-2e^{-1} + 2) e^{-1} = -2e^{-2} + 2e^{-1}$