Back to the on-screen lesson ·

Variation of parameters

A particular solution for any continuous forcing, built from a fundamental set and its Wronskian, and the two integrals that are its price.

Paper packet. Every task here also exists on screen, where it is checked automatically; answers written on paper are not assessed by Nydus. When you are back at a device, enter your answers there.

1. What you will learn

By the end of this lesson you will be able to put an equation into standard form and read its forcing term, assemble the fundamental set and Wronskian the formula needs, run the variation of parameters formula to produce a particular solution without guessing anything, and decide from the forcing alone whether this method or undetermined coefficients is the right one to reach for.

2. What you already have

You can solve a homogeneous constant-coefficient equation from its characteristic roots, you can compute a Wronskian, and you have guessed particular solutions by undetermined coefficients. This lesson is what to do when there is nothing to guess.

3. Words this lesson uses

TermWhat it means
Standard formThe coefficient of $y''$ divided down to $1$, so that $g$ is the forcing the formula expects.
Fundamental setA pair of independent solutions of the homogeneous equation.
Wronskian$W = y_1y_2' - y_1'y_2$, which appears in the denominator of both integrands.
Varying the parametersReplacing the two arbitrary constants of the homogeneous solution by two unknown functions and solving for them.
Duhamel's integralThe response of an oscillator to any force, built by adding the ringing caused by each instant's push.

4. Letting the constants vary

The homogeneous solution is $c_1y_1 + c_2y_2$ with two constants. Replace them by two unknown functions and look for

$$y_p = u_1(x)y_1 + u_2(x)y_2.$$

One equation cannot determine two functions, so we are free to impose a second condition, and the useful one is

$$u_1'y_1 + u_2'y_2 = 0,$$

chosen precisely because it kills the second derivatives of $u_1$ and $u_2$ before they appear. Substituting what is left into the equation gives a second linear equation in $u_1'$ and $u_2'$, and the two together are a two-by-two system whose determinant is the Wronskian. Solving it:

$$u_1' = -\frac{y_2\,g}{W}, \qquad u_2' = \frac{y_1\,g}{W}.$$

So

$$y_p = -y_1\int \frac{y_2\,g}{W}\,dx + y_2\int \frac{y_1\,g}{W}\,dx.$$

Nothing about $g$ was assumed beyond continuity. That is the whole advantage, and the whole cost: two integrals that the method does not promise are pleasant.

Another way: picture

Undetermined coefficients is a keyring: you look at the forcing, pick the key shaped like it, and turn. Variation of parameters is a locksmith. It opens every door and takes considerably longer, so you check the keyring first and call the locksmith when nothing on it fits.

Another way: steps

  1. Divide into standard form, and read $g$ off the right-hand side.
  2. Solve the homogeneous equation for $y_1$ and $y_2$.
  3. Compute $W = y_1y_2' - y_1'y_2$.
  4. Integrate $-y_2g/W$ and $y_1g/W$; no constants are needed, because any constant just adds a homogeneous solution.
  5. Assemble $y_p = u_1y_1 + u_2y_2$, and add the homogeneous solution for the general one.

5. Why the extra condition is allowed

Imposing $u_1'y_1 + u_2'y_2 = 0$ looks like an assumption smuggled in to make the algebra work, and in a sense it is — but it costs nothing, and here is why. We are looking for one particular solution. Two unknown functions give a two-parameter family of candidates, and the equation constrains only one combination of them; the remaining freedom is ours to spend however we like. Spending it on a condition that removes $u_1''$ and $u_2''$ from the calculation is the cheapest thing to buy with it.

The test of the manoeuvre is the one that ends every method here: the $y_p$ it produces is substituted, and it satisfies the equation. A condition that led somewhere wrong would fail that check, and it does not.

6. Where this goes wrong

Forgetting standard form. For $2y'' + 3y' - y = x$, the $g$ in the formula is $x/2$, not $x$. Dividing at the end does not repair it, because $g$ appears inside two integrals.

Dropping the minus sign on the first integral. It comes from solving the two-by-two system by Cramer's rule and it is not decorative; without it the answer is wrong by a homogeneous solution plus a sign.

Carrying constants of integration. They are harmless — they add multiples of $y_1$ and $y_2$, which the general solution already contains — but carrying them makes the expression twice as long for no gain.

Reaching for it first. For a polynomial, an exponential or a sinusoid, undetermined coefficients is a few lines and this is two integrals.

