Nonhomogeneous Equations & Resonance

Study Sheet

Nonhomogeneous Equations & Resonance

Undetermined coefficients, and what forcing does

Undetermined Coefficients

Tip
Guess the shape of the forcing
xy1234−4−2246y = 2x − 3
Solutions of y′′+3y′+2y=4xy'' + 3y' + 2y = 4x from three different starts all approach the particular solution y=2x−3y = 2x - 3 (dashed).

For y′′+by′+cy=f(x)y'' + by' + cy = f(x): general solution == homogeneous ++ one particular solution. Guess ypy_p shaped like ff: polynomials for polynomials (4x4x gets ax+bax + b), AekxAe^{kx} for exponentials, Acos⁡+Bsin⁡A\cos + B\sin for sinusoids — substitute and match coefficients.

Why the table works: derivatives of polynomials are polynomials of no higher degree, derivatives of ekxe^{kx} are multiples of ekxe^{kx}, and derivatives of cos⁡ωx\cos\omega x and sin⁡ωx\sin\omega x stay among cos⁡ωx,sin⁡ωx\cos\omega x, \sin\omega x. So the left side applied to the guess lands in the same family as ff, and matching coefficients is a finite linear system. The homogeneous part is added because the left side sends it to zero. For y′′+3y′+2y=4xy'' + 3y' + 2y = 4x (worked below) that part decays, and every solution approaches yp=2x−3y_p = 2x - 3.

Tip
Resonance: multiply by x
xy4812−4−22x/4
Resonance from rest: y=x4sin⁡2xy = \tfrac x4\sin 2x grows between the dashed lines y=±x4y = \pm\tfrac x4.

When the forcing already solves the homogeneous equation, the naive guess collapses — multiply it by xx. For y′′+4y=cos⁡2xy'' + 4y = \cos 2x: yp=x4sin⁡2xy_p = \tfrac{x}{4}\sin 2x, whose amplitude grows without bound. This is resonance — the mathematics behind pushed swings and shattered bridges.

Why multiplying by xx helps: if gg solves the homogeneous equation, then substituting xgxg leaves xx times the homogeneous expression for gg, which is zero, plus terms built from g′g' that are not zero. For y′′+4y=cos⁡2xy'' + 4y = \cos 2x: (xsin⁡2x)′′+4xsin⁡2x=4cos⁡2x(x\sin 2x)'' + 4x\sin 2x = 4\cos 2x, so yp=x4sin⁡2xy_p = \tfrac x4\sin 2x. This ypy_p has yp(0)=yp′(0)=0y_p(0) = y_p'(0) = 0, so it is the motion from rest, and its swings grow between the lines ±x4\pm\tfrac x4.

Example
A full match, worked

y′′+3y′+2y=4xy'' + 3y' + 2y = 4x with yp=ax+by_p = ax + b: substituting gives 3a+2(ax+b)=4x3a + 2(ax + b) = 4x, so a=2a = 2 and b=−3b = -3: yp=2x−3y_p = 2x - 3. Matching term-by-term is bookkeeping, not cleverness — write the shape, then compare.

Why ax+bax + b and not just axax: substituting yp=axy_p = ax gives 3a+2ax=4x3a + 2ax = 4x, which needs 2a=42a = 4 and 3a=03a = 0 at once — impossible. Differentiating axax produces the constant 3a3a, and the constant bb in the guess is there to absorb it.

Side note
Significance: resonance is not a metaphor

The Broughton suspension bridge (1831) collapsed under soldiers marching in step; the Millennium Bridge in London wobbled dangerously on opening day from synchronized footfalls — both are the xsin⁡ωxx\sin\omega x growth of this topic in steel. Every tuned structure is designed to keep its natural frequencies away from expected forcing.

Try it
Try it: spot resonance before solving

Which of cos⁡2x\cos 2x, cos⁡3x\cos 3x and e3xe^{3x} causes resonance in y′′+9y=f(x)y'' + 9y = f(x)? For each, give the form of the guess.

Show the answer

