Differential Equations: Numerical Problems Set (11)

medium 3 min read

Question

Solve the linear differential equation dydx+2y=ex\dfrac{dy}{dx} + 2y = e^{-x}, with y(0)=1y(0) = 1.

Solution — Step by Step

This is a linear first-order ODE of the form dydx+P(x)y=Q(x)\dfrac{dy}{dx} + P(x)y = Q(x) with P(x)=2P(x) = 2 and Q(x)=exQ(x) = e^{-x}.

IF=ePdx=e2dx=e2x\text{IF} = e^{\int P \, dx} = e^{\int 2 \, dx} = e^{2x}

e2xdydx+2e2xy=e2xex=exe^{2x}\frac{dy}{dx} + 2e^{2x}y = e^{2x} \cdot e^{-x} = e^{x}

The LHS is exactly ddx(ye2x)\dfrac{d}{dx}(y \cdot e^{2x}). So:

ddx(ye2x)=ex\frac{d}{dx}(y e^{2x}) = e^x

ye2x=exdx=ex+Cy e^{2x} = \int e^x \, dx = e^x + C

y=ex+Ce2xy = e^{-x} + C e^{-2x}

Apply y(0)=1y(0) = 1: 1=1+C    C=01 = 1 + C \implies C = 0.

Final answer: y=exy = e^{-x}.

Why This Works

The integrating factor turns the LHS into a perfect derivative of a product. After multiplying by ePdxe^{\int P \, dx}, the equation becomes (yIF)=QIF(y \cdot \text{IF})' = Q \cdot \text{IF}, which is directly integrable.

This trick works for any linear first-order ODE — find P(x)P(x), compute the IF, multiply, integrate. No guessing.

For dydx+P(x)y=Q(x)\dfrac{dy}{dx} + P(x)y = Q(x):

IF =eP(x)dx= e^{\int P(x)\,dx}

Solution: yIF=Q(x)IFdx+Cy \cdot \text{IF} = \displaystyle\int Q(x) \cdot \text{IF} \, dx + C

Alternative Method

Try y=u(x)e2xy = u(x) e^{-2x} as an ansatz (this is the form of the general solution of the homogeneous part).

Compute y=ue2x2ue2xy' = u' e^{-2x} - 2u e^{-2x}. Substitute:

ue2x2ue2x+2ue2x=exu' e^{-2x} - 2u e^{-2x} + 2u e^{-2x} = e^{-x}

ue2x=ex    u=ex    u=ex+Cu' e^{-2x} = e^{-x} \implies u' = e^x \implies u = e^x + C

So y=(ex+C)e2x=ex+Ce2xy = (e^x + C)e^{-2x} = e^{-x} + Ce^{-2x}. Same.

When Q(x)Q(x) has a simple form (like eaxe^{ax}, sin(ax)\sin(ax), polynomial), method of undetermined coefficients can be even faster than integrating factors. Practice both and pick the quickest.

Common Mistake

Students forget to multiply both sides by the integrating factor before recognising the LHS as a perfect derivative. They write ddx(ye2x)\dfrac{d}{dx}(y \cdot e^{2x}) on the LHS but leave Q(x)=exQ(x) = e^{-x} alone on the RHS. Wrong — the IF must multiply both sides.

Another classic: integrating e2xe^{2x} as e2x/2e^{2x}/2 versus 2dx=2x\int 2 \, dx = 2x versus 2dx\int 2 \, dx becoming the IF exponent. Keep them straight: the IF is ePdxe^{\int P \, dx}, not Pdx\int P \, dx itself.

Want to master this topic?

Read the complete guide with more examples and exam tips.

Go to full topic guide →

Try These Next