7. The method, step by step, and how to check it

Variation of parameters finds a particular solution of $y'' + p(x)y' + q(x)y = g(x)$ for any continuous forcing, once a fundamental set is known.

  1. Standard form. Divide by the coefficient of $y''$. The $g$ in the formula is the right side after this division.
  2. A fundamental set $y_1$, $y_2$ of the homogeneous equation: from the characteristic equation when the coefficients are constant, or given.
  3. The Wronskian $W = y_1y_2' - y_1'y_2$. It must be non-zero on the interval, because it is about to be divided by.
  4. The two integrands: $u_1' = -\frac{y_2g}{W}$ and $u_2' = \frac{y_1g}{W}$. Simplify each before integrating; they often collapse to something small.
  5. Integrate each, with no constants.
  6. Assemble $y_p = u_1y_1 + u_2y_2$, simplify, and drop any multiple of $y_1$ or $y_2$ if a tidier answer is wanted.

Where the formulas come from. Look for $y_p = u_1y_1 + u_2y_2$ with $u_1$ and $u_2$ functions rather than constants. Impose $u_1'y_1 + u_2'y_2 = 0$, so the first derivative has no $u'$ terms. Substituting into the equation then leaves $u_1'y_1' + u_2'y_2' = g$. Those two conditions are a linear system for $u_1'$ and $u_2'$ whose determinant is $W$, and Cramer's rule gives exactly the two integrands, the minus sign included.

When to use it. Use undetermined coefficients whenever the forcing is a polynomial, exponential, sine or cosine, because it is shorter. Use variation of parameters for everything else, such as $\tan x$, $\sec x$, $\ln x$ or $\frac{1}{x}$, and for equations whose coefficients are not constant. It also needs no separate rule for resonance: when the forcing duplicates $y_1$, the factor of $x$ appears on its own from the integral.

How to check the answer. Differentiate $y_p$ twice and substitute into the original equation, not the standard form, so that step 1 is checked too. It must reproduce the forcing exactly. If it is off by a factor, $g$ was taken before dividing; if it is off by a sign, the minus on $u_1'$ was lost.

Solving an initial value problem. Variation of parameters gives one particular solution, not the answer to the problem. The general solution is $y = c_1y_1 + c_2y_2 + y_p$, and initial conditions are applied to that whole sum, after $y_p$ has been found and simplified. The constants you chose to drop in step 5 do no harm here: they would only have changed $c_1$ and $c_2$, and the conditions fix those anyway. The solution then holds on the whole interval where $p$, $q$ and $g$ are continuous and $W$ is non-zero, which for $\tan x$ is $\left(-\frac{\pi}{2}, \frac{\pi}{2}\right)$ and for $x^{2}y'' - 2xy' + 2y = x^{3}$ is $x > 0$.

8. In the world: the response to any force at all

Undetermined coefficients answers for forces shaped like polynomials, exponentials and sines. Real forces are rarely so polite: a hammer blow, a gust, a road bump, an earthquake record sampled from a seismograph. Variation of parameters handles all of them, and applied to the oscillator $y'' + \omega^{2}y = F(t)$, starting at rest, it gives a formula engineers use every day.

Take $y_1 = \cos\omega t$ and $y_2 = \sin\omega t$, so $W = \omega$. The two integrands are $u_1' = -\frac{F(t)\sin\omega t}{\omega}$ and $u_2' = \frac{F(t)\cos\omega t}{\omega}$. Integrating from $0$ and combining $u_1y_1 + u_2y_2$ with the angle-difference formula gives

$$y(t) = \frac{1}{\omega}\int_0^{t} \sin\big(\omega(t - \tau)\big)F(\tau)\,d\tau,$$

Duhamel's integral: the response is a sum of the responses to each instant's push, each one ringing on from the moment it was applied. A structural engineer feeds a recorded earthquake into it, one sample of $F$ at a time, to find how far a building would sway.

Check it on the simplest force, a constant $F_0$ switched on at $t = 0$: $y = \frac{F_0}{\omega}\int_0^{t}\sin\big(\omega(t - \tau)\big)\,d\tau = \frac{F_0}{\omega^{2}}(1 - \cos\omega t)$. The mass oscillates about the new equilibrium $\frac{F_0}{\omega^{2}}$ between $0$ and twice that, which is why a load dropped suddenly onto a spring stretches it twice as far as the same load lowered gently.