The homogeneous solutions are cos⁡3x\cos 3x and sin⁡3x\sin 3x (roots ±3i\pm 3i), and resonance happens exactly when the forcing is itself a homogeneous solution. cos⁡3x\cos 3x is one, so the guess must be x(Acos⁡3x+Bsin⁡3x)x(A\cos 3x + B\sin 3x), and the response grows like xx. cos⁡2x\cos 2x is not, so Acos⁡2x+Bsin⁡2xA\cos 2x + B\sin 2x works (in fact A=15A = \tfrac15, B=0B = 0). e3xe^{3x} is not either — the roots are ±3i\pm 3i, not 33 — so Ae3xAe^{3x} works, with A=118A = \tfrac{1}{18}.

Exponential, Sinusoidal and Product Forcing

Tip
The guess, family by family

For y′′+by′+cy=fy'' + by' + cy = f:

  • f=P(x)ekxf = P(x)e^{kx} with PP a polynomial of degree nn: guess Q(x)ekxQ(x)e^{kx} with QQ a general polynomial of degree nn;
  • f=eαx(Pcos⁡βx+Rsin⁡βx)f = e^{\alpha x}(P\cos\beta x + R\sin\beta x): guess eαx(Q1cos⁡βx+Q2sin⁡βx)e^{\alpha x}(Q_1\cos\beta x + Q_2\sin\beta x), with both cosine and sine even if ff has only one;
  • f=f1+f2f = f_1 + f_2: find a particular solution for each and add them.

If a term of the guess solves the homogeneous equation, multiply the whole guess by xx (see the next section).

Each family is closed under differentiation, so the left side applied to the guess returns to the family, and comparing coefficients gives a square linear system. Both cosine and sine are needed because the by′by' term turns one into the other. Adding particular solutions works because the left side LL is linear: L[y1+y2]=L[y1]+L[y2]=f1+f2L[y_1 + y_2] = L[y_1] + L[y_2] = f_1 + f_2.

Example
Worked: exponential forcing

Find the general solution of y′′−y′−2y=6exy'' - y' - 2y = 6e^{x}.

Step 1 — homogeneous: r2−r−2=(r−2)(r+1)r^2 - r - 2 = (r - 2)(r + 1), so yh=c1e2x+c2e−xy_h = c_1e^{2x} + c_2e^{-x}.

Step 2 — exe^x is not among these (11 is not a root), so guess yp=Aexy_p = Ae^x.

Step 3 — substitute: Aex−Aex−2Aex=−2Aex=6exAe^x - Ae^x - 2Ae^x = -2Ae^x = 6e^x, so A=−3A = -3.

Step 4 — y=c1e2x+c2e−x−3exy = c_1e^{2x} + c_2e^{-x} - 3e^x. A shortcut worth knowing: for f=ekxf = e^{kx} with kk not a root, substituting AekxAe^{kx} gives A(k2+bk+c)ekxA(k^2 + bk + c)e^{kx}, so AA is the forcing's coefficient divided by the characteristic polynomial at kk; here 61−1−2=−3\dfrac{6}{1 - 1 - 2} = -3.

Example
Worked: a damped oscillator driven by a cosine
xy246810−2−112
Started from rest, the solution of y′′+2y′+5y=10cos⁡xy'' + 2y' + 5y = 10\cos x locks onto the steady state 2cos⁡x+sin⁡x2\cos x + \sin x (dashed).

Solve y′′+2y′+5y=10cos⁡xy'' + 2y' + 5y = 10\cos x with y(0)=0y(0) = 0, y′(0)=0y'(0) = 0.

Step 1 — the homogeneous roots are −1±2i-1 \pm 2i, so yh=e−x(c1cos⁡2x+c2sin⁡2x)y_h = e^{-x}(c_1\cos 2x + c_2\sin 2x).

Step 2 — guess yp=Acos⁡x+Bsin⁡xy_p = A\cos x + B\sin x; then yp′=−Asin⁡x+Bcos⁡xy_p' = -A\sin x + B\cos x and yp′′=−Acos⁡x−Bsin⁡xy_p'' = -A\cos x - B\sin x.

Step 3 — substitute and collect: the cos⁡x\cos x terms give −A+2B+5A=4A+2B-A + 2B + 5A = 4A + 2B, the sin⁡x\sin x terms −B−2A+5B=4B−2A-B - 2A + 5B = 4B - 2A. Matching 10cos⁡x+0sin⁡x10\cos x + 0\sin x: 4A+2B=104A + 2B = 10 and −2A+4B=0-2A + 4B = 0, so A=2BA = 2B, 10B=1010B = 10, B=1B = 1 and A=2A = 2.

Step 4 — the data: y(0)=c1+2=0y(0) = c_1 + 2 = 0 gives c1=−2c_1 = -2, and y′(0)=−c1+2c2+1=0y'(0) = -c_1 + 2c_2 + 1 = 0 gives c2=−32c_2 = -\tfrac32.

Step 5 — y=e−x(−2cos⁡2x−32sin⁡2x)+2cos⁡x+sin⁡xy = e^{-x}\left(-2\cos 2x - \tfrac32\sin 2x\right) + 2\cos x + \sin x.

Step 6 — read it: the transient dies like e−xe^{-x}, leaving the steady state 2cos⁡x+sin⁡x=5cos⁡(x−φ)2\cos x + \sin x = \sqrt5\cos(x - \varphi) with φ=arctan⁡12\varphi = \arctan\tfrac12 — amplitude 5≈2.24\sqrt5 \approx 2.24, at the driving frequency 11 rather than the natural frequency 22.

Example
Worked: a polynomial times an exponential

Find a particular solution of y′′+y=xexy'' + y = xe^x.

Step 1 — exe^x does not solve y′′+y=0y'' + y = 0, so guess yp=(ax+b)exy_p = (ax + b)e^x, a general degree-one polynomial times exe^x.

Step 2 — yp′=(ax+a+b)exy_p' = (ax + a + b)e^x and yp′′=(ax+2a+b)exy_p'' = (ax + 2a + b)e^x.

Step 3 — yp′′+yp=(2ax+2a+2b)exy_p'' + y_p = (2ax + 2a + 2b)e^x must equal xexxe^x, so 2a=12a = 1 and 2a+2b=02a + 2b = 0: a=12a = \tfrac12, b=−12b = -\tfrac12.

Step 4 — yp=12(x−1)exy_p = \tfrac12(x - 1)e^x. The constant bb was necessary: with yp=axexy_p = axe^x alone, the constant terms would demand 2a=02a = 0, contradicting 2a=12a = 1.

Side note
Where it goes wrong: a cosine guess without its sine

For y′′+2y′+5y=10cos⁡xy'' + 2y' + 5y = 10\cos x, the guess yp=Acos⁡xy_p = A\cos x gives yp′′+2yp′+5yp=4Acos⁡x−2Asin⁡xy_p'' + 2y_p' + 5y_p = 4A\cos x - 2A\sin x. Matching 10cos⁡x10\cos x requires 4A=104A = 10 and −2A=0-2A = 0 at the same time — no such AA exists. The damping term 2y′2y' turns cosine into sine, so the guess must carry both: Acos⁡x+Bsin⁡xA\cos x + B\sin x gives A=2A = 2, B=1B = 1, as above.

Try it
Try it: a driven, critically damped system

Find a particular solution of y′′+4y′+4y=8sin⁡2xy'' + 4y' + 4y = 8\sin 2x.

Show the answer

r2+4r+4r^2 + 4r + 4 has the double root −2-2, so sin⁡2x\sin 2x is not a homogeneous solution. Guess yp=Acos⁡2x+Bsin⁡2xy_p = A\cos 2x + B\sin 2x: yp′′=−4Acos⁡2x−4Bsin⁡2xy_p'' = -4A\cos 2x - 4B\sin 2x and 4yp′=−8Asin⁡2x+8Bcos⁡2x4y_p' = -8A\sin 2x + 8B\cos 2x. The cosine terms total −4A+8B+4A=8B-4A + 8B + 4A = 8B; the sine terms −4B−8A+4B=−8A-4B - 8A + 4B = -8A. Matching 0cos⁡2x+8sin⁡2x0\cos 2x + 8\sin 2x: 8B=08B = 0 and −8A=8-8A = 8, so B=0B = 0, A=−1A = -1, and yp=−cos⁡2xy_p = -\cos 2x. Check: 4cos⁡2x+8sin⁡2x−4cos⁡2x=8sin⁡2x4\cos 2x + 8\sin 2x - 4\cos 2x = 8\sin 2x ✓.

Resonance, Double Roots and Beats

