Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have solve this differential equation :

$$\left\{\begin{aligned}\frac{dy}{dx} + y &= f(x) \\ y (0)&=0. \end{aligned}\right.$$ where $f (x) = \begin{cases}2 & \text{if } 0 \leq x < 1 \\ 0 &\text{if }x \geq 1.\end{cases}$
Please explain how to solve as it involves discontinuous function $f$.

share|cite|improve this question
This is not an exact differential equation. You'd need to multiply it by an integrating factor to get an exact differential equation. – Robert Israel Sep 13 '11 at 20:07
The integrating factor does not involve the function on the right. It would be the same integrating factor if the equation was $\frac{dy}{dx} + y = 0$. – Robert Israel Sep 13 '11 at 20:15
@ Robert Israel: Thanks, I got the I.F as e ^x. – rupa Sep 13 '11 at 20:18
@Robert Israel : Please suggest how to proceed beyond this. – rupa Sep 13 '11 at 20:24
up vote 1 down vote accepted

Multiply by the integrating factor $e^x$ and then you can factor the LHS: $$(e^xy)'=e^xf(x).$$ Now integrate from $0$ to $x$ to get $$e^xy(x)-e^0y(0)=\int_0^xe^uf(u)du$$ but remember $y(0)=0$. Now divide by the integrating factor and you have $y(x)=e^{-x}\int_0^xe^uf(u)du$. We can evaluate this by (a) looking at $x\in[0,1)$ and then (b) looking at $x\ge1$ for a piecewised defined solution $y$ (note: in the latter case you will have to split $\int_0^x$ into $\int_0^1+\int_1^x$ to substitute for $f$).

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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