Method of Undetermined Coefficients
Problem
Solve y'' + y = sin(2x). Guess y_p = A sin(2x) + B cos(2x), determine A and B, then combine with the homogeneous solution.
Explanation
What is undetermined coefficients for?
For a non-homogeneous linear ODE the general solution has the form where
- is the homogeneous solution (general solution of the ODE with replaced by ), and
- is any particular solution of the full non-homogeneous equation.
Why this works: if denotes the linear operator on the left (), then and , so . Any particular does the trick — we just need one.
The method of undetermined coefficients is the fastest way to find when is one of a few "nice" forms — polynomials, exponentials, sines/cosines, and products of these. You guess a function of the same form as (with unknown coefficients) and plug in to determine the coefficients.
Limitation: only works for those special right-hand sides. For arbitrary , use variation of parameters (see #187).
The given equation
Step 1 — Find the homogeneous solution
: characteristic equation (see #184).
Step 2 — Guess the particular solution
The right side is . The derivatives of and stay inside the 2D span , so the right guess is (even though the RHS only has , the derivatives will bring in and we need both coefficients to balance).
Important check — resonance. Before committing to this guess, check that it's not already a homogeneous solution. Here has frequency () while the guess has frequency — no overlap. ✓ If there were overlap, we'd multiply by (or higher powers) to escape. More on this below.
Step 3 — Compute and
Step 4 — Substitute into the ODE and match coefficients
Set equal to the right side :
- coefficient: .
- coefficient: .
Step 5 — Assemble particular solution.
Step 6 — General solution
Verification
, so .
The guess-table for undetermined coefficients
Match the right side to the corresponding guess for :
- polynomial of degree → (full polynomial of same degree).
- → .
- or → (both!).
- or → .
- = product of the above → = product of the corresponding guesses.
- = sum of different forms → = sum of corresponding guesses (solve each part separately).
The resonance fix — multiply by
If your guess overlaps with , it fails (plugging in gives , a contradiction). Fix: multiply the guess by the smallest that eliminates the overlap.
Example. . Now the guess is part of — this is the resonant forcing. Upgrade:
Solving gives , , so — the particular solution grows linearly because we're driving the oscillator at its natural frequency. This is the archetype of physical resonance: amplitude builds indefinitely.
Initial value problem
For our problem with , :
Common mistakes
- Leaving out when forcing is . The derivative of is ; the guess must be a full linear combination of both.
- Not checking resonance. Plug in the homogeneous solutions and see if your guess already solves . If yes, bump up by .
- Using the wrong multiplicity of . A guess that matches a double homogeneous root needs , not .
- Forgetting to include . The general solution is ; alone only works for zero initial conditions by coincidence.
Try it in the visualization
Sweep the forcing frequency and watch the amplitude of the particular solution. Cross the natural frequency of the oscillator — the amplitude blows up (mathematically reflected in the resonance fix producing / growth).
Interactive Visualization
Parameters
Got your own math or physics problem?
Turn any problem into an interactive visualization like this one — powered by AI, generated in seconds. Free to try, no credit card required.