The method of variation of parameters finds a particular solution of a nonhomogeneous linear ODE for any forcing function — including ones undetermined coefficients can’t handle (like , , ). The trade-off is more involved integrals.

For a second-order linear ODE in standard form with two known linearly independent homogeneous solutions :

where are functions (not constants — that’s the “variation”) satisfying:

Solve this system for via Cramer’s rule:

Then integrate to get .

The trick

The ansatz has two unknown functions. A second-order ODE is one equation. With two unknowns and one equation, we have freedom to impose an extra constraint. The standard choice is

This makes — clean, no second-derivative-of- terms. Then , and substituting into the ODE (using that satisfy the homogeneous version) collapses to:

So we get the system above.

Why matters

The denominator in the Cramer’s-rule formula is the Wronskian . For linearly independent on the interval, — so are well-defined.

If were linearly dependent, the system has no unique solution and the method fails. This is one reason linear independence matters.

Worked example 1

on . Standard form: .

Two known linearly independent homogeneous solutions: , . (The PDF provides these.)

Wronskian:

So .

Cramer’s:

Integrate:

Integration by parts gives (omitting constant).

Particular solution:

General solution:

Worked example 2: split forcing

on .

Homogeneous: , , .

Use Superposition principle for : solve each piece separately.

For : variation of parameters since undetermined coefficients can’t handle .

Integrate: (after some work), .

Substituting and :

The two terms cancel exactly. (More generally: any constants of integration in contribute multiples of , which are homogeneous solutions and can be absorbed into in the general solution.)

For : undetermined coefficients gives (after computation).

Total: .

When it’s the right method

Choose variation of parameters when:

  • The forcing function isn’t one of the “nice” types (, , , etc.).
  • The homogeneous solutions are non-elementary (e.g., Bessel functions) — variation of parameters doesn’t care, as long as you have them.
  • You need a particular solution and undetermined coefficients doesn’t apply.

For ODEs with sinusoidal/exponential/polynomial forcing, Method of undetermined coefficients is faster — guess and solve for constants instead of computing integrals. But variation of parameters always works (assuming you can do the integrals).

Higher orders

For an -th order linear ODE, the method generalizes: with constraint equations for , plus one final equation that yields the right-hand side . Cramer’s rule applies similarly using the higher-order Wronskian.

In practice, second-order is the common case in engineering courses.