First-Order Linear Differential Equations

Solve first-order linear ODEs using the integrating factor method, with a worked example and final formula.

  • University Physics Year 1
On this page

A first-order linear ODE is one that can be written in the standard form

dy/dx + P(x) y = Q(x).

In undergraduate physics, “linear” is the default model when the response is proportional to the cause (small signals, ideal components, weak damping). It shows up as:

  • Exponential relaxation: y' = -(1/τ)(y-y_∞)
  • RC circuits: q' + (1/RC)q = E/R
  • Linear drag: v' + (k/m)v = g
Why physics needs this (examples you can click)
Common alternate form (and the sign)

Some notes write the equation as y' = p(x) y + q(x).
To use the integrating factor, rewrite it as

y'-p(x) y = q(x)

so in the standard form you have P(x) = -p(x) and Q(x) = q(x).


Integrating factor method

Template (what to do every time)
  1. Rewrite as y' + P(x) y = Q(x).
  2. Compute μ(x) = e^(∫ P(x) dx).
  3. Multiply the equation by μ so the left side becomes (μ y)'.
  4. Integrate, then apply the initial condition to find C.
  1. Identify P(x) and Q(x) in

    y' + P(x) y = Q(x).
  2. Compute the integrating factor

    μ(x) = e^(∫ P(x) dx).
  3. Multiply the whole equation by μ(x). The left-hand side becomes a product derivative:

    (d/dx)(μ y) = μ Q.
  4. Integrate and solve for y:

    μ y = ∫ μ Q dx + C ⇒ y = (1/μ(x))(∫ μ(x) Q(x) dx + C).
Pitfalls that cause most lost marks
  • Wrong sign in P(x): always rewrite into y' + P(x)y = Q(x) first.
  • Forgetting the constant of integration: it belongs after you integrate (μ y)'.
  • Dropping absolute values: ∫ (1/x)dx = ln |x| + C (use this when P(x) = 1/x, etc.).

Worked example

Solve

y' + 2y = e^(-x), y(0) = 0.

Here P(x) = 2 and Q(x) = e^(-x), so

μ(x) = e^(∫ 2 dx) = e^2x.

Multiply through:

(d/dx)(e^2xy) = e^2xe^(-x) = e^x.

Integrate:

e^2xy = ∫ e^x dx + C = e^x + C.

So

y = e^(-x) + Ce^(-2x).

Apply y(0) = 0:

0 = 1 + C ⇒ C = -1,

giving

y = e^(-x)-e^(-2x).

Worked example (physics): RC charging as a linear ODE

For an RC series circuit with source E, resistor R, capacitor C, Kirchhoff’s loop rule gives

E-iR-q/C = 0, i = dq/dt.

So:

Rdq/dt + q/C = E ⇒ dq/dt + (1/RC)q = E/R.

This is linear with P(t) = 1/RC and Q(t) = E/R.

Integrating factor:

μ(t) = e^(∫ (1/RC) dt) = e^(t/RC).

Multiply through:

(d/dt)(q e^(t/RC)) = (E/R)e^(t/RC).

Integrate:

q e^(t/RC) = E/R∫ e^(t/RC) dt + K = (E/R)(RC e^(t/RC)) + K = CE e^(t/RC) + K.

Divide by e^(t/RC):

q(t) = CE + Ke^(-t/RC).

Apply q(0) = q₀ to fix the constant:

q₀ = CE + K ⇒ K = q₀-CE.

Final result:

q(t) = CE + (q₀-CE)e^(-t/RC).

This is the standard “approach to equilibrium” form with time constant τ = RC. (For the full circuit discussion, see UY1: RC Circuits.)


Worked example (physics): linear drag and terminal speed

In the linear-drag model (downward positive),

mdv/dt = mg-kv ⇒ dv/dt + (k/m)v = g.

The solution with initial speed v(0) = v₀ is:

v(t) = vₜ + (v₀-vₜ)e^(-t/τ), vₜ = mg/k, τ = m/k.

This is the same relaxation structure as RC circuits: one time constant controls how fast the system approaches a steady value.


Practice (with hints + answers)

1) Solve: y' + 3y = 6, with y(0)=1

Hint: P = 3, so μ = e^3x.

Answer:

y' + 3y = 6 ⇒ (ye^3x)' = 6e^3x.

Integrate:

ye^3x = 2e^3x + C ⇒ y = 2 + Ce^(-3x).

Apply y(0) = 1: 1 = 2 + C ⇒ C = -1.

y(x) = 2-e^(-3x).
2) Solve (physics form): y' = -(1/tau)(y - y_infty), y(0)=y0

Hint: Rewrite as y' + (1/τ)y = (1/τ)y_∞.

Answer:

y(t) = y_∞ + (y₀-y_∞)e^(-t/τ).
3) Solve: y' + (2/x) y = x, for x > 0

Hint: μ(x) = e^(∫ 2/x dx) = x².

Answer: Multiply by x²:

(x²y)' = x³.

Integrate:

x²y = x⁴/4 + C ⇒ y = x²/4 + C/x².
4) Match the model: which of these are linear in y? (a) y' + y^2 = x (b) y' + x y = 0 (c) y' = y/x

Hint: Linear means y appears only to the first power and is not inside nonlinear functions.

Answer:

  • (a) Not linear (has y²).
  • (b) Linear.
  • (c) Linear (rewrite as y'-(1/x)y = 0).

Back to First Order Differential Equations