Back to the on-screen lesson ·

Undetermined coefficients

Guessing $y_p$ from the shape of the forcing, multiplying by $x$ once per repeated root when the guess collides, and adding the result to the complementary function.

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 write the general solution of a forced equation as a complementary function plus a particular solution, choose the shape of the guess from the forcing term, decide how many extra factors of $x$ the duplication rule demands, substitute to find the undetermined coefficients, and apply initial conditions to the whole solution rather than to a piece of it.

2. What you already have

You can solve $ay'' + by' + cy = 0$ in all three root cases, and you know from the Wronskian why two independent solutions are exactly what two initial conditions need. Everything so far has had zero on the right. This lesson puts something there — a force, a voltage, a heat source — and the homogeneous work is not wasted: it becomes half of the answer and decides the other half.

3. Words this lesson uses

TermWhat it means
Non-homogeneous (forced)An equation with a non-zero right-hand side.
Forcing termThat right-hand side, $g(x)$.
Particular solutionAny one function $y_p$ satisfying the forced equation.
Complementary functionThe general solution $y_h$ of the homogeneous equation; the full solution is $y_h + y_p$.
Undetermined coefficientsGuessing $y_p$ from the shape of the forcing, with unknown constants in it, and matching coefficients.
DuplicationThe guess already solves the homogeneous equation, so it must be multiplied by $x$.
ResonanceDuplication when the forcing is an oscillation at the system's own frequency; the response grows without bound.

4. The answer is a sum, and the homogeneous part decides the guess

If $y_p$ solves $ay'' + by' + cy = g$ and $y_h$ is any solution of the homogeneous equation, then $y_p + y_h$ solves the forced equation too — subtract the two and the forcing cancels. Conversely any two solutions of the forced equation differ by a homogeneous one. So the general solution is exactly

$$y = y_h + y_p,$$

with the two arbitrary constants living entirely in $y_h$.

The guess. For a short list of forcings the derivatives stay inside a small family, so a particular solution can be found by algebra rather than integration:

Forcing $g(x)$Guess $y_p$
a polynomial of degree $n$$A_nx^{n} + \dots + A_1x + A_0$
$e^{kx}$$Ae^{kx}$
$\cos \omega x$ or $\sin \omega x$$A\cos \omega x + B\sin \omega x$
a product of thosethe product of the guesses

Substitute, collect like terms, and match coefficients on both sides.

The duplication rule. If the guess is already a homogeneous solution it contributes zero to the left-hand side and no coefficient can save it. Multiply the whole guess by $x$, once for each time the offending root repeats. A constant counts as $e^{0x}$, and $\cos\omega x$ carries the roots $\pm i\omega$, so the rule covers every line of the table.

Another way: picture

A swing with someone pushing it. The homogeneous solution is how the swing behaves when left alone — it dies away — and the particular solution is the motion the pushing sustains. After a while only the pushing is left, which is why $y_p$ is often called the steady state and $y_h$ the transient. Push at the swing's own rhythm and the guess collides: that is resonance, the extra $x$ is the amplitude climbing with every push, and nothing about the algebra was arbitrary.

Another way: steps

  1. Solve the homogeneous equation and write $y_h$.
  2. Read the shape of $g$ and write the guess with unknown coefficients.
  3. Compare it with $y_h$; multiply by $x$ once per repetition of the duplicated root.
  4. Substitute the guess, collect terms, and match coefficients to get $y_p$.
  5. Write $y = y_h + y_p$.
  6. Apply the initial conditions to that sum, never to $y_h$ alone.

5. Why duplication is fatal, and why one factor of $x$ repairs it

Write $L[y] = ay'' + by' + cy$. The method asks for a $y_p$ with $L[y_p] = g$. If the guess $y_p = Ae^{kx}$ happens to be a homogeneous solution then $L[Ae^{kx}] = A\,L[e^{kx}] = 0$ for every $A$. There is no coefficient to determine; the equation $0 = g$ has no solution, and a learner who pushes on regardless arrives at a contradiction like $0 = 5$.

Now try $y_p = Axe^{kx}$. Substituting gives $L[Axe^{kx}] = A(2ak + b)e^{kx}$ — the terms that would have vanished do vanish, and what is left is proportional to $2ak + b$. That is non-zero exactly when $k$ is a simple root. For a double root $2ak + b = 0$ too, the repair fails again, and $Ax^{2}e^{kx}$ is needed.