Tip
How many factors of x

If the exponent kk of the forcing ekxe^{kx} (or α+iβ\alpha + i\beta for eαxcos⁡βxe^{\alpha x}\cos\beta x) is a root of the characteristic equation, multiply the guess by xmx^m, where mm is the multiplicity of that root: m=1m = 1 for a simple root, m=2m = 2 for a double root. Near resonance, but not at it, no extra xx is needed; instead, started from rest, the response shows beats:

cos⁡ωx−cos⁡ω0x=2sin⁡(ω0−ω)x2 sin⁡(ω0+ω)x2,\cos\omega x - \cos\omega_0x = 2\sin\frac{(\omega_0 - \omega)x}{2}\,\sin\frac{(\omega_0 + \omega)x}{2},

a fast oscillation inside a slow envelope.

Why the multiplicity: when kk is a root of multiplicity mm, the functions ekx,xekx,…,xm−1ekxe^{kx}, xe^{kx}, \ldots, x^{m-1}e^{kx} all solve the homogeneous equation, so the left side sends each of them to zero and the first power of xx that can balance the forcing is xmx^m. Beats are the near-miss version of resonance: as ω→ω0\omega \to \omega_0 the slow envelope sin⁡(ω0−ω)x2\sin\frac{(\omega_0 - \omega)x}{2} stretches out, and over any fixed stretch of xx the response grows almost linearly, approaching the resonant xsin⁡ω0xx\sin\omega_0x.

Example
Worked: a simple root

Find a particular solution of y′′−y=exy'' - y = e^x.

Step 1 — the roots are ±1\pm1, and the forcing's exponent 11 is a simple root, so the plain guess AexAe^x gives Aex−Aex=0Ae^x - Ae^x = 0 and cannot work.

Step 2 — guess yp=Axexy_p = Axe^x: yp′=A(1+x)exy_p' = A(1 + x)e^x and yp′′=A(2+x)exy_p'' = A(2 + x)e^x.

Step 3 — yp′′−yp=2Aex=exy_p'' - y_p = 2Ae^x = e^x, so A=12A = \tfrac12 and yp=12xexy_p = \tfrac12xe^x. The xx-terms cancelled, as they must: the part of AxexAxe^x that looks like a homogeneous solution contributes nothing, and what is left is a constant multiple of exe^x.

Example
Worked: a double root needs x²

Find a particular solution of y′′−4y′+4y=e2xy'' - 4y' + 4y = e^{2x}.

Step 1 — (r−2)2=0(r - 2)^2 = 0: 22 is a double root, so both e2xe^{2x} and xe2xxe^{2x} are homogeneous solutions.

Step 2 — guess yp=Ax2e2xy_p = Ax^2e^{2x}: yp′=A(2x+2x2)e2xy_p' = A(2x + 2x^2)e^{2x} and yp′′=A(2+8x+4x2)e2xy_p'' = A(2 + 8x + 4x^2)e^{2x}.

Step 3 — substitute: Ae2x[(2+8x+4x2)−4(2x+2x2)+4x2]=2Ae2xAe^{2x}\left[(2 + 8x + 4x^2) - 4(2x + 2x^2) + 4x^2\right] = 2Ae^{2x}, so A=12A = \tfrac12 and yp=12x2e2xy_p = \tfrac12x^2e^{2x}.

Step 4 — the general solution is y=(c1+c2x)e2x+12x2e2xy = (c_1 + c_2x)e^{2x} + \tfrac12x^2e^{2x}.

Example
Worked: beats near resonance
xy−2−11π2π3π
y=cos⁡4x−cos⁡5xy = \cos 4x - \cos 5x from rest: beats inside the dashed envelope ±2sin⁡x2\pm 2\sin\tfrac x2.

Solve y′′+25y=9cos⁡4xy'' + 25y = 9\cos 4x from rest, y(0)=y′(0)=0y(0) = y'(0) = 0.

Step 1 — natural frequency 55, driving frequency 44: no resonance. With no y′y' term, a cosine guess stays a cosine, so yp=Acos⁡4xy_p = A\cos 4x suffices.

Step 2 — (−16+25)A=9(-16 + 25)A = 9, so A=1A = 1 and yp=cos⁡4xy_p = \cos 4x.

Step 3 — the general solution is y=c1cos⁡5x+c2sin⁡5x+cos⁡4xy = c_1\cos 5x + c_2\sin 5x + \cos 4x; y(0)=c1+1=0y(0) = c_1 + 1 = 0 gives c1=−1c_1 = -1, and y′(0)=5c2=0y'(0) = 5c_2 = 0 gives c2=0c_2 = 0.

Step 4 — y=cos⁡4x−cos⁡5x=2sin⁡x2 sin⁡9x2y = \cos 4x - \cos 5x = 2\sin\tfrac x2\,\sin\tfrac{9x}{2}.

Step 5 — read it: a fast oscillation at frequency 92\tfrac92 inside the slow envelope ±2sin⁡x2\pm2\sin\tfrac x2, which swells to 22 at x=πx = \pi and shrinks back to 00 at x=2πx = 2\pi. The system alternately absorbs energy from the forcing and hands it back.

Side note
Where it goes wrong: one factor of x at a double root

For y′′−4y′+4y=e2xy'' - 4y' + 4y = e^{2x}, the guess Axe2xAxe^{2x} gives yp′=A(1+2x)e2xy_p' = A(1 + 2x)e^{2x} and yp′′=A(4+4x)e2xy_p'' = A(4 + 4x)e^{2x}, so yp′′−4yp′+4yp=Ae2x[(4+4x)−(4+8x)+4x]=0y_p'' - 4y_p' + 4y_p = Ae^{2x}\left[(4 + 4x) - (4 + 8x) + 4x\right] = 0. The equation 0=e2x0 = e^{2x} has no solution for AA: at a double root, xe2xxe^{2x} is itself a homogeneous solution. The multiplicity is 22, so the guess needs x2x^2.

Try it
Try it: resonance from rest

Solve y′′+9y=6sin⁡3xy'' + 9y = 6\sin 3x with y(0)=0y(0) = 0, y′(0)=0y'(0) = 0.

Show the answer

The forcing sin⁡3x\sin 3x solves the homogeneous equation (roots ±3i\pm 3i), so guess yp=x(Acos⁡3x+Bsin⁡3x)y_p = x(A\cos 3x + B\sin 3x). Substituting, the xx-terms cancel and yp′′+9yp=−6Asin⁡3x+6Bcos⁡3xy_p'' + 9y_p = -6A\sin 3x + 6B\cos 3x. Matching 6sin⁡3x6\sin 3x: A=−1A = -1, B=0B = 0, so yp=−xcos⁡3xy_p = -x\cos 3x. General solution: y=c1cos⁡3x+c2sin⁡3x−xcos⁡3xy = c_1\cos 3x + c_2\sin 3x - x\cos 3x. Data: y(0)=c1=0y(0) = c_1 = 0, and y′(0)=3c2−1=0y'(0) = 3c_2 - 1 = 0 gives c2=13c_2 = \tfrac13. So y=13sin⁡3x−xcos⁡3xy = \tfrac13\sin 3x - x\cos 3x, whose swings grow like xx.

Proofs & Why It Matters

Tip
Proof: general = homogeneous + particular

Let ypy_p solve Ly=fLy = f (writing LL for the whole left side). If yy is any solution of Ly=fLy = f, then L(y−yp)=f−f=0L(y - y_p) = f - f = 0 by linearity, so y−ypy - y_p is a homogeneous solution: y=yh+ypy = y_h + y_p. Conversely every yh+ypy_h + y_p solves Ly=fLy = f.

One particular solution plus the whole homogeneous family is therefore the complete solution set. ■\blacksquare

Tip
Proof: the resonant particular solution

For y′′+ω2y=cos⁡ωxy'' + \omega^2y = \cos\omega x, try y=kxsin⁡ωxy = kx\sin\omega x: y′=ksin⁡ωx+kωxcos⁡ωxy' = k\sin\omega x + k\omega x\cos\omega x and y′′=2kωcos⁡ωx−kω2xsin⁡ωxy'' = 2k\omega\cos\omega x - k\omega^2x\sin\omega x. Then y′′+ω2y=2kωcos⁡ωxy'' + \omega^2y = 2k\omega\cos\omega x — the xx-terms cancel — so k=12ωk = \tfrac{1}{2\omega} (=14= \tfrac14 when ω=2\omega = 2).

