# Solution of $y'+y=|x|$, $x \in \mathbb R$.

Let $y$ be the solution of $y'+y=|x|$, $x\in\mathbb R$, $y(-1)=0$. Then prove that $y(1)$ is equal to $\frac{2}{e}-\frac{2}{e^2}$. I solved this differential equation for negative $x$ and for positive $x$ separately. After that I am not getting what to do. Somebody kindly help me. Thanks a lot.

• Did you try With laplace! – Nosrati Jan 22 '17 at 12:54
• Why don't you tell us the solution(s). – Henrik Jan 22 '17 at 13:03

First assume that $x\geq 0$. Then solution of the equation is given by $$y(x)=x-1+ce^{-x}$$ Next assume that $x<0$. In this case the solution is given by $$y(x)=-x+1+ce^{-x}$$ Applying the condition $y(-1)=0$, we obtain $c=-2/e$. Since the solution is continuous at $x=0$ we obtain $-1+c=1+\frac{-2}{e}$. Thus $c=2-2/e$. Hence when $x\geq 0$, the solution of the equation becomes $$y(x)=x-1+(2-2/e)e^{-x}$$ Thus $$y(1)=(2-2/e)e^{-1}=2/e-2/e^2$$