Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works
Create a free account to open Information theory and cryptography. The free chapters of Information Theory stay readable without one.

Recipe

Apply variation of parameters to a nonhomogeneous equation

Use when: your forcing term g(x) doesn't fit undetermined coefficients' polynomial, exponential, or sine-cosine trial forms, or you just need a method that works for any g(x)

Goal: a particular solution y_p=u_1y_1+u_2y_2, built entirely from the homogeneous fundamental set and two integrals

Taught in Deriving the variation-of-parameters formula

  1. 1

    Divide every term by the leading coefficient so y'' has coefficient 1: y''+p(x)y'+q(x)y=g(x).

    Example

    For 2y''+2y=2\sec x, divide every term by 2: y''+y=\sec x so g(x)=\sec x, the equation this example carries through every remaining step.

    Why: the boxed formula's g(x) is only correct once the equation is written with leading coefficient 1; skipping this step silently divides the forcing term by the wrong number.

  2. 2

    Solve y''+p(x)y'+q(x)y=0 with whichever earlier method applies (Chapters 6-8), giving two independent solutions y_1,y_2.

    Example

    For y''+y=0, the characteristic equation r^2+1=0 has roots r=\pm i, giving the fundamental set y_1=\cos x, \qquad y_2=\sin x

    Why: variation of parameters builds y_p entirely out of y_1 and y_2; without them there's nothing to substitute into the formula.

  3. 3

    W=y_1y_2'-y_1'y_2, guaranteed nonzero for a genuine fundamental set (Chapter 6's Wronskian test).

    Example

    y_1'=-\sin x, y_2'=\cos x, so W=\cos x\cos x-(-\sin x)\sin x=\cos^2x+\sin^2x=1

    Why: W sits in the denominator of both u_1' and u_2' below; it being nonzero is exactly what keeps those quotients defined everywhere the fundamental set is valid.

  4. 4

    Plug y_1, y_2, W, and g from Steps 2-3 directly into the derivation's boxed formulas: u_1'=-\frac{y_2g}{W}, \qquad u_2'=\frac{y_1g}{W}

    Example

    u_1'=-\sin x\sec x=-\tan x; u_2'=\cos x\sec x=1.

    Why: these are exactly the two convenience conditions the derivation imposes, rewritten as explicit formulas once y_1, y_2, and W are known.

  5. 5

    Integrate each u_i' from Step 4, then combine with the fundamental set from Step 2.

    Example

    u_1=\int-\tan x\,dx=\ln|\cos x|; u_2=\int 1\,dx=x. So y_p=u_1y_1+u_2y_2=\cos x\ln|\cos x|+x\sin x

    Why: this is the formula's actual output, the particular solution the whole derivation exists to produce, valid regardless of what family g(x) belongs to.

Common mistakes

  • Forgetting to divide by the leading coefficient first, which corrupts the g(x) used in u_1' and u_2'.
  • Swapping which formula gets the minus sign: u_1' is negative, u_2' is positive.
  • Dropping the absolute value inside a log integral like \ln|\cos x|.
  • Adding integration constants to u_1 and u_2. Any single particular solution works, so those constants can always be taken as 0.