9. In the world: a bead on a spinning rod

A bead that can slide along a straight rod spinning at a steady $\omega$ radians a second is flung outward by the rotation: in the rod's frame its distance $y$ from the axis obeys $y'' - \omega^{2}y = F(t)$, where $F$ is any extra push along the rod per unit mass. The homogeneous solutions are $e^{\omega t}$ and $e^{-\omega t}$, and $W = -2\omega$.

A push that itself grows like $e^{\omega t}$, in step with the rotation, is the resonant case this lesson's solve item works through: variation of parameters produces the factor of $t$ on its own. A push that holds the bead in place is the opposite question. With $\omega = 2$ and the bead to stay at $y = 0.5$ metres, the particular solution must be the constant $0.5$, and substituting gives $0 - 4 \times 0.5 = F$: an inward force of $2$ newtons per kilogram, which is the centripetal force $\omega^{2}y$ a physics text would write down directly.

Centrifuges, governors on steam engines and the sliding weights in a spinning space station's experiments are all this equation. Engineers choose variation of parameters when the push is measured rather than designed, because the method takes the push exactly as it is.

10. In the world: heat flowing along a fin with a varying source

The cooling fins on a motor or a computer chip conduct heat along their length and lose it from their surface. The temperature excess $\theta$ along a fin, at distance $x$ from its base, obeys $\theta'' - m^{2}\theta = -q(x)$, where $m$ depends on the fin's material and shape and $q$ describes heat generated inside it, from electrical current, say, which is rarely uniform. The homogeneous solutions $e^{mx}$ and $e^{-mx}$ are the same as for the bead on the rod, and variation of parameters gives the temperature for whatever heating profile $q$ the designer measures.

For a uniform source $q = q_0$ the particular solution is the constant $\frac{q_0}{m^{2}}$, and with $m = 10$ per metre and $q_0 = 500$ degrees per square metre the fin runs $5$ degrees hotter throughout. For a source concentrated near the base, such as $q = q_0e^{-mx}$, the forcing duplicates a homogeneous solution, guessing fails, and the method's own integral supplies the factor of $x$: the particular solution is $\frac{q_0}{2m}xe^{-mx}$. Thermal engineers compute these profiles to find the hottest point of the fin, which is where it fails first.

11. The method is chosen by the right-hand side, never by the left

It is tempting to decide on a method by looking at the equation as a whole, and the left-hand side is the part that catches the eye. It is also the part that is irrelevant here: both methods need the homogeneous solutions, so both do the same work on the left. What separates them is entirely the forcing — whether it is one of the handful of shapes that can be guessed. A second, quieter error is believing that variation of parameters is better because it is more general. It is more general and it is more work, and on a polynomial forcing choosing it is a decision to do two integrals instead of solving for one coefficient.

12. The same machinery on an easy forcing

  1. Take $y'' - y = 2$. Find a fundamental set.

    $r^{2} - 1 = 0 \;\Rightarrow\; r = \pm 1 \;\Rightarrow\; y_1 = e^{x}, \quad y_2 = e^{-x}$

    Standard form already, with $g = 2$.

  2. Compute the Wronskian.

    $W = e^{x}\left(-e^{-x}\right) - e^{x}e^{-x} = -1 - 1 = -2$

    $e^{x}e^{-x} = 1$.

  3. Form and integrate the first integrand.

    $u_1' = -\dfrac{e^{-x} \cdot 2}{-2} = e^{-x} \quad\Rightarrow\quad u_1 = -e^{-x}$

    The two minus signs cancel.

  4. Form and integrate the second integrand.

    $u_2' = \dfrac{e^{x} \cdot 2}{-2} = -e^{x} \quad\Rightarrow\quad u_2 = -e^{x}$

    An ordinary integral.

  5. Assemble the particular solution.

    $y_p = u_1y_1 + u_2y_2 = -e^{-x}e^{x} - e^{x}e^{-x} = -1 - 1 = -2$

    A constant guess $y_p = A$ gives $0 - A = 2$, so $A = -2$, in one line. The formula is right, and here it is the long way round.

