Let $y$ be the solution of

$$y'+y=|x|, x \in \mathbb R , y(-1)=0$$

Then $y(1)$ is equal to

1) $\frac{2}{e}-\frac{2}{e^2}$

2) $\frac{2}{e}- {2}e^2$

3) $2-\frac{2}{e^2}$

4) $2-2e$

Now i solve it by method $\frac{dy}{dx}+Py=Q$ by finding Integrating factor

$e^x$ and then solution is given by $ye^x=\int e^x|x|dx$+c

Now further since x is in $\mathbb R$ so i make two separate cases one when $x\gt 0$ and other for $x\lt 0$, but the problem is now for $x\gt 0$ i am unable to find out the constant value. Is this correct way to deal this problem?

  • 2
    $\begingroup$ You can make your life easier by using a definite integral to write down the value of the solution at 1. You can then split this definite integral as required. $\endgroup$ – Ian Mar 10 '16 at 3:31
  • 1
    $\begingroup$ Which constant value? Since $y(-1)=0$, one has, for every $x$, $$e^xy(x)=\int_{-1}^x|t|\,e^t\,dt.$$ In particular, $$ey(1)=\int_{-1}^1|t|\,e^t\,dt=\int_0^1t\,(e^t+e^{-t})\,dt=\ldots$$ $\endgroup$ – Did Mar 10 '16 at 7:04
  • $\begingroup$ Thanks. This thing i don't know but now i got it. $\endgroup$ – kapil Mar 10 '16 at 9:45


Let $r(x)=\exp\left[\int1\space\text{d}x\right]=e^x$.

Multiply both sides by $r(x)$:


Substitute $e^x=\frac{\text{d}}{\text{d}x}\left(e^x\right)$:

$$e^xy'(x)+\frac{\text{d}}{\text{d}x}\left(e^x\right)\cdot y(x)=e^x|x|\Longleftrightarrow$$

Apply the reverse product rule to the left-hand side:

$$\frac{\text{d}}{\text{d}x}\left(e^xy(x)\right)=e^x|x|\Longleftrightarrow$$ $$\int\frac{\text{d}}{\text{d}x}\left(e^xy(x)\right)\space\text{d}x=\int e^x|x|\space\text{d}x\Longleftrightarrow$$ $$e^xy(x)=\int e^x|x|\space\text{d}x\Longleftrightarrow$$

When $x\in\mathbb{R}$:

$$e^xy(x)=\left(e^x(x-1)+1\right)\text{sgn}(x)+1+\text{C}\Longleftrightarrow$$ $$y(x)=\frac{\left(e^x(x-1)+1\right)\text{sgn}(x)+1+\text{C}}{e^x}$$

Now, when $y(-1)=0$, we can solve $\text{C}$:

$$0=\frac{\left(e^{-1}((-1)-1)+1\right)\text{sgn}(-1)+1+\text{C}}{e^{-1}}\Longleftrightarrow$$ $$0=\frac{\left(e^{-1}(-2)+1\right)\left(-1\right)+1+\text{C}}{e^{-1}}\Longleftrightarrow$$ $$0=\frac{\left(1-\frac{2}{e}\right)\left(-1\right)+1+\text{C}}{e^{-1}}\Longleftrightarrow$$ $$0=\frac{\frac{2}{e}+\text{C}}{e^{-1}}\Longleftrightarrow$$ $$0=2+e\text{C}\Longleftrightarrow$$ $$-2=e\text{C}\Longleftrightarrow$$ $$\text{C}=-\frac{2}{e}$$



And now we can find $y(1)$:



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.