Mathwords logoMathwords

Nonhomogeneous Linear Second Order Equations — Formula & Example

A nonhomogeneous linear second order equation is a second order linear differential equation with a nonzero forcing term on the right side, such as y′′+y=cos⁡xy'' + y = \cos x. You solve it by adding the general solution of the matching homogeneous equation to any one solution of the full equation.

An equation of the form a(x) y′′+b(x) y′+c(x) y=g(x)a(x)\,y'' + b(x)\,y' + c(x)\,y = g(x), where g(x)g(x) is not identically zero. On any interval where a,b,c,ga, b, c, g are continuous and a(x)≠0a(x) \neq 0, every solution has the form y=yh+ypy = y_h + y_p. Here yh=C1y1+C2y2y_h = C_1y_1 + C_2y_2 is the general solution of the associated homogeneous equation (with g=0g = 0), and ypy_p is any single particular solution.

Key Formula

y′′+p(x) y′+q(x) y=g(x),y=C1y1+C2y2+ypyp=−y1∫y2 gW dx+y2∫y1 gW dx,W=y1y2′−y1′y2\begin{gathered} y'' + p(x)\,y' + q(x)\,y = g(x), \qquad y = C_1y_1 + C_2y_2 + y_p \\ y_p = -y_1\int \frac{y_2\,g}{W}\,dx + y_2\int \frac{y_1\,g}{W}\,dx, \qquad W = y_1y_2' - y_1'y_2 \end{gathered}
Where:
  • g(x)g(x) = Forcing term. It must be nonzero for the equation to be nonhomogeneous.
  • y1,y2y_1, y_2 = Two independent solutions of the homogeneous equation with g = 0
  • ypy_p = One particular solution of the full equation (second line: variation of parameters)
  • WW = Wronskian of y1y_1 and y2y_2. It is nonzero because the two solutions are independent.
  • C1,C2C_1, C_2 = Arbitrary constants fixed by initial or boundary conditions

Worked Example

Problem: Find the general solution of y′′+y′−2y=4xy'' + y' - 2y = 4x.
Step 1: Solve the associated homogeneous equation y′′+y′−2y=0y'' + y' - 2y = 0. Its characteristic equation factors, giving roots r=1r = 1 and r=−2r = -2.
r2+r−2=(r−1)(r+2)=0  ⟹  yh=C1ex+C2e−2xr^2 + r - 2 = (r - 1)(r + 2) = 0 \implies y_h = C_1e^{x} + C_2e^{-2x}
Step 2: Find a particular solution. The forcing term 4x4x is a degree-1 polynomial, and no polynomial solves the homogeneous equation. So guess yp=Ax+By_p = Ax + B. Then yp′=Ay_p' = A and yp′′=0y_p'' = 0. Substitute and match coefficients. Variation of parameters, with W=−3e−xW = -3e^{-x}, gives the same ypy_p.
0+A−2(Ax+B)=4x  ⟹  −2A=4,  A−2B=0  ⟹  A=−2,  B=−10 + A - 2(Ax + B) = 4x \implies -2A = 4,\; A - 2B = 0 \implies A = -2,\; B = -1
Step 3: Add the two pieces. Check the particular solution: 0+(−2)−2(−2x−1)=4x0 + (-2) - 2(-2x - 1) = 4x.
y=yh+yp=C1ex+C2e−2x−2x−1y = y_h + y_p = C_1e^{x} + C_2e^{-2x} - 2x - 1
Answer: y=C1ex+C2e−2x−2x−1y = C_1e^{x} + C_2e^{-2x} - 2x - 1, where C1C_1 and C2C_2 are arbitrary constants.

Why It Matters

Forced vibrations are modeled by my′′+cy′+ky=F(t)my'' + cy' + ky = F(t). Examples include a car suspension driven by a bumpy road, or an RLC circuit driven by an AC voltage. In these models with damping (c>0c > 0), yhy_h is the transient response that dies out, and ypy_p is the steady-state response. The steady-state response is how engineers predict resonance.

Common Mistakes

Mistake: Guessing a particular solution that already solves the homogeneous equation. For example, someone tries yp=Aexy_p = Ae^{x} for y′′+y′−2y=6exy'' + y' - 2y = 6e^{x}.
Correction: That guess makes the left side equal 00, so no value of AA works. Multiply the guess by xx and use yp=Axexy_p = Axe^{x}, which gives 3Aex=6ex3Ae^{x} = 6e^{x}, so A=2A = 2. If that still overlaps a homogeneous solution, multiply by xx again. Variation of parameters avoids this issue entirely.

Related Terms