<s>[INST] Solve $y'+y=|x|, y(-1)=0$. Find y(1)=? 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?
 [/INST] 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}$
</s>