JOVANA
Library Glossary Getting Started Three Levels Fields How it works Mission
Join the mission
All guides

Variation of Parameters: When Guessing Fails

Undetermined coefficients only works when the forcing is the kind you can guess. Variation of parameters throws away the guessing entirely and builds a particular solution by hand from the two solutions you already have — for any forcing at all.

Where the guessing runs out

The last two guides handed you a fast, cheap tool. To solve a nonhomogeneous equation a y'' + b y' + c y = g(x), you first find the complementary solution y_c = C1 y1 + C2 y2, then you *guess* a particular solution shaped like the forcing g(x) — that is undetermined coefficients. It is wonderful when it works. But it only works because a short list of forcings — polynomials, e^(rt), sines and cosines, and their products — have the magic property that differentiating them gives back more of the same shape.

Step outside that short list and the magic dies. What is the trial guess for g(x) = tan(x)? Differentiating tan(x) gives sec^2(x), then a tangle of higher powers of sec — the shape never closes back on itself, so no finite guess can match it. The same trouble hits g(x) = ln(x), or 1/x, or sec(x), or any forcing that is not built from the blessed list. We need a method that does not depend on the forcing being guessable. That method is variation of parameters, and remarkably it never guesses at all.

The one idea: let the constants vary

Here is the whole trick, and the name spells it out. The complementary solution is C1 y1 + C2 y2 with C1, C2 *constant*. Those constants are exactly what makes y_c solve the *homogeneous* equation and contribute nothing to the forcing. So the idea is mischievously simple: promote the constants to functions. Look for a particular solution of the form y_p = u1(x) y1 + u2(x) y2, where u1 and u2 are unknown functions to be discovered. We are reusing the same two building blocks y1 and y2 from the fundamental set — we just let their coefficients breathe.

Two unknown functions are too much freedom — one equation cannot pin down two functions. So we spend that extra freedom on a clever, self-imposed condition. When we differentiate y_p, the product rule throws out u1' y1 + u2' y2 plus the rest. We *choose* to demand u1' y1 + u2' y2 = 0. This is not a law of nature; it is a convenience we are allowed to insist on, and it does two beautiful things: it keeps y_p' free of the awkward u'' terms, and it gives us a second equation to work with.

Push the differentiation through to y_p'' and substitute everything back into a y'' + b y' + c y = g(x). Because y1 and y2 already kill the homogeneous part, a small avalanche of terms cancels, and what survives is astonishingly clean: a single condition u1' y1' + u2' y2' = g(x)/a. Together with our self-imposed u1' y1 + u2' y2 = 0, we now have two linear equations in the two unknowns u1' and u2'.

Solving the little system — the Wronskian returns

Two linear equations in two unknowns is the friendliest problem in all of algebra. Stare at the coefficient matrix: the unknowns u1' and u2' are multiplied by y1, y2 in the top row and y1', y2' in the bottom row. That is *exactly* the Wronskian matrix you met when testing linear independence. Cramer's rule then solves the system in one stroke, and the determinant in every denominator is the Wronskian W = y1 y2' - y2 y1'.

Solve:   u1' y1  + u2' y2  = 0
         u1' y1' + u2' y2' = g(x)/a

W = y1 y2' - y2 y1'        (never zero: y1,y2 are independent)

   u1' = -y2 * g(x) / (a W)        u2' = +y1 * g(x) / (a W)

   u1  = integral of (-y2 g / (a W)) dx
   u2  = integral of (+y1 g / (a W)) dx

   y_p = u1 y1 + u2 y2
The full variation-of-parameters recipe: solve the 2x2 system by Cramer's rule, integrate, recombine.

Notice why this never breaks down. The Wronskian sits in the denominator, so we needed W to be non-zero — and it is, precisely because y1 and y2 form a fundamental set. The thing that certified your general solution two guides ago is the very thing that keeps the division legal here. These two compact formulas for u1' and u2' are sometimes called the Wronskian formulas; memorizing them is optional, because you can always re-derive them by solving the 2x2 system on the spot.

Walking through tan(x)

Take the case that defeated guessing: y'' + y = tan(x). Here a = 1, the homogeneous equation y'' + y = 0 has fundamental solutions y1 = cos(x) and y2 = sin(x), and a quick check gives W = cos(x) cos(x) - sin(x)(-sin(x)) = cos^2 + sin^2 = 1 — a Wronskian of exactly 1, which is a gift. Now we just feed the recipe.

  1. Form u1' = -y2 g / (a W) = -sin(x) tan(x) / 1 = -sin^2(x)/cos(x), and u2' = y1 g / (a W) = cos(x) tan(x) = sin(x).
  2. Integrate u2' first (the easy one): u2 = integral of sin(x) dx = -cos(x).
  3. Integrate u1': rewrite -sin^2/cos as (cos^2 - 1)/cos = cos(x) - sec(x), so u1 = sin(x) - ln|sec(x) + tan(x)|.
  4. Recombine: y_p = u1 cos(x) + u2 sin(x). The sin(x)cos(x) terms cancel, leaving y_p = -cos(x) ln|sec(x) + tan(x)|.

Look at that answer: a logarithm multiplied by a cosine. No finite trial guess of polynomials, exponentials, or sinusoids could ever have produced a ln term — which is exactly why undetermined coefficients was helpless here, and exactly why variation of parameters had to exist. The full general solution is y = C1 cos(x) + C2 sin(x) - cos(x) ln|sec(x) + tan(x)|, the complementary part plus this hand-built particular part.

Honest fine print

Three cautions keep you out of trouble. First, normalize. Every formula above assumed the leading coefficient was visible: the g(x)/a is there because the equation must be in the form y'' + (b/a) y' + (c/a) y = g(x)/a before you read off the forcing. If you forget to divide by a, every u' is wrong by a factor. For a variable-coefficient equation, divide by whatever multiplies y'' first, and use g divided by that same leading function.

Second, the integrals are the catch. Variation of parameters always *sets up* a correct particular solution, but the integrals for u1 and u2 may have no closed form at all — try g(x) = e^(x^2) and you will be stuck with an integral nobody can evaluate in elementary functions. The method has not failed; it has honestly handed you the answer as an integral, which is sometimes the best a closed-form approach can do. When even that stalls, you leave the integrals symbolic or switch to numerical methods. Third, drop the integration constants while finding y_p: any constant you carry simply re-adds a multiple of y1 or y2, which the complementary solution already covers, so it is harmless to set them to zero.