Flow Lab

Syllabus / Module 5: Second-Order Linear ODEs & Oscillations

Lesson 5.4

Nonhomogeneous Equations: Undetermined Coefficients

y = y_h + y_p; guessing particular solutions for polynomial, exponential and sinusoidal forcing; the modification rule.

Written byClaude Sonnet

🌊
Why this matters for simulation: Periodic forcing (gusts, vortex shedding) on a structure is handled exactly this way.

By the end of this lesson you can…

  • Explain why every solution of $L[y] = g$ is one particular solution plus a homogeneous solution, and fit initial conditions after $y_p$ is added.
  • Explain why a guess works when the forcing's family is closed under differentiation, by writing $L$ there as a small matrix.
  • Solve for polynomial, exponential, sinusoidal and product forcing, splitting sums of forcings.
  • Derive the modification rule (multiply by $t^m$) from $L[te^{st}] = (P(s)t + P'(s))e^{st}$.
  • Use $G = 1/P(i\omega)$ to get the amplitude and phase of the response to $\cos\omega t$, and recognise forcing such as $\tan t$ that no finite guess matches.
On this page
·
  1. The shape of every answer
  2. Why a guess can work
  3. Worked examples
  4. The complex-exponential shortcut
  5. When the guess is already a solution
  6. Initial conditions come last
  7. Play with it
  8. Where the method stops
  9. Lab
  10. Exercise: the guess as a matrix, with sympy and RK45 as referees
  11. Problems
  12. Key Takeaways

Until now nothing pushed on the system; the spring of 5.3 Mechanical Vibrations: Spring–Mass–Damper rang down by itself. A wing in a gust, a bridge deck in shedding vortices and a motor bolted to a frame are pushed by something independent of their state, so the model becomes ay′′+by′+cy=g(t)ay'' + by' + cy = g(t). 5.1 Second-Order Linear Equations: Structure gave the structure of the unforced family and 5.2 Constant Coefficients & the Characteristic Equation found it. This lesson finds the one extra function the forcing adds, by a method that looks like guessing and is really a small linear solve. Arbitrary forcing and the resonance curve come next.

▶ Video Particular plus homogeneous, why the guess family closes under differentiation, the guess table, the modification rule, complex exponentials, and applying initial conditions lastcaptions only
Transcript
  1. Forcing adds one extra function. If y p is any one solution of L of y equals g, then y minus y p solves the homogeneous equation. So every solution is y h plus y p: the homogeneous plane, shifted off the origin by y p. Any one will do.
  2. Why can a guess work? Differentiation never leaves the polynomials of degree two, so L is a small matrix there. For this equation it is triangular, with determinant two hundred sixteen, and solving it gives the coefficients two, minus three, two.
  3. Cosine and sine work the same way: differentiation rotates one into the other, so L is a two by two matrix. Its determinant, twenty, is the area the unit square stretches to. An exponential gives a one by one matrix, P of s: invertible unless the exponent is a root.
  4. A product with an exponential only shifts the constants, so t to the n times e to the s t takes a polynomial of the same degree. That builds this table; sums are solved piece by piece. Example: A is point one and B is minus point zero six.
  5. Complex exponentials shortcut this: L of e to the i omega t is P of i omega times itself. So the response to a cosine is the real part of G e to the i omega t, with G one over P of i omega. Here P of two i is minus two plus four i.
  6. Now push an undamped spring of natural frequency three. The gain, one over the size of nine minus omega squared, is point two at omega two, and about sixteen point seven at two point nine nine. It blows up as P of i omega nears zero.
  7. Now the trap. For y double prime minus four y equals e to the two t, P of two is zero, so e to the two t already solves the homogeneous equation. The residual is minus e to the two t whatever A is: the guess cannot reach the forcing.
  8. Leave the family: differentiate t e to the s t. The result is P of s times t, plus P prime of s. The first term, with no derivative on t, vanishes at a root; the second survives. Here P prime of two is four, giving a quarter t e to the two t. The rule: multiply by t to the multiplicity.
  9. The rule at work. For y double prime plus three y prime equals six t, constants are in the kernel, so the guess is t times a line. For a cosine at the natural frequency, the answer is t over six times sine three t: an amplitude that grows forever, the limit of the gain.
  10. Initial conditions come last. Here y of zero is three and y prime of zero is minus one. The particular solution already starts at two and minus three, so the homogeneous part must start at one and two. Fitting it alone lands the total at five and minus four.
  11. RK45 is the referee. At t equal one it gives one point four seven eight; the right answer agrees, the wrong one says one point eight three four. The wrong answer is off by as much as two. What remains, y minus y p, fades: the transient.
  12. Where does it stop? Each derivative of tan t raises the power of tan by one, so no finite family contains them all. Even one over t fails: each fix creates a new error, with coefficients one, minus two, twenty-four, and on. The terms shrink, then grow.
  13. To recap: every solution is y h plus y p. A guess works because L is a small matrix on a family that differentiation never leaves; at a root, multiply by t to the multiplicity. Fit initial data last. Next: arbitrary forcing.

The shape of every answer

Write L[y]=ay′′+by′+cyL[y] = ay'' + by' + cy and P(r)=ar2+br+cP(r) = ar^2 + br + c. If ypy_p is any one solution of L[y]=gL[y] = g and yy is another, linearity gives L[y−yp]=g−g=0L[y - y_p] = g - g = 0, so y−ypy - y_p is in the kernel, the family yh=c1y1+c2y2y_h = c_1y_1 + c_2y_2 of the last lesson. Therefore

 y=yh+yp \boxed{\,y = y_h + y_p\,}

the shape of the solutions of Ax⃗=b⃗A\vec x = \vec b in 1.3 Linear Systems, Kernel & Column Space: one particular solution plus the kernel. Geometrically the solutions form the plane (c1,c2)(c_1, c_2), shifted off the origin by ypy_p; it is not a vector space, since 00 is not a solution when g≠0g \neq 0. Two choices of ypy_p differ by a kernel element, so any one will do.

Why a guess can work

LL is built from differentiation and constants. If gg lives in a finite-dimensional space VV of functions that differentiation never leaves, then LL maps VV into itself and is a small matrix there. Solving L[y]=gL[y] = g in VV is then a linear system whose unknowns, the coordinates of yy, are the “undetermined coefficients”. Three families:

Polynomials of degree at most 2, V=span⁡{1,t,t2}V = \operatorname{span}\{1, t, t^2\}. Here L[1]=cL[1] = c, L[t]=b+ctL[t] = b + ct and L[t2]=2a+2bt+ct2L[t^2] = 2a + 2bt + ct^2, so the matrix, with these as columns, is

M=(cb2a0c2b00c),det⁡M=c3.M = \begin{pmatrix} c & b & 2a \\ 0 & c & 2b \\ 0 & 0 & c \end{pmatrix}, \qquad \det M = c^3 .

Triangular, since differentiation only lowers the degree: solve from the top coefficient down.

One exponential, V=span⁡{est}V = \operatorname{span}\{e^{st}\} with ss real or complex. L[est]=P(s)estL[e^{st}] = P(s)e^{st}, a 1×11 \times 1 matrix.

Cosine and sine, V=span⁡{cos⁡ωt,sin⁡ωt}V = \operatorname{span}\{\cos\omega t, \sin\omega t\}. Differentiation rotates one into the other, and L[Acos⁡ωt+Bsin⁡ωt]L[A\cos\omega t + B\sin\omega t] has coordinates

(c−aω2bω−bωc−aω2)(AB),det⁡=(c−aω2)2+(bω)2=∣P(iω)∣2.\begin{pmatrix} c - a\omega^2 & b\omega \\ -b\omega & c - a\omega^2 \end{pmatrix}\begin{pmatrix} A \\ B \end{pmatrix}, \qquad \det = (c - a\omega^2)^2 + (b\omega)^2 = |P(i\omega)|^2 .

Sines appear even for a pure cosine forcing because the damping term by′by' turns cosines into sines; guessing Acos⁡ωtA\cos\omega t alone leaves a stray sin⁡\sin.

All three are invertible exactly when the forcing’s exponent (00, ss or iωi\omega) is not a root of PP, and then there is exactly one ypy_p in VV. Block A of the lab prints the matrices, with determinants 216=63216 = 6^3 and 20=∣P(2i)∣220 = |P(2i)|^2 for the examples below.

Products. Since (uest)′=(u′+su)est(ue^{st})' = (u' + su)e^{st} and (uest)′′=(u′′+2su′+s2u)est(ue^{st})'' = (u'' + 2su' + s^2u)e^{st},

L[u est]=est(au′′+(2as+b)u′+P(s) u).L[u\,e^{st}] = e^{st}\bigl(au'' + (2as + b)u' + P(s)\,u\bigr).

The exponential factors out and uu sees the polynomial case with shifted constants and P(s)P(s) on the diagonal. So tnestt^ne^{st} calls for a degree-nn polynomial times este^{st}, and s=σ+iωs = \sigma + i\omega covers eσtcos⁡ωt=Re⁡ este^{\sigma t}\cos\omega t = \operatorname{Re}\,e^{st}. Block B checks the identity symbolically.

forcing g(t)g(t)guess ypy_p (exponent not a root of PP)
antn+⋯+a0a_nt^n + \dots + a_0Antn+⋯+A0A_nt^n + \dots + A_0, every power
CestCe^{st}AestAe^{st}
cos⁡ωt\cos\omega t, sin⁡ωt\sin\omega t or a mixAcos⁡ωt+Bsin⁡ωtA\cos\omega t + B\sin\omega t
tnestt^ne^{st}(Antn+⋯+A0)est(A_nt^n + \dots + A_0)e^{st}
tneσtcos⁡ωtt^ne^{\sigma t}\cos\omega teσt[(Antn+… )cos⁡ωt+(Bntn+… )sin⁡ωt]e^{\sigma t}\bigl[(A_nt^n + \dots)\cos\omega t + (B_nt^n + \dots)\sin\omega t\bigr]
g1+g2g_1 + g_2yp1+yp2y_{p1} + y_{p2}, each solved on its own

The last row is superposition: L[y1+y2]=g1+g2L[y_1 + y_2] = g_1 + g_2 when L[yi]=giL[y_i] = g_i.

Worked examples

1. A polynomial. y′′+5y′+6y=12t2+2t+1y'' + 5y' + 6y = 12t^2 + 2t + 1. Here P=(r+2)(r+3)P = (r + 2)(r + 3), and P(0)=6≠0P(0) = 6 \neq 0, so guess At2+Bt+CAt^2 + Bt + C:

L[yp]=6At2+(10A+6B)t+(2A+5B+6C).L[y_p] = 6At^2 + (10A + 6B)t + (2A + 5B + 6C).

From the top: 6A=126A = 12 gives A=2A = 2; 10A+6B=210A + 6B = 2 gives B=−3B = -3; 2A+5B+6C=12A + 5B + 6C = 1 gives C=2C = 2. So yp=2t2−3t+2y_p = 2t^2 - 3t + 2. Block A solves the same system as Mx=gM x = g and gets (C,B,A)=(2,−3,2)(C, B, A) = (2, -3, 2); block C checks with sympy that L[yp]−g=0L[y_p] - g = 0. The guess needs every power: At2At^2 alone gives 6At2+10At+2A6At^2 + 10At + 2A, with a tt and a constant that nothing can cancel.

2. A sum. y′′+2y′+2y=5cos⁡2t+10ety'' + 2y' + 2y = 5\cos 2t + 10e^t, with PP having roots −1±i-1 \pm i, so neither 11 nor 2i2i is a root. For 10et10e^t: P(1)=5P(1) = 5, so yp2=2ety_{p2} = 2e^t. For 5cos⁡2t5\cos 2t guess Acos⁡2t+Bsin⁡2tA\cos 2t + B\sin 2t:

L[yp]=(−2A+4B)cos⁡2t+(−4A−2B)sin⁡2t=5cos⁡2t,L[y_p] = (-2A + 4B)\cos 2t + (-4A - 2B)\sin 2t = 5\cos 2t ,

so B=−2AB = -2A and −10A=5-10A = 5: A=−12A = -\tfrac12, B=1B = 1. Together, yp=sin⁡2t−12cos⁡2t+2ety_p = \sin 2t - \tfrac12\cos 2t + 2e^t.

3. A product. y′′+2y′+2y=te2ty'' + 2y' + 2y = te^{2t}. With s=2s = 2: 2as+b=62as + b = 6 and P(2)=10P(2) = 10, so u=At+Bu = At + B satisfies u′′+6u′+10u=tu'' + 6u' + 10u = t, i.e. 10At+6A+10B=t10At + 6A + 10B = t. Thus A=0.1A = 0.1 and B=−0.06B = -0.06: yp=(0.1t−0.06)e2ty_p = (0.1t - 0.06)e^{2t}.

The complex-exponential shortcut

Since (eiωt)′=iωeiωt(e^{i\omega t})' = i\omega e^{i\omega t}, we have L[eiωt]=P(iω)eiωtL[e^{i\omega t}] = P(i\omega)e^{i\omega t}. If P(iω)≠0P(i\omega) \neq 0, then w=eiωt/P(iω)w = e^{i\omega t}/P(i\omega) solves L[w]=eiωtL[w] = e^{i\omega t}. Because a,b,ca, b, c are real, Re⁡L[w]=L[Re⁡ w]\operatorname{Re}L[w] = L[\operatorname{Re}\,w], and Re⁡ eiωt=cos⁡ωt\operatorname{Re}\,e^{i\omega t} = \cos\omega t. So for g=Fcos⁡ωtg = F\cos\omega t, yp=FRe⁡[G eiωt]y_p = F\operatorname{Re}[G\,e^{i\omega t}] with G=1/P(iω)G = 1/P(i\omega). Writing P(iω)=∣P∣eiφP(i\omega) = |P|e^{i\varphi},

 yp=F∣P(iω)∣cos⁡(ωt−φ),∣P(iω)∣=(c−aω2)2+(bω)2 \boxed{\,y_p = \frac{F}{|P(i\omega)|}\cos(\omega t - \varphi), \qquad |P(i\omega)| = \sqrt{(c - a\omega^2)^2 + (b\omega)^2}\,}

The response has the same frequency, gain ∣G∣|G| and phase lag φ\varphi; GG is the transfer function, and ∣G(iω)∣|G(i\omega)| plotted against ω\omega is the resonance curve of the forced-oscillations lesson. For Fsin⁡ωtF\sin\omega t take the imaginary part. For example 2, block D prints P(2i)=−2+4iP(2i) = -2 + 4i, ∣P∣2=20|P|^2 = 20, G=−0.1−0.2iG = -0.1 - 0.2i, ∣G∣=0.2236068|G| = 0.2236068 and φ=2.034444\varphi = 2.034444 rad. The amplitude 5∣G∣=1.1180345|G| = 1.118034 equals 1+1/4\sqrt{1 + 1/4}, the amplitude of the real answer sin⁡2t−12cos⁡2t\sin 2t - \tfrac12\cos 2t, and the cosine and sine coefficients of 5Re⁡[Ge2it]5\operatorname{Re}[Ge^{2it}] are −0.5-0.5 and 1.01.0. The denominator is the determinant of the cosine-sine matrix, so the gain is large exactly when that matrix is nearly singular.

When the guess is already a solution

Take y′′−4y=e2ty'' - 4y = e^{2t}. Now P(2)=0P(2) = 0, so e2te^{2t} solves the homogeneous equation and L[Ae2t]=0L[Ae^{2t}] = 0 for every AA: the residual is −e2t-e^{2t} whatever you choose. The 1×11 \times 1 matrix is 00, and e2te^{2t} is not in its range. We must leave the family. Compute (test)′=(1+st)est(te^{st})' = (1 + st)e^{st} and (test)′′=(2s+s2t)est(te^{st})'' = (2s + s^2t)e^{st}:

L[test]=[a(2s+s2t)+b(1+st)+ct]est=(P(s) t+P′(s))est,P′(s)=2as+b.L[te^{st}] = \bigl[a(2s + s^2t) + b(1 + st) + ct\bigr]e^{st} = \bigl(P(s)\,t + P'(s)\bigr)e^{st}, \qquad P'(s) = 2as + b .

P(s)tP(s)t collects the terms where no derivative lands on the factor tt, and vanishes when P(s)=0P(s) = 0; P′(s)P'(s) collects the terms where one derivative turns tt into 11. For a simple root, L[test]=P′(s)estL[te^{st}] = P'(s)e^{st}, so g=Cestg = Ce^{st} has yp=CP′(s)testy_p = \dfrac{C}{P'(s)}te^{st}. For y′′−4y=e2ty'' - 4y = e^{2t}, P′(2)=4P'(2) = 4 and yp=14te2ty_p = \tfrac14te^{2t}. For a double root, L[t2est]=(Pt2+2P′t+2a)estL[t^2e^{st}] = (Pt^2 + 2P't + 2a)e^{st}, leaving yp=C2at2esty_p = \dfrac{C}{2a}t^2e^{st}: for y′′+6y′+9y=4e−3ty'' + 6y' + 9y = 4e^{-3t}, yp=2t2e−3ty_p = 2t^2e^{-3t}. Block B checks both identities for general a,b,ca, b, c.

The rule: if the exponent is a root of PP of multiplicity mm, multiply the guess by tmt^m.

Polynomial. y′′+3y′=6ty'' + 3y' = 6t has c=0c = 0, so s=0s = 0 is a root and the degree-2 matrix has zero diagonal and rank 2 (block A): LL sends 1,t,t21, t, t^2 to 0,3,2+6t0, 3, 2 + 6t. Guess t(At+B)t(At + B): L=6At+(2A+3B)L = 6At + (2A + 3B), so A=1A = 1, B=−23B = -\tfrac23 and yp=t2−23ty_p = t^2 - \tfrac23t. A constant in the guess would just be a free parameter, since constants are in the kernel.

Sinusoid, by complex exponentials. y′′+9y=cos⁡3ty'' + 9y = \cos 3t has P(3i)=0P(3i) = 0, P′(3i)=6iP'(3i) = 6i:

yp=Re⁡te3it6i=t6Re⁡[−i(cos⁡3t+isin⁡3t)]=t6sin⁡3t.y_p = \operatorname{Re}\frac{te^{3it}}{6i} = \frac t6\operatorname{Re}\bigl[-i(\cos 3t + i\sin 3t)\bigr] = \frac t6\sin 3t .

The amplitude t/6t/6 grows without bound. It is the limit of the non-resonant gain 1/∣9−ω2∣1/|9 - \omega^2|, which is 0.20.2 at ω=2\omega = 2, 1.6949151.694915 at 2.92.9 and 16.69449116.694491 at 2.992.99 (block D).

Damped sinusoid. For y′′+2y′+2y=e−tcos⁡ty'' + 2y' + 2y = e^{-t}\cos t, the exponent s=−1+is = -1 + i is a root, P′(s)=2iP'(s) = 2i and yp=Re⁡test2i=12te−tsin⁡ty_p = \operatorname{Re}\dfrac{te^{st}}{2i} = \tfrac12te^{-t}\sin t. Everything decays, but the extra tt remains.

Initial conditions come last

The classic mistake is fitting c1,c2c_1, c_2 to y(0),y′(0)y(0), y'(0) with yhy_h alone, then adding ypy_p. The conditions constrain the sum, and ypy_p has its own starting values that yhy_h must make up for: find ypy_p, write yh+ypy_h + y_p, then impose the data on that.

Take example 1 with y(0)=3y(0) = 3, y′(0)=−1y'(0) = -1; yp(0)=2y_p(0) = 2 and yp′(0)=−3y_p'(0) = -3.

Wrong. Fit yhy_h to (3,−1)(3, -1): c1+c2=3c_1 + c_2 = 3 and −2c1−3c2=−1-2c_1 - 3c_2 = -1 give c1=8c_1 = 8, c2=−5c_2 = -5, so 8e−2t−5e−3t+2t2−3t+28e^{-2t} - 5e^{-3t} + 2t^2 - 3t + 2. But y(0)=5y(0) = 5 and y′(0)=−4y'(0) = -4.

Right. yhy_h must start from (3−2, −1+3)=(1,2)(3 - 2,\ -1 + 3) = (1, 2): c1+c2=1c_1 + c_2 = 1 and −2c1−3c2=2-2c_1 - 3c_2 = 2 give c2=−4c_2 = -4, c1=5c_1 = 5:

y=5e−2t−4e−3t+2t2−3t+2,y(0)=3, y′(0)=−1.y = 5e^{-2t} - 4e^{-3t} + 2t^2 - 3t + 2, \qquad y(0) = 3,\ y'(0) = -1 .

Block E judges with RK45: y(1)=1.477528y(1) = 1.477528 numerically, 1.4775281.477528 for the right answer and 1.8337471.833747 for the wrong one. On [0,6][0, 6] the right answer is within 1.80×10−101.80\times10^{-10} of RK45 and the wrong one is off by up to 2.00002.0000.

The gap y−ypy - y_p equals yhy_h: 1.01.0 at t=0t = 0, 0.4775280.477528 at t=1t = 1 and 3.066×10−53.066\times10^{-5} at t=6t = 6. That is why yhy_h is called the transient, but only if it decays: with b=0b = 0 it rings forever, and with c=0c = 0 it contains a constant.

Play with it

◆ Interactive Pick a forcing, change b, c and the initial data: watch y_h fade so the total y lands on y_p, and read the guess and its solved coefficients

Loading simulation…

The default is y′′+2y′+2y=5cos⁡2ty'' + 2y' + 2y = 5\cos 2t with y(0)=1y(0) = 1, y′(0)=0y'(0) = 0; the readout prints A=−0.5A = -0.5, B=1B = 1, the gain GG, and the start values y(0)−yp(0)y(0) - y_p(0) and y′(0)−yp′(0)y'(0) - y_p'(0) for yhy_h. Tick “WRONG answer” to draw the curve from fitting yhy_h alone. The bottom-right plot is log⁡10∣y−yp∣\log_{10}|y - y_p|, a straight line down for a clean decay. The four RESONANCE presets explain why the plain guess is singular and multiply it by tt. Every setting prints two self-checks: the largest residual ∣yp′′+byp′+cyp−g∣|y_p'' + by_p' + cy_p - g| and the gap to an RK4 integration of the ODE.

Where the method stops

Everything rested on the forcing living in a finite-dimensional family closed under differentiation: sums of terms tkestt^ke^{st} (a standard fact, from memory), such as polynomials, exponentials, sines, cosines and their finite products. cosh⁡3t\cosh 3t and cos⁡2t\cos^2t qualify after rewriting.

tan⁡t\tan t does not. Its derivatives are 1+tan⁡2t1 + \tan^2t, then 2tan⁡t+2tan⁡3t2\tan t + 2\tan^3t, each raising the power of tan⁡t\tan t by one (block F prints the degrees 1,2,3,4,51, 2, 3, 4, 5), so the family never closes. A concrete failure: y′′+y=1/ty'' + y = 1/t. Since L[t−m]=m(m+1)t−m−2+t−mL[t^{-m}] = m(m + 1)t^{-m-2} + t^{-m}, A0t−1A_0t^{-1} with A0=1A_0 = 1 matches 1/t1/t but leaves 2t−32t^{-3}; A1=−2A_1 = -2 cancels it but leaves −24t−5-24t^{-5}; A2=24A_2 = 24 and so on. The coefficients are (−1)k(2k)!(-1)^k(2k)!: 1,−2,24,−720,40320,−36288001, -2, 24, -720, 40320, -3628800. The term sizes ∣Ak∣/t2k+1|A_k|/t^{2k+1} at t=5t = 5 are 0.20.2, 0.0160.016, 0.007680.00768, 0.0092160.009216, 0.0206440.020644, 0.0743180.074318: they shrink, then grow, so the series diverges and no finite guess exists. Variation of parameters (next lesson) handles it. The method also needs constant coefficients, because the matrices came from P(s)P(s).

Lab

Blocks: A matrices, B identities, C residuals, D shortcut, E initial conditions, F limits, G problems.

🐍 PythonLab: the guess as a linear solve, sympy residuals, the transfer function, initial conditions, RK45
⌘/Ctrl + Enter

Exercise: the guess as a matrix, with sympy and RK45 as referees

Implement poly_matrix (the matrix of LL on 1,t,…,tn1, t, \dots, t^n), poly_particular (solve it), residual (a sympy check), start_values (the data yhy_h must start from) and rk45_gap (the largest distance between a closed form and RK45).

🧪 Coding exerciseExercise: undetermined coefficients as a linear solve, verified by sympy and RK45
⌘/Ctrl + Enter

Problems

✏️ Pen & paperA ramp, then initial conditions●○○

Solve y′′+7y′+12y=24t+38y'' + 7y' + 12y = 24t + 38, y(0)=0y(0) = 0, y′(0)=1y'(0) = 1. What does yy look like for large tt?

Show worked solution

P=(r+3)(r+4)P = (r + 3)(r + 4), so yh=c1e−3t+c2e−4ty_h = c_1e^{-3t} + c_2e^{-4t}. Since P(0)=12≠0P(0) = 12 \neq 0, guess At+BAt + B: L=12At+7A+12BL = 12At + 7A + 12B, so A=2A = 2 and B=2B = 2: yp=2t+2y_p = 2t + 2. Then yhy_h starts from (0−2, 1−2)=(−2,−1)(0 - 2,\ 1 - 2) = (-2, -1): c1+c2=−2c_1 + c_2 = -2 and −3c1−4c2=−1-3c_1 - 4c_2 = -1 give c2=7c_2 = 7, c1=−9c_1 = -9:

y=−9e−3t+7e−4t+2t+2.y = -9e^{-3t} + 7e^{-4t} + 2t + 2 .

Check: y(0)=0y(0) = 0, y′(0)=27−28+2=1y'(0) = 27 - 28 + 2 = 1. For large tt the exponentials die and y→2t+2y \to 2t + 2; at t=2t = 2 the gap is −0.019961-0.019961 (block G).

✏️ Pen & paperTwo forcings, one of them resonant●●○

Solve y′′−3y′+2y=6e3t+2ety'' - 3y' + 2y = 6e^{3t} + 2e^{t} with y(0)=1y(0) = 1, y′(0)=4y'(0) = 4.

Show worked solution

P=(r−1)(r−2)P = (r - 1)(r - 2), so yh=c1et+c2e2ty_h = c_1e^t + c_2e^{2t}. For 6e3t6e^{3t}: P(3)=2P(3) = 2, so yp1=3e3ty_{p1} = 3e^{3t}. For 2et2e^t the exponent 11 is a simple root, so yp2=2P′(1)tet=−2tety_{p2} = \dfrac{2}{P'(1)}te^t = -2te^t since P′(r)=2r−3P'(r) = 2r - 3 gives P′(1)=−1P'(1) = -1. So yp=3e3t−2tety_p = 3e^{3t} - 2te^t, with yp(0)=3y_p(0) = 3 and yp′(0)=9−2=7y_p'(0) = 9 - 2 = 7. Then yhy_h starts from (−2,−3)(-2, -3): c1+c2=−2c_1 + c_2 = -2 and c1+2c2=−3c_1 + 2c_2 = -3 give c2=−1c_2 = -1, c1=−1c_1 = -1:

y=−et−e2t+3e3t−2tet.y = -e^t - e^{2t} + 3e^{3t} - 2te^t .

Check: y(0)=1y(0) = 1 and y′(0)=−1−2+9−2=4y'(0) = -1 - 2 + 9 - 2 = 4 (block G).

✏️ Pen & paperAmplitude, phase and the length of the transient●●●

For y′′+2y′+17y=50cos⁡3ty'' + 2y' + 17y = 50\cos 3t, y(0)=y′(0)=0y(0) = y'(0) = 0: (a) use G=1/P(iω)G = 1/P(i\omega) to find ypy_p, its amplitude and phase lag; (b) solve the IVP; (c) bound the transient by an envelope and find when it is 1%1\% of the steady amplitude.

Show worked solution

(a) P(3i)=−9+6i+17=8+6iP(3i) = -9 + 6i + 17 = 8 + 6i, ∣P∣=10|P| = 10, φ=0.643501\varphi = 0.643501 rad. The amplitude is 50/10=550/10 = 5, and 50/(8+6i)=4−3i50/(8 + 6i) = 4 - 3i gives yp=4cos⁡3t+3sin⁡3t=5cos⁡(3t−0.643501)y_p = 4\cos 3t + 3\sin 3t = 5\cos(3t - 0.643501).

(b) The roots are −1±4i-1 \pm 4i. yp(0)=4y_p(0) = 4 and yp′(0)=9y_p'(0) = 9, so yh(0)=−4y_h(0) = -4, yh′(0)=−9y_h'(0) = -9. With yh=e−t(c1cos⁡4t+c2sin⁡4t)y_h = e^{-t}(c_1\cos 4t + c_2\sin 4t): c1=−4c_1 = -4 and −c1+4c2=−9-c_1 + 4c_2 = -9, so c2=−3.25c_2 = -3.25:

y=e−t(−4cos⁡4t−3.25sin⁡4t)+4cos⁡3t+3sin⁡3t.y = e^{-t}(-4\cos 4t - 3.25\sin 4t) + 4\cos 3t + 3\sin 3t .

Check: y(0)=0y(0) = 0 and y′(0)=4−13+9=0y'(0) = 4 - 13 + 9 = 0.

(c) ∣y−yp∣=∣yh∣≤16+10.5625 e−t=5.153882e−t|y - y_p| = |y_h| \leq \sqrt{16 + 10.5625}\,e^{-t} = 5.153882e^{-t}. This equals 0.050.05 at t=ln⁡(5.153882/0.05)=4.635482t = \ln(5.153882/0.05) = 4.635482 (block G).

✅ Concept check

For $y'' + 5y' + 6y = 7e^{-3t}$ (roots of $P$: $-2$ and $-3$), which is the smallest correct form of the guess?

✅ Concept check

With $y_p = \sin 3t + 2$ and initial data $y(0) = 0$, $y'(0) = 1$, what must $y_h'(0)$ be? Give a number.

✅ Concept check

Which forcing can NOT be handled by undetermined coefficients with any finite guess?

Key Takeaways

  • Every solution of L[y]=gL[y] = g is yh+ypy_h + y_p: a particular solution plus the kernel, like Ax⃗=b⃗A\vec x = \vec b. Any ypy_p will do.
  • The guess works because the forcing’s family is closed under differentiation, so LL is a small matrix there: triangular with cc or P(s)P(s) on the diagonal, or with determinant ∣P(iω)∣2|P(i\omega)|^2 for cos⁡\cos and sin⁡\sin. The coefficients are the unknowns of a linear solve.
  • Guess the full family (all powers; both cos⁡\cos and sin⁡\sin); split sums of forcings.
  • If the exponent is a root of PP of multiplicity mm, the matrix is singular; multiply the guess by tmt^m, because L[test]=(P(s)t+P′(s))estL[te^{st}] = (P(s)t + P'(s))e^{st}.
  • For Fcos⁡ωtF\cos\omega t: yp=(F/∣P(iω)∣)cos⁡(ωt−φ)y_p = (F/|P(i\omega)|)\cos(\omega t - \varphi), φ=arg⁡P(iω)\varphi = \arg P(i\omega); G=1/P(iω)G = 1/P(i\omega) is the transfer function.
  • Apply initial conditions to yh+ypy_h + y_p: yhy_h starts from (y(0)−yp(0), y′(0)−yp′(0))(y(0) - y_p(0),\ y'(0) - y_p'(0)). y−yp=yhy - y_p = y_h fades only if yhy_h decays.
  • The method needs constant coefficients and forcing made of tkestt^ke^{st} terms; tan⁡t\tan t, 1/t1/t and ln⁡t\ln t need variation of parameters.
Finished this lesson?

Mark it complete to track your progress (saved in this browser). Reading every section does this for you.

Where this leads

These later lessons build directly on this one: