Solve dy/dx + y = eˣ — Linear First Order ODE

medium CBSE JEE-MAIN JEE-ADVANCED JEE Main 2024 3 min read

Question

Solve the differential equation:

dydx+y=ex\frac{dy}{dx} + y = e^x

Find the general solution.


Solution — Step by Step

This is a linear first-order ODE of the form dydx+P(x)y=Q(x)\frac{dy}{dx} + P(x)\cdot y = Q(x).

Here, P(x)=1P(x) = 1 and Q(x)=exQ(x) = e^x. The moment we see this form, the integrating factor method is our go-to weapon.

The integrating factor is μ=eP(x)dx\mu = e^{\int P(x)\,dx}.

μ=e1dx=ex\mu = e^{\int 1\,dx} = e^x

We multiply both sides of the ODE by this factor. Why? Because it turns the left side into an exact derivative — specifically, ddx(μy)\frac{d}{dx}(\mu \cdot y).

Multiplying both sides by exe^x:

exdydx+exy=exex=e2xe^x\frac{dy}{dx} + e^x y = e^x \cdot e^x = e^{2x}

The left side is exactly ddx(exy)\frac{d}{dx}(e^x \cdot y). This is the whole point of the integrating factor — it makes the left side a perfect derivative.

ddx(exy)=e2x\frac{d}{dx}(e^x y) = e^{2x}

Integrating both sides with respect to xx:

exy=e2xdx=e2x2+Ce^x y = \int e^{2x}\,dx = \frac{e^{2x}}{2} + C

Don’t forget the constant of integration — in board exams and JEE both, missing CC costs you marks.

Divide throughout by exe^x:

y=e2x2ex+Cex=ex2+Cexy = \frac{e^{2x}}{2e^x} + Ce^{-x} = \frac{e^x}{2} + Ce^{-x}

General solution: y=ex2+Cexy = \dfrac{e^x}{2} + Ce^{-x}


Why This Works

The integrating factor trick is built on one key observation: if you have dydx+Py\frac{dy}{dx} + P\cdot y, this is almost the result of the product rule applied to ePdxye^{\int P\,dx} \cdot y. Multiplying by ePdxe^{\int P\,dx} completes that pattern and collapses the messy left side into a single derivative.

After that, everything reduces to plain integration. The equation goes from “ugly ODE” to “just integrate this function” — that’s why the method works every single time for linear first-order equations.

For this specific question, the right side e2xe^{2x} integrates cleanly, giving a tidy answer. In JEE problems, they usually engineer this neatness — if your integral on the right looks horrible, double-check your IF.


Alternative Method (Variation of Parameters)

We can also get the particular integral by assuming yp=kexy_p = ke^x for some constant kk.

Substituting into the ODE: kex+kex=ex2kex=exk=12ke^x + ke^x = e^x \Rightarrow 2ke^x = e^x \Rightarrow k = \frac{1}{2}.

The complementary solution is found from dydx+y=0\frac{dy}{dx} + y = 0, giving yc=Cexy_c = Ce^{-x}.

So the general solution is y=yc+yp=Cex+ex2y = y_c + y_p = Ce^{-x} + \frac{e^x}{2} — same answer, different route.

For JEE Main, the integrating factor method is faster and more reliable. Use variation of parameters only when the right side is a polynomial or trig function — for exponentials, IF gets you there in fewer steps.


Common Mistake

The classic error is computing e2xdx=e2x\int e^{2x}\,dx = e^{2x} (forgetting to divide by 2). After multiplying both sides by the IF exe^x, the right side becomes e2xe^{2x}, not exe^x. Students who rush through write e2xdx=e2x+C\int e^{2x}\,dx = e^{2x} + C and end up with y=ex2+Cexy = \frac{e^x}{2} + Ce^{-x} becoming y=ex+Cexy = e^x + Ce^{-x} — off by a factor of 2, wrong answer.

Always slow down on the integration step: eaxdx=eaxa+C\int e^{ax}\,dx = \frac{e^{ax}}{a} + C.

Want to master this topic?

Read the complete guide with more examples and exam tips.

Go to full topic guide →

Try These Next