Question:

The solution of \[ \frac{dy}{dx}+y=f(x), \] where \[ f(x)= \begin{cases} x, & 0\le x\\ 0, & x\ge1, \end{cases} \] with the conditions \[ y(0)=0,\qquad y(1)=e^{-1}, \] is

Show Hint

For piecewise differential equations:
• Solve the differential equation separately on each interval.
• Use the given initial condition to determine the constant in the first interval.
• Use continuity (or the given value at the junction point) to determine the constant in the next interval.
• Finally, combine the solutions into a single piecewise function.
Updated On: Jul 2, 2026
  • \[ y= \begin{cases} x-e^{-x}, & 0\le x\\ e^{-x}, & x\ge1. \end{cases} \]
  • \[ y= \begin{cases} x-1+e^{-x}, & 0\le x\\ e^{\,1-x}, & x\ge1. \end{cases} \]
  • \[ y= \begin{cases} x-1+e^{-x}, & 0\le x\\ e^{-x}, & x\ge1. \end{cases} \]
  • \[ y= \begin{cases} x+e^{-x}, & 0\le x\\ e^{-x}, & x\ge1. \end{cases} \]
Show Solution
collegedunia
Verified By Collegedunia

The Correct Option is C

Solution and Explanation

Concept: A first-order linear differential equation is of the form \[ \frac{dy}{dx}+P(x)y=Q(x). \] It is solved using the Integrating Factor (I.F.) method. The integrating factor is \[ \boxed{\text{I.F.}=e^{\int P(x)\,dx}}. \] The solution is then obtained from \[ y(\text{I.F.}) = \int Q(x)(\text{I.F.})\,dx+C. \] Since the forcing function \(f(x)\) is piecewise defined, we solve the equation separately in each interval and use the given initial and continuity conditions.

Step 1:
Solve the differential equation for \(0\le x<1\).
For this interval, \[ f(x)=x. \] Hence the equation becomes \[ \frac{dy}{dx}+y=x. \] Comparing with \[ \frac{dy}{dx}+P(x)y=Q(x), \] we have \[ P(x)=1. \] Therefore, \[ \text{I.F.}=e^{\int1\,dx}=e^x. \] Multiplying the equation by \(e^x\), \[ e^x\frac{dy}{dx}+e^xy=xe^x. \] The left-hand side becomes \[ \frac{d}{dx}\left(ye^x\right)=xe^x. \] Integrating both sides, \[ ye^x=\int xe^x\,dx+C. \] Using integration by parts, \[ \int xe^x\,dx=e^x(x-1). \] Hence, \[ ye^x=e^x(x-1)+C. \] Dividing by \(e^x\), \[ y=x-1+Ce^{-x}. \]

Step 2:
Use the initial condition \(y(0)=0\).
Substituting \(x=0\), \[ 0=-1+C. \] Therefore, \[ C=1. \] Hence, \[ \boxed{ y=x-1+e^{-x}, \qquad 0\le x<1. } \]

Step 3:
Determine the value of the solution at \(x=1\).
Substituting \(x=1\), \[ y(1)=1-1+e^{-1} =e^{-1}, \] which agrees with the given condition.

Step 4:
Solve the equation for \(x\ge1\).
For this interval, \[ f(x)=0. \] Hence, \[ \frac{dy}{dx}+y=0. \] Again, \[ \text{I.F.}=e^x. \] Multiplying throughout by \(e^x\), \[ \frac{d}{dx}(ye^x)=0. \] Integrating, \[ ye^x=C. \] Thus, \[ y=Ce^{-x}. \]

Step 5:
Use the continuity condition at \(x=1\).
Since \[ y(1)=e^{-1}, \] we get \[ Ce^{-1}=e^{-1}. \] Hence, \[ C=1. \] Therefore, \[ \boxed{ y=e^{-x}, \qquad x\ge1. } \]

Step 6:
Write the complete piecewise solution.
Combining both intervals, \[ \boxed{ y= \begin{cases} x-1+e^{-x}, & 0\le x[2mm]\\ e^{-x}, & x\ge1. \end{cases} } \] Hence, the correct option is \[ \boxed{\text{(C)}}. \]
Was this answer helpful?
0
0