13. A forcing no guess can reach

  1. Take $y'' + y = \tan x$ on $(-\pi/2, \pi/2)$. Find a fundamental set.

    $r^{2} + 1 = 0 \;\Rightarrow\; r = \pm i \;\Rightarrow\; y_1 = \cos x, \quad y_2 = \sin x$

    $\tan x$ is not on the list of forcings undetermined coefficients can handle, so this method is the one to use.

  2. Compute the Wronskian.

    $W = \cos x\cos x - (-\sin x)\sin x = \cos^{2}x + \sin^{2}x = 1$

    A Wronskian of $1$ is why this pair is so often used.

  3. Form the two integrands.

    $u_1' = -\dfrac{\sin x\tan x}{1} = -\dfrac{\sin^{2}x}{\cos x}, \qquad u_2' = \dfrac{\cos x\tan x}{1} = \sin x$

    $u_1' = -y_2g/W$ and $u_2' = y_1g/W$; $\cos x\tan x = \sin x$.

  4. Rewrite the first integrand so it can be integrated.

    $-\dfrac{\sin^{2}x}{\cos x} = -\dfrac{1 - \cos^{2}x}{\cos x} = \cos x - \sec x$

    Replace $\sin^{2}x$ by $1 - \cos^{2}x$ and split the fraction.

  5. Integrate both of them.

    $u_1 = \sin x - \ln|\sec x + \tan x|, \qquad u_2 = -\cos x$

    $\int \sec x\,dx = \ln|\sec x + \tan x|$ is the standard integral.

  6. Assemble the particular solution.

    $y_p = u_1\cos x + u_2\sin x = \sin x\cos x - \cos x\,\ln|\sec x + \tan x| - \sin x\cos x = -\cos x\,\ln|\sec x + \tan x|$

    The two $\sin x\cos x$ terms cancel. No list of shapes contains this answer: it was produced, not guessed.

14. Variable coefficients, and why standard form matters

  1. Solve $x^{2}y'' - 2xy' + 2y = x^{3}$ on $x > 0$, given that $y_1 = x$ and $y_2 = x^{2}$ solve the homogeneous equation. Divide every term by $x^{2}$.

    $y'' - \dfrac{2}{x}y' + \dfrac{2}{x^{2}}y = x$

    The formula needs the coefficient of $y''$ to be $1$, so $g = x$, not $x^{3}$.

  2. Check the fundamental set quickly.

    $y_1 = x: \ 0 - 2x + 2x = 0; \qquad y_2 = x^{2}: \ 2x^{2} - 4x^{2} + 2x^{2} = 0$

    Substitute each into $x^{2}y'' - 2xy' + 2y$.

  3. Compute the Wronskian.

    $W = x \cdot 2x - 1 \cdot x^{2} = x^{2}$

    Non-zero on $x > 0$, so the pair is a fundamental set there.

  4. Form the first integrand and integrate.

    $u_1' = -\dfrac{x^{2} \cdot x}{x^{2}} = -x \quad\Rightarrow\quad u_1 = -\dfrac{x^{2}}{2}$

    $u_1' = -y_2g/W$ with $g = x$ from the standard form.

  5. Form the second integrand and integrate.

    $u_2' = \dfrac{x \cdot x}{x^{2}} = 1 \quad\Rightarrow\quad u_2 = x$

    $u_2' = y_1g/W$.

  6. Assemble the particular solution.

    $y_p = u_1y_1 + u_2y_2 = -\dfrac{x^{2}}{2} \cdot x + x \cdot x^{2} = -\dfrac{x^{3}}{2} + x^{3} = \dfrac{x^{3}}{2}$

    Collect the two cubes.

  7. Check it in the original equation.

    $y_p' = \dfrac{3x^{2}}{2}, \quad y_p'' = 3x: \qquad x^{2}(3x) - 2x \cdot \dfrac{3x^{2}}{2} + 2 \cdot \dfrac{x^{3}}{2} = 3x^{3} - 3x^{3} + x^{3} = x^{3}$

    It reproduces the forcing exactly.

  8. See what the mistake would have given: use $g = x^{3}$ without dividing.

    $u_1' = -x^{3}, \ u_2' = x^{2} \quad\Rightarrow\quad y_p = -\dfrac{x^{4}}{4} \cdot x + \dfrac{x^{3}}{3} \cdot x^{2} = \dfrac{x^{5}}{12}$

    $\frac{x^{5}}{12}$ does not solve the equation. Since $g$ sits inside both integrals, dividing afterwards cannot repair it.