So the rule is not a patch. The number of factors of $x$ is the multiplicity of the forcing's exponent as a root, every time.

6. Where this goes wrong

Dropping the lower powers. For $g = x^{2}$ the guess is $Ax^{2} + Bx + C$, not $Ax^{2}$. Differentiating produces lower powers whether you asked for them or not, and without $B$ and $C$ there is nothing to cancel them against, so the coefficient matching becomes unsolvable.

Guessing only a cosine. $\cos\omega x$ needs $A\cos\omega x + B\sin\omega x$, for the same reason: unless the equation has no $y'$ term, differentiation produces the other one.

Reusing the forcing's coefficients. $g = 7e^{2x}$ still gets the guess $Ae^{2x}$. The $7$ appears on the right of the coefficient equation, not in the guess.

Applying the initial conditions too early. They belong to $y_h + y_p$. Fitting them to $y_h$ and then adding $y_p$ gives a function that satisfies the equation and misses the conditions — and it is the single most common lost mark in this unit.

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

Undetermined coefficients works for constant-coefficient equations whose forcing is a polynomial, an exponential, a sine or cosine, or a product or sum of these. The procedure is always the same.

  1. Solve the homogeneous equation and write $y_h$. You need it twice: to spot duplication now, and to fit the conditions at the end.
  2. Write the guess from the forcing:
Forcing $g(x)$Guess $y_p$
polynomial of degree $n$full polynomial of degree $n$, every power down to the constant
$e^{kx}$$Ae^{kx}$
$\cos\omega x$ or $\sin\omega x$$A\cos\omega x + B\sin\omega x$
$e^{kx}\cos\omega x$$e^{kx}(A\cos\omega x + B\sin\omega x)$
  1. Check for duplication. If any term of the guess solves the homogeneous equation, multiply the whole guess by $x$, and again if a term still duplicates. The number of factors is the multiplicity of the forcing's exponent as a root.
  2. Differentiate twice, substitute, collect. Group like terms: powers of $x$ together, cosines together, sines together.
  3. Match coefficients. Each kind of term gives one equation; solve them for the unknown coefficients.
  4. Assemble $y = y_h + y_p$, and only then apply initial conditions.

Why matching is allowed. Functions like $1$, $x$, $x^{2}$, $\cos\omega x$ and $\sin\omega x$ are linearly independent: no combination of them is zero for every $x$ unless every coefficient is zero. So when two such combinations agree for every $x$, their coefficients agree one by one.

How to check the answer. Substitute your $y_p$ alone into the left side; it must reproduce the forcing exactly, term by term. This check is short and catches almost every arithmetic slip in steps 4 and 5. Then put $x = 0$ into the full solution and its derivative to confirm the conditions. If the matching in step 5 produces a contradiction such as $0 = 3$, the guess duplicated a homogeneous solution and needs a factor of $x$.

8. In the world: a driven structure and resonance

A structure that can vibrate, such as a bridge deck, a floor or a car's wing mirror, has a natural frequency $\omega_0$, and when something pushes it periodically at a frequency $\omega$ its displacement obeys $y'' + \omega_0^{2}y = F\cos\omega t$ (ignoring damping). Undetermined coefficients gives the steady response at once: guess $A\cos\omega t$, and $(\omega_0^{2} - \omega^{2})A = F$, so the amplitude is $\frac{F}{\omega_0^{2} - \omega^{2}}$.

The denominator is the whole story. With $\omega_0 = 2$ per second and $\omega = 1$, the amplitude is $\frac{F}{4 - 1} = \frac{F}{3}$. At $\omega = 1.9$ it is $\frac{F}{4 - 3.61} \approx 2.6F$, nearly eight times larger, and as $\omega$ approaches $\omega_0$ it grows without bound: the duplication case of this lesson, where the guess needs a factor of $t$ and the amplitude grows linearly for ever.

Real structures have damping, which caps the growth, but the lesson stands. When London's Millennium Bridge opened in 2000, pedestrians' footsteps pushed it sideways near its natural lateral frequency of about one hertz, and it swayed enough to be closed within two days. The repair added dampers, which is the $cy'$ term engineers had not budgeted for.

9. In the world: the steady current in an AC circuit

