Exact differential equations

1. Sep 13, 2011

mehtamonica

i have to solve the following differential equation :

dy/ dx + y = f(x) where f (x) = 2, 0 <= x < 1 and 0 if x >=1

and y (0)=0.

please explain how to solve it as it involves a discontinuous function ?

I am stuck while computing after computing the integrating factor e^x. Please suggest how to proceed beyond this.

Last edited: Sep 13, 2011
2. Sep 13, 2011

HallsofIvy

Yes, the integrating factor is $e^x$. Multiplying both side of the equation by $e^x$ you have
$$e^x\frac{dy}{dx}+ e^xy= e^xf(x)$$
$$\frac{d(e^xy)}{dx}= e^xf(x)$$
Integrate both sides to get
$$e^x y(x)= \int_0^x tf(t)dt$$
(I chose the lower limit of integration to be 0 because the integral of any function from 0 to 0 so that gives y(0)= 0.)

I suspect it is that integration that is bothering you. Take it "step by step".

For $0\le x\le 1$ f(x)= 2 so $e^xf(x)= 2e^x$ on that interval.
$\int_0^x 2e^t dt= 2(e^x- e^0)= 2(e^x- 1)$
Of course, for that, if x= 1, $2(e- 1)$

For x> 1, f(x)= 0 so $e^x f(x)= 0$. $\int_1^x 0 dx= 0$ so $\int_0^x e^xf(x)dx= 2(e- 1)$.

That is, the integral is $2(e^x-1)$ for $0\le x\le 1$ and the constant $2(e- 1)$ for $x\ge 1$.

3. Sep 14, 2011

mehtamonica

Thank a lot for this guidance, but i still have a doubt and hope that you may help me out this time as well. when f(x)=0 for x>=1 then how do we substitute x=1 in the solution obtained for 0<=x<1? please enlighten me on this