15. Your turn: find a particular solution of $y'' - 4y = 8$

  1. Collect the ingredients.

    $y_1 = e^{2x}, \quad y_2 = e^{-2x}, \quad W = e^{2x}(-2e^{-2x}) - 2e^{2x}e^{-2x} = -4$

    The homogeneous roots are $\pm 2$.

  2. Your turn: work this step out. Its working is at the end of the packet.

    Form the two integrands.

  3. Your turn: work this step out. Its working is at the end of the packet.

    Integrate, assemble and check.

16. Guided practice

Put the steps of finding a particular solution of $y'' - 9y = 45$ by variation of parameters into the order they must be done.

Number the steps in order (write the number in the box):

17. Guided practice

Complete the worked solution: the ingredients of variation of parameters for $y'' - 4y = 20$.

  1. Solve the homogeneous equation for a fundamental set.

    $r^{2} - 4 = 0 \;\Rightarrow\; r = \pm 2 \;\Rightarrow\; y_1 = e^{2x},\ y_2 = e^{-2x}$

    The method varies the constants of this solution.

  2. Differentiate both and form the Wronskian; the exponentials cancel.

    $W = e^{2x} \cdot \left(-2e^{-2x}\right) - 2e^{2x} \cdot e^{-2x} = -2 - 2 =$ w

    $e^{2x}e^{-2x} = 1$.

  3. Form the first integrand, $u_1' = -\dfrac{y_2 g}{W}$, and simplify.

    $u_1' = -\dfrac{e^{-2x} \cdot 20}{W} = \text{(coefficient)} \cdot e^{-2x}, \qquad \text{coefficient} = \dfrac{20}{4} =$ u

    Dividing by the negative Wronskian cancels the minus sign in front.

  4. Integrate $u_1'$, then assemble with the same work for $u_2$.

    $u_1 = -\dfrac{\text{coefficient}}{2}e^{-2x}, \qquad y_p = u_1y_1 + u_2y_2 = \text{a constant}$

    A constant forcing gives a constant particular solution; a constant guess would have reached it at once.

18. Guided practice

For $y'' - y = \tan x$, which method should the particular solution be found by?

19. Practice

For $y'' - 16y = g(x)$ the fundamental set is $y_1 = e^{4x}$ and $y_2 = e^{-4x}$. Fill in the value of each piece of the formula at $x = 0$.

Value at zero
The first solution
The second solution
The derivative of the first
The derivative of the second
The Wronskian

20. Practice

Find the constant particular solution of $y'' - 9y = 45$.

Answer:

21. Practice

A bead slides along a rod spinning at $3$ radians a second and is pushed by a force that grows in step with the rotation; its distance $y$ from the axis after $x$ seconds obeys the equation below. Use variation of parameters to find a particular solution of $y'' - 9y = 6e^{3x}$. Give the one with no multiple of $e^{3x}$ or $e^{-3x}$ in it (type the exponential as e^(...)).

Answer:

22. Somewhere new

Find a particular solution of $y'' - 9y = 27x$. Write it as a formula in $x$.

Answer:

23. Lesson test

Lesson test: one question per skill, one attempt each, no hints. Your answers are checked when you submit.

24. Test question

A bead slides along a rod spinning at $1$ radians a second and is pushed by a force that grows in step with the rotation; its distance $y$ from the axis after $x$ seconds obeys the equation below. Use variation of parameters to find a particular solution of $y'' - y = 2e^{x}$. Give the one with no multiple of $e^{x}$ or $e^{-x}$ in it (type the exponential as e^(...)).

Answer:

25. What you can do now

You can produce a particular solution for a forcing that no guess reaches, and you can say from the forcing which of the two methods to use. Say in your own words why imposing the extra condition on the two unknown functions costs nothing.

Working for the steps left to you

15. Your turn: find a particular solution of $y'' - 4y = 8$, step 2

$u_1' = -\dfrac{e^{-2x} \cdot 8}{-4} = 2e^{-2x}, \qquad u_2' = \dfrac{e^{2x} \cdot 8}{-4} = -2e^{2x}$

$u_1' = -y_2g/W$ and $u_2' = y_1g/W$.

15. Your turn: find a particular solution of $y'' - 4y = 8$, step 3

$u_1 = -e^{-2x}, \quad u_2 = -e^{2x}, \quad y_p = -1 - 1 = -2; \qquad 0 - 4(-2) = 8$

A constant guess reaches the same place at once: the formula is for forcings that have no guess.