MethodMath
IM
May 15, 2026

How to solve a first-order linear ODE using an integrating factor?

I'm studying differential equations and I keep making mistakes when using the integrating factor method.

For a first-order linear ODE of the form:

dydx+P(x)y=Q(x)\frac{dy}{dx} + P(x)y = Q(x)

The standard approach is to multiply both sides by the integrating factor μ(x)=eP(x)dx\mu(x) = e^{\int P(x) \, dx}.

But why does this work? And what is the systematic procedure for a problem like:

dydx+2xy=x,y(0)=1\frac{dy}{dx} + 2xy = x, \quad y(0) = 1

1 answers183 views
Loading comments...

1 Answer

DN
Dr. Nour HassanMay 16, 2026 Accepted
Here is the complete solution with explanation of why the method works. **Why the Integrating Factor Works:** The left side $y' + P(x)y$ looks almost like the derivative of a product. If we multiply by $\mu(x) = e^{\int P \, dx}$, notice that: $$\frac{d\mu}{dx} = \mu \cdot P$$ Therefore: $$\frac{d}{dx}(\mu y) = \mu y' + \mu' y = \mu y' + \mu P y = \mu(y' + Py) = \mu Q$$ The ODE becomes $\frac{d}{dx}(\mu y) = \mu Q$, which integrates directly. **Systematic Procedure for $y' + 2xy = x$, $y(0) = 1$:** **Step 1:** Identify $P(x) = 2x$ and $Q(x) = x$. **Step 2:** Compute the integrating factor: $$\mu(x) = e^{\int 2x \, dx} = e^{x^2}$$ **Step 3:** Multiply both sides: $$e^{x^2} y' + 2x e^{x^2} y = x e^{x^2}$$ $$\frac{d}{dx}\left(e^{x^2} y\ ight) = x e^{x^2}$$ **Step 4:** Integrate both sides: $$e^{x^2} y = \int x e^{x^2} \, dx$$ Substitute $u = x^2$, $du = 2x \, dx$: $$\int x e^{x^2} \, dx = \frac12 \int e^u \, du = \frac12 e^{x^2} + C$$ So: $$e^{x^2} y = \frac12 e^{x^2} + C \quad \Rightarrow \quad y = \frac12 + Ce^{-x^2}$$ **Step 5:** Apply initial condition $y(0) = 1$: $$1 = \frac12 + C \quad \Rightarrow \quad C = \frac12$$ **Final solution:** $$\boxed{y(x) = \frac12\left(1 + e^{-x^2}\ ight)}$$
Loading comments...
Login or Register to post an answer