The linear-in-xx amplitude is forced: bounded guesses die because they already solve the homogeneous equation. ■\blacksquare

Going Deeper: Explanations & Worked Problems

Concept
The guessing table, and the logic behind it

Undetermined coefficients works because differentiation maps each function family into itself: polynomials to polynomials, ekxe^{kx} to itself, {cos⁡ωx,sin⁡ωx}\{\cos\omega x, \sin\omega x\} into each other.

So guess a general member of the forcing's family: for 4x4x, guess ax+bax + b (both terms — the derivative of axax makes constants, so a bare axax cannot balance); for e2xe^{2x}, guess Ae2xAe^{2x}; for cos⁡2x\cos 2x, guess Acos⁡2x+Bsin⁡2xA\cos2x + B\sin2x (both, since y′y' turns cosine into sine); for products, multiply the guesses. The exception: if the guess already solves the homogeneous equation, substituting it gives zero on the left and the coefficient equations become unsolvable — multiply the guess by xx (twice for a double root). That is resonance, and physically it is why forcing a system at its natural frequency produces growing oscillations rather than a steady response.

Example
Worked: polynomial forcing, all coefficients matched

Find the general solution of y′′+3y′+2y=4xy'' + 3y' + 2y = 4x.

Step 1 — homogeneous part: r2+3r+2=(r+1)(r+2)=0r^2 + 3r + 2 = (r+1)(r+2) = 0, so yh=c1e−x+c2e−2xy_h = c_1e^{-x} + c_2e^{-2x}.

Step 2 — guess yp=ax+by_p = ax + b (not a homogeneous solution — no xx-multiplication needed): yp′=ay_p' = a, yp′′=0y_p'' = 0.

Step 3 — substitute: 0+3a+2(ax+b)=4x0 + 3a + 2(ax + b) = 4x, i.e. 2a x+(3a+2b)=4x+02a\,x + (3a + 2b) = 4x + 0.

Step 4 — match coefficient by coefficient: xx: 2a=4⇒a=22a = 4 \Rightarrow a = 2; constants: 3(2)+2b=0⇒b=−33(2) + 2b = 0 \Rightarrow b = -3.

Step 5 — assemble: y=c1e−x+c2e−2x+2x−3y = c_1e^{-x} + c_2e^{-2x} + 2x - 3.

Step 6 — long-run reading: both homogeneous pieces decay, so every solution approaches the line 2x−32x - 3 — the particular solution is the system's steady response, the homogeneous part its fading memory of initial conditions.

Example
Worked: resonance versus near-resonance, side by side

Compare y′′+4y=cos⁡3xy'' + 4y = \cos 3x against y′′+4y=cos⁡2xy'' + 4y = \cos 2x (natural frequency 22). Non-resonant: guess yp=Acos⁡3xy_p = A\cos3x; then yp′′=−9Acos⁡3xy_p'' = -9A\cos3x, so (−9A+4A)cos⁡3x=cos⁡3x(-9A + 4A)\cos3x = \cos3x gives A=−15A = -\tfrac15 — a bounded steady oscillation, done.

Resonant: the naive guess Acos⁡2xA\cos2x gives (−4A+4A)cos⁡2x=0≠cos⁡2x(-4A + 4A)\cos2x = 0 \ne \cos2x — unsolvable, exactly because cos⁡2x\cos2x solves the homogeneous equation. Multiply by xx: yp=x(Acos⁡2x+Bsin⁡2x)y_p = x(A\cos2x + B\sin2x). Differentiate twice (product rule, carefully): yp′′=−4x(Acos⁡2x+Bsin⁡2x)+2(−2Asin⁡2x+2Bcos⁡2x)y_p'' = -4x(A\cos2x + B\sin2x) + 2(-2A\sin2x + 2B\cos2x); adding 4yp4y_p cancels the xx-terms, leaving 4Bcos⁡2x−4Asin⁡2x=cos⁡2x4B\cos2x - 4A\sin2x = \cos2x: B=14B = \tfrac14, A=0A = 0, so yp=x4sin⁡2xy_p = \tfrac x4\sin2x. The amplitude grows linearly forever — same equation shape, one frequency changed, qualitatively different fate.