A series circuit driven by an alternating voltage, $Lq'' + Rq' + \frac{q}{C} = E\cos\omega t$, settles after a moment into a steady oscillation at the driving frequency, and that steady state is exactly the particular solution. The homogeneous part decays, which is why electrical engineers call it the transient.

Take $L = 1$, $R = 2$, $\frac{1}{C} = 5$ and $E = 10$ with $\omega = 1$: $q'' + 2q' + 5q = 10\cos t$. Guess $q_p = A\cos t + B\sin t$. Then $q_p' = -A\sin t + B\cos t$ and $q_p'' = -A\cos t - B\sin t$. Collecting the cosines: $-A + 2B + 5A = 4A + 2B = 10$. Collecting the sines: $-B - 2A + 5B = -2A + 4B = 0$, so $A = 2B$, then $8B + 2B = 10$, $B = 1$ and $A = 2$. The steady charge is $q_p = 2\cos t + \sin t$, an oscillation of amplitude $\sqrt{2^{2} + 1^{2}} = \sqrt{5}$.

Check: $q_p'' + 2q_p' + 5q_p$ has cosine coefficient $-2 + 2 + 10 = 10$ and sine coefficient $-1 - 4 + 5 = 0$, which is the forcing. The ratio of the driving voltage to this amplitude is what the circuit's designer calls its impedance at that frequency, and it is computed by exactly this two-by-two system.

10. In the world: a loudspeaker's resonance

A loudspeaker cone is a mass on a springy suspension, driven by the audio signal, so each pure tone in the music is a forcing $F\cos\omega t$ and the cone's motion is the particular solution. Near the cone's natural frequency the response is large, which is why a small speaker has a boomy note it exaggerates; well above it the amplitude $\frac{F}{\omega_0^{2} - \omega^{2}}$ falls like $\frac{1}{\omega^{2}}$, which is why the same speaker sounds thin at high pitch unless the driver's force rises to compensate. Speaker designers choose the natural frequency and the damping so that the particular solution's amplitude is as flat as possible across the notes the speaker is meant to play, and they check the result with exactly the coefficient matching of this lesson, one frequency at a time.

11. The particular solution is not the answer, and the guess is not the forcing

Two habits account for most of the wrong answers here, and both come from reading the method as a recipe rather than as a decomposition. The first is stopping at $y_p$: a particular solution satisfies the equation but carries no arbitrary constants, so it cannot meet initial conditions, and reporting it as the general solution throws away an entire two-parameter family. The second is writing the forcing itself as the guess — answering $y_p = 4e^{3x}$ for a forcing of $4e^{3x}$ — which confuses the shape being copied with the numbers being solved for. The guess exists precisely so that substitution can determine its coefficients; that is what the word undetermined is doing in the name of the method, and a guess with the coefficients already filled in has nothing left to determine.

12. A forcing with no duplication

  1. Take $y'' - 3y' + 2y = 4e^{3x}$. Solve the homogeneous equation first.

    $r^{2} - 3r + 2 = (r - 1)(r - 2) \quad\Rightarrow\quad y_h = c_1e^{x} + c_2e^{2x}$

    Homogeneous first, then check the forcing against it: $3$ is not a root.

  2. Guess the same exponential and differentiate.

    $y_p = Ae^{3x}, \qquad y_p' = 3Ae^{3x}, \qquad y_p'' = 9Ae^{3x}$

    Each derivative brings down a factor of $3$.

  3. Substitute into the left side and collect.

    $9Ae^{3x} - 3(3Ae^{3x}) + 2Ae^{3x} = (9 - 9 + 2)Ae^{3x} = 2Ae^{3x}$

    The bracket is the characteristic polynomial evaluated at $3$.

  4. Match with the forcing and solve for $A$.

    $2Ae^{3x} = 4e^{3x} \quad\Rightarrow\quad 2A = 4 \quad\Rightarrow\quad A = 2$

    Divide both sides by $e^{3x}$, which is never zero, then by $2$. Had $3$ been a root the bracket would have been zero: the duplication rule seen from inside.

  5. Assemble the general solution and check the particular part.

    $y = c_1e^{x} + c_2e^{2x} + 2e^{3x}; \qquad 18e^{3x} - 18e^{3x} + 4e^{3x} = 4e^{3x} \quad \checkmark$

    Substituting $y_p = 2e^{3x}$ back reproduces the forcing exactly.

