First-Order Equations: Separable & Linear

variable-coefficient linear equation

Some linear equations have coefficients that are honest functions of x rather than fixed numbers. A variable-coefficient linear equation is a first-order linear equation y' + p(x) y = q(x) where p(x) genuinely varies with x — it is not a constant. This is the general case; constant-coefficient linear equations are just the special, simplest slice where p does not change.

The wonderful thing is that the integrating-factor recipe does not care whether p is constant or variable — it handles both with the same four steps. You still form mu(x) = e^(integral of p(x) dx); the only difference is that now you must integrate a genuine function p(x) rather than a constant, so mu comes out as something like x^n or e^(x^2/2) instead of a plain exponential e^(a x). After that, the procedure is identical: multiply through, recognize (mu y)', integrate, divide back. For instance y' + (2/x) y = x has p = 2/x, giving mu = e^(2 ln x) = x^2, and the rest follows mechanically. The variable coefficient also reshapes the interval of validity, since wherever p(x) is discontinuous (like 2/x at x = 0) the guaranteed solution interval ends.

Variable-coefficient equations matter because the real world rarely holds its parameters constant — a cooling rate that drifts, a mixing inflow that changes, a circuit element that is being adjusted. They are the natural setting where you see that linearity, not constancy, is what makes the integrating-factor method work. An honest contrast worth keeping: at first order, variable coefficients are no harder in principle (the recipe is unchanged). At second order and beyond, variable coefficients become genuinely much harder — there is no general formula, and you must turn to power series or special functions — so the easy first-order case is a happy exception, not the rule.

Solve y' + (2/x) y = x. Here p = 2/x, so mu = e^(integral (2/x) dx) = e^(2 ln x) = x^2. Then (x^2 y)' = x^3, integrate to x^2 y = x^4/4 + C, hence y = x^2/4 + C/x^2 — valid for x greater than 0.

A variable p(x) only changes what mu looks like; the four-step recipe and the interval-from-continuity rule are unchanged.

First-order variable coefficients are no harder than constant ones — the recipe is identical. That ease does NOT carry to second order, where variable coefficients have no general formula and force series methods.

Also called
non-constant-coefficient linear equation變係數方程