Question
Solve the differential equation:
dxdy+2y=e−x
with initial condition y(0)=1.
Solution — Step by Step
This is a linear first-order ODE: dxdy+P(x)y=Q(x) with P=2, Q=e−x.
μ(x)=e∫Pdx=e∫2dx=e2x
e2xdxdy+2e2xy=e2x⋅e−x=ex
Left side is dxd(e2xy).
e2xy=∫exdx=ex+C
So y=e−x+Ce−2x.
y(0)=1+C=1⇒C=0.
Final answer: y=e−x.
Why This Works
The integrating factor turns a linear ODE into something we can write as a single derivative — that’s the only trick. Once the LHS is dxd(μy), integration handles the rest.
The choice μ=e∫Pdx works because dxdμ=Pμ, which is exactly what we need to make the product rule fold the LHS into one derivative.
Alternative Method
Recognize this as a non-homogeneous linear ODE. Particular solution: try yp=Ae−x. Substituting: −Ae−x+2Ae−x=e−x⇒A=1. General solution: y=e−x+Ce−2x. Apply initial condition: C=0, so y=e−x.
For linear ODEs, the integrating factor method always works. Memorise: μ=e∫Pdx, then μy=∫μQdx+C.
Common Mistake
Forgetting to multiply Q by μ when integrating. Some students do ∫Qdx instead of ∫μQdx — gives wrong answers immediately.
Sign errors in the exponent. ∫2dx=2x, so μ=e2x, not e−2x. Always re-check the sign of P before computing μ.