First-Order Linear ODE

April 13, 2026

Problem

Solve dy/dx + 2y = 6 and show the solution approaching the equilibrium y = 3.

Explanation

What is a first-order linear ODE?

An equation is first-order linear in yy when it can be written in the standard form dydx+P(x)y=Q(x)\frac{dy}{dx} + P(x) \, y = Q(x) where P(x)P(x) and Q(x)Q(x) depend on xx only (not on yy). "Linear" means yy and yy' appear to the first power and never multiply each other.

The given equation dydx+2y=6\dfrac{dy}{dx} + 2y = 6 is already in standard form with the constants P(x)=2P(x) = 2 and Q(x)=6Q(x) = 6.

When PP and QQ are constants, the solution has a clean structure: y(x)=yequilibrium+(y0yequilibrium)ePxy(x) = y_{\text{equilibrium}} + \bigl(y_0 - y_{\text{equilibrium}}\bigr) e^{-Px} where the equilibrium (steady state) is yeq=Q/Py_{\text{eq}} = Q/P. Every solution relaxes to the equilibrium if P>0P > 0.

Step-by-step solution (the integrating factor way)

Step 1 — Integrating factor.

Multiply both sides by μ(x)=ePdx=e2x\mu(x) = e^{\int P \, dx} = e^{2x}. The left side collapses into a single derivative: e2xdydx+2e2xy=ddx ⁣[e2xy]e^{2x} \frac{dy}{dx} + 2 e^{2x} y = \frac{d}{dx}\!\left[ e^{2x} y \right]

So the equation becomes ddx ⁣[e2xy]=6e2x\frac{d}{dx}\!\left[ e^{2x} y \right] = 6 \, e^{2x}

Step 2 — Integrate both sides. e2xy=6e2xdx=3e2x+Ce^{2x} y = \int 6 \, e^{2x} \, dx = 3 e^{2x} + C

Step 3 — Solve for yy.

Divide through by e2xe^{2x}: y(x)=3+Ce2x\boxed{\, y(x) = 3 + C e^{-2x} \,}

Interpretation — equilibrium + decay

The solution has two pieces:

  • Particular / steady-state piece: yeq=3y_{\text{eq}} = 3. This is the equilibrium — the value where dy/dx=0dy/dx = 0: 0+2y=6    y=3.0 + 2 \cdot y = 6 \implies y = 3.
  • Transient piece: Ce2xC e^{-2x}. This dies off exponentially (because 2<0-2 < 0). The time scale for decay is τ=1/P=1/2\tau = 1/P = 1/2.

Any initial condition simply picks how far above or below 33 you start, and then the solution relaxes back to 33.

Initial value problem

If y(0)=5y(0) = 5, then 5=3+Ce0    C=25 = 3 + C \cdot e^{0} \implies C = 2 y(x)=3+2e2xy(x) = 3 + 2 e^{-2x}

Quick checks:

  • y(0)=3+2=5y(0) = 3 + 2 = 5
  • As xx \to \infty, e2x0e^{-2x} \to 0, so y3y \to 3. ✓

Verification

Compute dydx\dfrac{dy}{dx} from y=3+Ce2xy = 3 + C e^{-2x}: dydx=2Ce2x\frac{dy}{dx} = -2 C e^{-2x}

Plug into dydx+2y\dfrac{dy}{dx} + 2y: 2Ce2x+2(3+Ce2x)=2Ce2x+6+2Ce2x=6-2 C e^{-2x} + 2 (3 + C e^{-2x}) = -2C e^{-2x} + 6 + 2C e^{-2x} = 6 \quad \checkmark

Why the equilibrium is Q/PQ/P

At equilibrium dy/dx=0dy/dx = 0, so the ODE reduces to 0+Pyeq=Q0 + P \cdot y_{\text{eq}} = Qyeq=Q/P=6/2=3y_{\text{eq}} = Q/P = 6/2 = 3. Whenever P>0P > 0 and QQ is constant, you can read off the steady state immediately.

Where this shape appears in applications

  • Newton's law of cooling: T=k(TTamb)T' = -k(T - T_{\text{amb}}) → temperature relaxes exponentially to the ambient temperature.
  • RC circuits: V+1RCV=VsourceRCV' + \dfrac{1}{RC} V = \dfrac{V_{\text{source}}}{RC} → capacitor voltage relaxes to the source voltage.
  • Drug clearance: C+kC=IC' + k C = I (infusion rate II) → drug concentration stabilizes at I/kI/k.
  • Bank interest with steady withdrawals, terminal velocity under air drag, and many other "approach to a steady state" problems all have this form.

Common mistakes

  • Forgetting to divide by the coefficient of dy/dxdy/dx before reading off P(x)P(x). If the equation is 3y+6y=123 y' + 6 y = 12, divide first: y+2y=4y' + 2y = 4.
  • Using the wrong integrating factor for non-constant P(x)P(x). The rule is μ(x)=eP(x)dx\mu(x) = e^{\int P(x)\, dx}, with no extra constant.
  • Forgetting the +C+C. Linear ODEs have a one-parameter family of solutions; CC is how you match the initial condition.
  • Confusing yeqy_{\text{eq}} with the initial condition. They are different: yeqy_{\text{eq}} is determined by the ODE alone, the initial condition is extra data that picks out one curve.

Try it in the visualization

Drag the initial value y(0)y(0) above and below the equilibrium line y=3y = 3, and watch every curve relax back to the equilibrium with the same time constant. Increase the coefficient PP to see the decay become faster.

Interactive Visualization

Parameters

5.00
2.00
6.00
5.00
10.00
7.00
Your turn

Got your own math or physics problem?

Turn any problem into an interactive visualization like this one — powered by AI, generated in seconds. Free to try, no credit card required.

Sign Up Free to Try It30 free visualizations every day
First-Order Linear ODE | MathSpin