13. Resonance, worked

  1. Take $y'' + 4y = 3\cos 2x$. Solve the homogeneous equation.

    $r^{2} + 4 = 0 \;\Rightarrow\; r = \pm 2i \;\Rightarrow\; y_h = c_1\cos 2x + c_2\sin 2x$

    The forcing $\cos 2x$ is one of these: the collision is spotted before any substitution.

  2. Multiply the usual guess by $x$ once.

    $y_p = x(A\cos 2x + B\sin 2x)$

    One factor of $x$, because $2i$ is a simple root.

  3. Differentiate once with the product rule.

    $y_p' = (A\cos 2x + B\sin 2x) + x(-2A\sin 2x + 2B\cos 2x)$

    The derivative of $x$ times the bracket, plus $x$ times the bracket's derivative.

  4. Differentiate a second time, with the product rule again.

    $y_p'' = 2(-2A\sin 2x + 2B\cos 2x) + x(-4A\cos 2x - 4B\sin 2x)$

    The first bracket's derivative appears twice, once from each part of the product rule.

  5. Substitute both derivatives into the left side, $y'' + 4y$.

    $y_p'' + 4y_p = -4A\sin 2x + 4B\cos 2x + x(\dots) - x(\dots) = -4A\sin 2x + 4B\cos 2x$

    Everything carrying a factor of $x$ is $-4x(\dots) + 4x(\dots)$ and cancels; only the terms from differentiating the $x$ survive.

  6. Match the coefficients of sine and cosine with $3\cos 2x$.

    $-4A = 0,\ 4B = 3 \quad\Rightarrow\quad A = 0,\ B = \tfrac{3}{4}, \qquad y_p = \tfrac{3}{4}x\sin 2x$

    The amplitude grows linearly for ever: the factor of $x$ is the physics of resonance, not a fudge.

14. A forced initial value problem, conditions last

  1. Solve $y'' + y' - 2y = 4x$ with $y(0) = 0$, $y'(0) = 0$. Start with the homogeneous equation.

    $r^{2} + r - 2 = (r + 2)(r - 1) = 0 \quad\Rightarrow\quad y_h = c_1e^{x} + c_2e^{-2x}$

    Check: the roots add to $-1$ and multiply to $-2$.

  2. Guess a full polynomial of the forcing's degree, and differentiate.

    $y_p = Ax + B, \qquad y_p' = A, \qquad y_p'' = 0$

    A degree-one forcing needs both $Ax$ and the constant $B$. $0$ is not a root, so no extra $x$.

  3. Substitute and collect by powers of $x$.

    $0 + A - 2(Ax + B) = -2Ax + (A - 2B) = 4x$

    Expand the bracket, then group the $x$ terms and the constants.

  4. Match the coefficient of $x$, then the constant.

    $-2A = 4 \;\Rightarrow\; A = -2; \qquad A - 2B = 0 \;\Rightarrow\; B = \dfrac{A}{2} = -1$

    The right side has no constant term, so the constant on the left must be zero.

  5. Add the particular solution to the homogeneous one, and differentiate.

    $y = c_1e^{x} + c_2e^{-2x} - 2x - 1, \qquad y' = c_1e^{x} - 2c_2e^{-2x} - 2$

    The conditions belong to the whole solution, so it is assembled before they are used.

  6. Apply both conditions at $x = 0$.

    $$\begin{aligned} c_1 + c_2 - 1 &= 0 \\ c_1 - 2c_2 - 2 &= 0 \end{aligned}$$

    Every exponential is $1$ at $x = 0$.

  7. Subtract the second equation from the first to eliminate $c_1$.

    $3c_2 + 1 = 0 \;\Rightarrow\; c_2 = -\dfrac{1}{3}, \qquad c_1 = 1 - c_2 = \dfrac{4}{3}$

    $(c_1 + c_2 - 1) - (c_1 - 2c_2 - 2) = 3c_2 + 1$.

  8. Write the solution and check both conditions.

    $y = \dfrac{4}{3}e^{x} - \dfrac{1}{3}e^{-2x} - 2x - 1: \quad y(0) = \dfrac{4}{3} - \dfrac{1}{3} - 1 = 0, \quad y'(0) = \dfrac{4}{3} + \dfrac{2}{3} - 2 = 0$

    Both hold. Fitting the conditions to $y_h$ alone would have given $c_1 = c_2 = 0$ and the wrong answer $y = -2x - 1$, which misses $y(0) = 0$.

15. Your turn: find a particular solution of $y'' - 4y' + 4y = 6e^{2x}$

  1. Find the roots and their multiplicity.

    $r^{2} - 4r + 4 = (r - 2)^{2} \quad\Rightarrow\quad y_h = (c_1 + c_2x)e^{2x}$

    $2$ is a double root.

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

    Choose the guess, with one factor of $x$ per repetition.

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

    Differentiate twice, substitute and solve for $A$.

16. Guided practice

For $y'' - y' - 6y = g(x)$, whose homogeneous solutions are $e^{3x}$ and $e^{-2x}$, match each forcing $g$ to the particular solution you should guess.

$y_p = Ax + B$$y_p = Ae^{7x}$$y_p = A\cos 4x + B\sin 4x$$y_p = Ax^{2} + Bx + C$
$g = 3x + 4$
$g = 3e^{7x}$
$g = 3\cos 4x$
$g = 3x^{2}$

17. Guided practice

Complete the worked solution: find the particular solution of $y'' - 2y' + y = 64e^{5x}$.

  1. Check the exponent against the homogeneous roots, then choose the guess.

    $r^{2} - 2r + 1 \text{ at } r = 5 \ne 0 \quad\Rightarrow\quad y_p = Ae^{5x}$

    $5$ is not a root, so the plain guess cannot collide with a homogeneous solution.

  2. Differentiate the guess twice.

    $y_p' = 5Ae^{5x}, \qquad y_p'' = 5^{2}Ae^{5x}$

    Each derivative brings down a factor of $5$.

  3. Substitute and collect the coefficient of $Ae^{5x}$.

    $\left(5^{2} - 2 \cdot 5 + 1\right)Ae^{5x} = 64e^{5x}, \qquad 5^{2} - 2 \cdot 5 + 1 =$ c

    The bracket is the characteristic polynomial evaluated at $5$.

  4. Divide both sides by that coefficient to find $A$.

    $A = \dfrac{64}{\text{coefficient}} =$ a

    Matching the coefficients of $e^{5x}$ on both sides.

18. Guided practice

For $y'' + 4y = \cos 3x$, what should the particular solution be guessed as?

19. Practice

For each equation, say how many extra factors of $x$ the usual guess for a particular solution needs.

Extra factors of x
$y'' - 6y' + 9y = 5e^{3x}$
$y'' - 6y' + 9y = 5e^{4x}$
$y'' - 3y' = 5$
$y'' + 9y = 5\cos 3x$

20. Practice

Find the constant particular solution of $y'' + y' + 2y = 18$.

Answer:

21. Practice

A damped mass on a spring is shaken by a motor, and after the start-up has died away its displacement is the steady-state (particular) solution of the equation below, with $x$ the time. Find the particular solution of $y'' + 3y' + 9y = 30\cos x + 7\sin x$. Write $y_p$ as a formula in $x$ (type cos(...) and sin(...)).

Answer:

22. Somewhere new

Put the steps of solving $y'' + 2y' + 4y = 4$ with $y(0) = 1$, $y'(0) = 0$ into the order they must be done.

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

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 damped mass on a spring is shaken by a motor, and after the start-up has died away its displacement is the steady-state (particular) solution of the equation below, with $x$ the time. Find the particular solution of $y'' + 3y' + 6y = 14\cos x + 12\sin x$. Write $y_p$ as a formula in $x$ (type cos(...) and sin(...)).

Answer:

25. What you can do now

You can choose a guess from the shape of a forcing, multiply it by $x$ when it duplicates a homogeneous solution, and fit the initial conditions to the sum. Say in your own words why a guess that already solves the homogeneous equation can never be repaired by choosing a different coefficient.

Working for the steps left to you

15. Your turn: find a particular solution of $y'' - 4y' + 4y = 6e^{2x}$, step 2

$y_p = Ax^{2}e^{2x}$

Both $e^{2x}$ and $xe^{2x}$ are homogeneous, so the guess needs $x^{2}$.

15. Your turn: find a particular solution of $y'' - 4y' + 4y = 6e^{2x}$, step 3

$y_p'' - 4y_p' + 4y_p = 2Ae^{2x} = 6e^{2x} \;\Rightarrow\; A = 3, \qquad y_p = 3x^{2}e^{2x}$

Every term carrying an $x$ cancels, which is exactly what a double root guarantees.