Skip to main content
\(\newcommand{\trace}{\operatorname{tr}} \newcommand{\real}{\operatorname{Re}} \newcommand{\imaginary}{\operatorname{Im}} \newcommand{\lt}{<} \newcommand{\gt}{>} \newcommand{\amp}{&} \)


Harmonic oscillators such as a spring-mass system (Subsection 1.1.3) or an RLC circuit (Section 4.1) can be modeled with second-order linear differential equations. Indeed, we can model a spring-mass system with the equation \begin{equation*} mx''(t) + b x'(t) +k x(t) = g(t), \end{equation*} where \(m\) is the mass, \(b\) is the damping coefficient, \(k\) is the spring constant, and \(F(t) = g(t)\) represents some external force applied to our system. RLC circuits can also be modeled with provide another example of forcing. If \(I(t)\) is the rate at which a charge flows through a circuit (measured in amperes or amps), \(R\) is the resistance (measured in ohms), \(C\) is the capacitance (measured in farads), and the inductance, \(L\text{,}\) is (measured in henrys), then the derivative of the impressed voltage (measured in volts), \(E(t)\text{,}\) is the forcing term \begin{equation*} L I'' + RI' + \frac{1}{C} I = E'(t). \end{equation*} What is different about these two equations are the terms on the righthand side, \(g(t)\) and \(E'(t)\text{.}\) Such a term is called a forcing term.

Subsection4.2.1Nonhomogeneous Equations

A nonhomogeneous second-order linear differential equation is an equation of the form \begin{equation*} x'' +p(t) x' + q(t) x = g(t). \end{equation*} We have already seen how examples of such equations arise when examining models of harmonic oscillators with forcing terms. Our goal is to be able to solve such equations. In general, these equations can be difficult to solve for an arbitrary function \(g(t)\text{.}\) Before we attempt to find solutions for some of the more common functions that might occur for \(g(t)\text{,}\) let us derive some fundamental facts about second-order linear differential equations.

We can use Theorem 4.5 to derive the fact that the general solution to \begin{equation} x'' +p(t) x' + q(t) x = g(t).\label{equation-secondorder02-nonhomogeneous}\tag{4.9} \end{equation} can be written in the form \begin{equation*} x = x_h + x_p, \end{equation*} where \(y_h\) is the general solution of the homogeneous equation \begin{equation*} x'' +p(t) x' + q(t) x = 0, \end{equation*} and \(x_p\) is any solution of (4.9). Indeed, suppose that \(x_q\) is another solution to (4.9). Then \(x_q - x_p\) is a solution to the homogeneous equation \begin{equation*} x'' +p(t) x' + q(t) x = 0. \end{equation*} Therefore, \begin{equation*} x_q - x_p =x_h \end{equation*} or \begin{equation*} x_q =x_h + x_p. \end{equation*} We state this fact in the following theorem.

Subsection4.2.2Forcing Terms

The equation \begin{equation*} m x'' + bx' + kx = g(t) \end{equation*} can be used to model a harmonic oscillator where forcing occurs. In general, we will not be able to solve this equation explicitly for a given \(g(t)\text{;}\) however, certain forcing functions often occur in practice. Some of the more important forcing functions are \(g(t) = e^{-at}\text{,}\) where the external force decreases exponentially over time; \(g(t) = k\text{,}\) where a constant force is applied; and \(g(t) = \cos \omega t\) or \(g(t) = \sin \omega t\text{,}\) where a force is applied periodically.

In the case of the unforced damped harmonic oscillator, \begin{equation*} m x'' + b x' + kx =0, \end{equation*} we know that \(m \gt 0\text{,}\) \(b \gt 0\text{,}\) and \(k \gt 0\text{.}\) Thus, we can rewrite this equation as \begin{equation*} x'' + px' + q x = 0, \end{equation*} where \(p = b/m\) and \(q = k/m\) are both positive. As a first-order linear system, the harmonic oscillator is \begin{align*} x' & = y\\ y' & = - qx -py. \end{align*} The matrix corresponding to this system, \begin{equation*} A = \begin{pmatrix} 0 & 1 \\ -q & -p \end{pmatrix}, \end{equation*} has trace of \(-p\) and determinant \(q\text{.}\) Since \(\trace(A) \lt 0\) and \(\det(A) \gt 0\text{,}\) we know that any solution of the unforced equation tends toward the origin as \(t \to \infty\text{.}\) That is, the solution is a sink. This leads us to the following conclusion.

In other words, all solutions of a damped harmonic oscillator with nonzero damping are essentially the same for large values of \(t\text{.}\)

Subsection4.2.3The Method of Undetermined Coefficients


Let us solve the differential equation \begin{equation} x'' + 5x' + 4x = 1,\label{equation-secondorder02-damped-oscillator}\tag{4.10} \end{equation} a harmonic oscillator with a constant forcing function. It is easy to check that the general solution to the homogeneous equation \begin{equation*} x'' + 5x' + 4x = 0 \end{equation*} is \begin{equation*} x_h = c_1 e^{-t} + c_2 e^{-4t}. \end{equation*} A particular solution to (4.10) is given by \(x_p = 1/4\text{.}\) Thus, the general solution is \begin{equation*} x(t) = c_1 e^{-t} + c_2 e^{-4t} + \frac{1}{4}. \end{equation*} As \(t \to \infty\text{,}\) all solutions approach the constant solution \(x = 1/4\) (Figure 4.9).

Figure4.9Solutions to \(x'' + 5x' + 4x = 1\)

Now let us consider a more complicated example. Suppose that we wish to solve \begin{equation} x'' + 5x' + 4x = e^{-2t}.\label{equation-secondorder02-exponential-forcing-1}\tag{4.11} \end{equation} This is the equation of a harmonic oscillator with a forcing function that decreases exponentially with time. We already know the solution to the homogeneous equation. We will use the method of undetermined coefficients to find a particular solution to (4.11). It is reasonable to guess that a particular solution will have the form \begin{equation*} x_p = Ae^{-2t}. \end{equation*} Substituting this expression into (4.11), we find that \begin{equation*} e^{-2t}= x_p'' + 5 x_p' + 4x_p = 4 A e^{-2t} - 10 A e^{-2t} + 4 Ae^{-2t} = -2 A e^{-2t}. \end{equation*} Hence, \(A = -1/2\text{.}\) Therefore, the solution that we seek is \begin{equation*} x = c_1 e^{-t} + c_2 e^{-4t} - \frac{1}{2} e^{-2t}. \end{equation*} Again, all solutions approach zero as \(t \to \infty\) (Figure 4.11).

Figure4.11Solutions to \(x'' + 5x' + 4x = e^{-2t}\)

Now let us examine what happens if we have a periodic forcing function. Let us assume that the particular solution to the equation \begin{equation*} x'' + 5x' + 4x = 2 \cos t. \end{equation*} takes the form \begin{equation*} x_p = A \cos t + B \sin t. \end{equation*} Then \begin{align*} x_p' & = -A \sin t + B \cos t\\ x_p'' & = -A \cos t - B \sin t. \end{align*} Substituting these expressions into the differential equation, we see that \begin{align*} 2 \cos t & = x_p'' + 5 x_p' + 4 x_p\\ & = (-A \cos t - B \sin t) + 5(-A \sin t + B \cos t) + 4(A \cos t + B \sin t)\\ & = (3A + 5B) \cos t +(-5A + 3B) \sin t. \end{align*} We must solve the following system of equations to find a particular solution: \begin{align*} 3A + 5B & = 2\\ -5A + 3B & = 0. \end{align*} The solution of this system is \(A = 3/17\) and \(B = 5/17\text{.}\) Consequently, \begin{equation*} x_p = \frac{3}{17} \cos t + \frac{5}{17} \sin t \end{equation*} is a particular solution to \(x'' +5x' + 4x = 2 \cos t\text{.}\) The general solution to our equation is \begin{equation*} x = c_1 e^{-t} + c_2 e^{-4t} + \frac{3}{17} \cos t + \frac{5}{17} \sin t. \end{equation*} The solutions to this equation are given in Figure 4.13.

Figure4.13Solutions to \(x'' + 5x' + 4x = 2 \cos t\)

As a final example, consider the \begin{equation*} x'' + 5x' + 4x = e^{-t}. \end{equation*} Recall that the solution to the homogeneous equation \(x'' + 5x' + 4x = 0\) is \begin{equation*} x_h = c_1 e^{-t} + c_2 e^{-4t}. \end{equation*} Our guess of \(x_p(t) = A e^{-t}\) for a particular solution will no longer work since \(e^{-t}\) is a solution to the homogeneous equation. We must therefore consider a function of a different form. Such a function must yield a multiple of \(e^{-t}\) when differentiated. The simplest such function is of the form \begin{equation*} x_p = A t e^{-t}. \end{equation*} Using this guess, \begin{align*} e^{-t} & = \frac{d^2}{dt^2} Ate^{-t} + 5 \frac{d}{dt} Ate^{-t} + 4A te^{-t}\\ & = A(- e^{-t} - e^{-t} + t e^{-t}) + 5A(e^{-t} - t e^{-t} ) + 4 A te^{-t}\\ & = 3A t e^{-t}. \end{align*} Thus, \(A = 1/3\) and our general solution is \begin{equation*} x = c_1 e^{-t} + c_2 e^{-4t} + \frac{1}{3} t e^{-t}. \end{equation*} Solutions to the differential equation \(x'' + 5x' + 4x = e^{-t}\) are given in Figure 4.15.

Figure4.15Solutions to \(x'' + 5x' + 4x = e^{-t}\)

Subsection4.2.4A Strategy

We outline a general strategy for choosing \(x_p\) for the Method of Undetermined Coefficients in Table 4.16. Here \(s = 0, 1, 2\) is the smallest integer that will ensure that no term in \(x_p\) is a solution of the corresponding homogeneous equation.

\(g(t)\) \(x_p\)
\(P_n(t) = a_nt^n + \cdots + a_1 t + a_0\) \(t^s(A_nt^n + \cdots + A_1 t + A_0)\)
\(P_n(t) e^{\alpha t}\) \(t^s(A_nt^n + \cdots + A_1 t + A_0) e^{\alpha t}\)
\(\displaystyle P_n(t) e^{\alpha t} \left\{\begin{array}{c} \sin \beta t \\ \cos \beta t \end{array}\right.\) \(t^se^{\alpha t}[(A_nt^n + \cdots + A_1 t + A_0) \cos \beta t \)
\(+ (B_n t^n + \cdots + B_1 t + B_0) \sin \beta t]\)
Table4.16Particular solutions of \(x'' + px' + qx = g(t)\text{.}\)

Subsection4.2.5Important Lessons

  • A nonhomogeneous second-order linear differential equation is an equation of the form \begin{equation*} x'' + p(t) x' + q(t) x = g(t). \end{equation*} Forced harmonic oscillators and RLC circuits provide good examples of nonhomogeneous second-order linear differential equations.
  • Suppose that \begin{equation*} x'' +p(t) x' + q(t) x = g(t) \end{equation*} has solutions \(x_1 = x_1(t)\) and \(x_2 = x_2(t)\text{.}\) Then \(x_1(t) - x_2(t)\) is a solution of the homogeneous linear differential equation \begin{equation*} x'' +p(t) x' + q(t) x = 0. \end{equation*}
  • Let \(x_p\) be a particular solution of the equation \begin{equation*} x'' +p(t) x' + q(t) x = g(t), \end{equation*} and \(x_h\) be the general solution of the corresponding homogeneous equation \begin{equation*} x'' +p(t) x' + q(t) x = 0. \end{equation*} Then the general solution to \(x'' +p(t) x' + q(t) x = g(t)\) is \(x = x_h + x_p\text{.}\) In particular, if the solution to \(x'' +p(t) x' + q(t) x = 0\) has a sink at the origin, all solutions of the equation \(x'' +p(t) x' + q(t) x = g(t)\) approach \(x_p(t)\) as \(t \to \infty\text{.}\)
  • The Method of Undetermined Coefficients is useful for solving the equation \(x'' +p(t) x' + q(t) x = g(t)\text{,}\) when \(g\) is of the form \begin{equation*} g(t) = P_n(t) e^{\alpha t} \left\{\begin{array}{c} \sin \beta t \\ \cos \beta t \end{array}\right. \end{equation*}



Find the solution of the initial-value problem \begin{align*} y'' + 6y' + 8y & = \cos 3t\\ y(0) & = 0\\ y'(0) & = 0. \end{align*}


Compute the solution of the initial value problem \begin{gather*} y'' + 4y = 3 \cos 2t\\ y(0) = y'(0) = 0. \end{gather*}


Use the complex method to find a particular solution to \begin{equation*} y'' + 7y' + 10 y = - 4 \sin 3t. \end{equation*} Write your solution as a function of cosine. What is the amplitude, the period, and the frequency of your solution?


We define two functions, \(f(t)\) and \(g(t)\text{,}\) to be linearly independent on an open interval \(I = (a, b)\) if there do not exist nonzero constants \(c_1\) and \(c_2\) such that \begin{equation*} c_1 f(t) + c_2 g(t) = 0 \end{equation*} for all \(t \in I\text{.}\) Otherwise, \(f(t)\) and \(f(t)\) are linearly dependent. Suppose that \(f(t)\) and \(g(t)\) are solutions to the homogeneous linear equation \begin{equation*} y'' + p y' + q y = 0. \end{equation*} Show that \(f(t)\) and \(g(t)\) are linearly dependent on an interval \(I = (a, b)\) if and only if \(W[f, g](t) \equiv 0\text{.}\)


Abel's Theorem. If \(y_1\) and \(y_2\) are solutions of the homogeneous equation \begin{equation*} y'' + p(t) y' + q(t) y = 0, \end{equation*} where \(p\) and \(q\) are continuous on an open interval \(I = (a, b)\text{,}\) show that \begin{equation*} W[y_1, y_2](t) = c \exp\left( - \int p(t) \, dt \right), \end{equation*} for some constant \(c\) that depends on \(y_1\) and \(y_2\) but not on \(t\text{.}\)

  1. Use Abel's Theorem to find the Wronskian of \(2 t^2 y'' + 3ty' - y = 0\) up to a constant multiple, where \(t \gt 0\text{.}\)
  2. Prove Abel's Theorem.

The Method of Variation of Parameters. In this problem we will describe another method of finding a particular solution to a nonhomogeneous equation, \begin{equation} y'' + p(t) y' + q(t) y = f(t),\label{equation-exercise-secondorder02-variation-of-parameters}\tag{4.13} \end{equation} if we know know that the general solution to the homogeneous equation \(y'' + p(t) y' + q(t) y = 0\) is \begin{equation*} y_h = c_1 y_1 + c_2 y_2. \end{equation*}

  1. Assume that a particular solution of (4.13) has the form \begin{equation*} y_p(t) = u_1(t) y_1(t) + u_2(t) y_2(t), \end{equation*} where \begin{equation*} u_1'(t) y_1(t) + u_2'(t) y_2(t)=0. \end{equation*} Substitute \(y_p\) into the left-hand side of (4.13) to show that \begin{equation*} u_1'(t) y_1'(t) + u_2'(t) y_2'(t) = f(t). \end{equation*}
  2. Show that \begin{align*} u_1'(t) & = \frac{- y_2(t) f(t)}{W[y_1, y_2](t)}\\ u_2'(t) & = \frac{y_1(t) f(t)}{W[y_1, y_2](t)}, \end{align*} where \(W[y_1, y_2](t) = y_1(t) y_2'(t) - y_2(t) y_1'(t)\) is the Wronskian of \(y_1\) and \(y_2\text{.}\)
  3. If \(p\text{,}\) \(q\text{,}\) and \(f\) are continuous on an interval \(I\text{,}\) show that \begin{align*} u_1(t) & = - \int_{t_0}^t \frac{y_2(s) f(s)}{W[y_1, y_2](s)} \, ds\\ u_2(t) & = \int_{t_0}^t \frac{ y_1(s) f(s)}{W[y_1, y_2](s)} \, ds \end{align*} for any point \(t_0\) in \(I\text{.}\) Consequently, a particular solution to (4.13) is \begin{equation*} y_p = -y_1(t) \int_{t_0}^t \frac{ y_2(s) f(s)}{W[y_1, y_2](s)} \, ds + y_2(t) \int_{t_0}^t \frac{ y_1(s) f(s)}{W[y_1, y_2](s)} \, ds. \end{equation*}
  4. Find the general solution of the differential equation \begin{equation*} y'' + 4y = 3 \csc t. \end{equation*}