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 to 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.

Since \(x_1\) and \(x_2\) are solutions of (4.2.1), we know that

\begin{align*} x_1'' +p(t) x_1' + q(t) x_1 & = g(t)\\ x_2'' +p(t) x_2' + q(t) x_2 & = g(t). \end{align*}


\begin{gather*} \frac{d^2}{dt^2} (x_1 - x_2) + p(t) \frac{d}{dt} (x_1 - x_2) + q(t) (x_1 - x_2)\\ = \left( \frac{d^2 x_1}{dt^2} + p(t) \frac{dx_1}{dt} + q(t) x_1 \right) - \left( \frac{d^2 x_2}{dt^2} + p(t) \frac{dx_2}{dt} + q(t) x_2 \right)\\ = g(t) - g(t) = 0. \end{gather*}

We can use Theorem 4.2.1 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.2.2} \end{equation}

can be written in the form

\begin{equation*} x = x_h + x_p, \end{equation*}

where \(x_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.2.2). Indeed, suppose that \(x_q\) is another solution to (4.2.2). Then \(x_q - x_p\) is a solution to the homogeneous equation

\begin{equation*} x'' +p(t) x' + q(t) x = 0. \end{equation*}


\begin{equation*} x_q - x_p =x_h \end{equation*}


\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.2.3} \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*}


\begin{equation*} x_h = c_1 e^{-t} + c_2 e^{-4t}. \end{equation*}

A particular solution to (4.2.3) 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.2.5).

Figure4.2.5Solutions 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.2.4} \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.2.4). 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.2.4), 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.2.7).

Figure4.2.7Solutions 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*}


\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.2.9.

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

As a final example, consider the equation

\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 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.2.11.

Figure4.2.11Solutions 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.2.12. 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.2.12Particular 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*}


Finding Particular Solutions

Find a particular solution for each equation in Exercise Group 1–8.


\(y'' - 2y' - 3y = 3 e^{2t}\)


\(y'' - y' - 2y = 4x^2\)


\(\dfrac{d^2x}{dx^2} - 6 \dfrac{dx}{dt} + 25 x = 64e^{-t}\)


\(y'' + 16y = 2 \sin 2t\)


\(y'' + 16y = 2 \sin 4t\)


\(y'' + 2y' + y = 2e^{-t}\)


\(y'' + 6y' + 8y = \cos 3t\)


\(u'' + \omega_0^2 y = \cos \omega t\text{,}\) \(\omega^2 \neq \omega_0^2\)

Finding General Solutions

Find the general solution for each equation in Exercise Group 9–16.


\(y'' - 2y' - 3y = 3 e^{2t}\)


\(y'' - y' - 2y = 4x^2\)


\(\dfrac{d^2x}{dx^2} - 6 \dfrac{dx}{dt} + 25 x = 64e^{-t}\)


\(y'' + 16y = 2 \sin 2t\)


\(y'' + 16y = 2 \sin 4t\)


\(y'' + 2y' + y = 2e^{-t}\)


\(y'' + 6y' + 8y = \cos 3t\)


\(u'' + \omega_0^2 y = \cos \omega t\text{,}\) \(\omega^2 \neq \omega_0^2\)

Solving Initial Value Problems

Solve the initial problems in Exercise Group 17–24.


\(y'' - 2y' - 3y = 3 e^{2t}\text{,}\) \(y(0) = 1\text{,}\) \(y'(0) = 0\)


\(y'' - y' - 2y = 4x^2\text{,}\) \(y(0) = -1\text{,}\) \(y'(0) = 1\)


\(\dfrac{d^2x}{dx^2} - 6 \dfrac{dx}{dt} + 25 x = 64e^{-t}\text{,}\) \(x(0) = 1\text{,}\) \(x'(0) = -2\)


\(y'' + 16y = 2 \sin 2t\text{,}\) \(y(0) = 1\text{,}\) \(y'(0) = 0\)


\(y'' + 16y = 2 \sin 4t\text{,}\) \(y(0) = 1\text{,}\) \(y'(0) = 0\)


\(y'' + 2y' + y = 2e^{-t}\text{,}\) \(y(0) = -1\text{,}\) \(y'(0) = 3\)


\(y'' + 6y' + 8y = \cos 3t\text{,}\) \(y(0) = -2\text{,}\) \(y'(0) = 1\)


\(u'' + \omega_0^2 y = \cos \omega t\text{,}\) \(\omega^2 \neq \omega_0^2\text{,}\) \(u(0) = 1\text{,}\) \(u'(0) = -1\)


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{.}\)


Suppose that that \(f(t)\) and \(g(t)\) are linearly dependent on an interval \(I = (a, b)\text{.}\) Then one function is a multiple of the other, say \(f(t) = c g(t)\text{.}\) Thus, \(f'(t) = cg'(t)\text{.}\)

\begin{equation*} W(f, g)(t) = \det \begin{pmatrix} f(t) & g(t) \\ f'(t) & g'(t) \end{pmatrix} = f(t) g'(t) - f'(t) g(t) = c g(t) g'(t) - cg'(t) g(t) = 0. \end{equation*}

Conversely, suppose that

\begin{equation*} W(f, g)(t) = \det \begin{pmatrix} f(t) & g(t) \\ f'(t) & g'(t) \end{pmatrix} = 0, \end{equation*}

for all \(t\) in \((a, b)\text{.}\) If \(g = 0\text{,}\) then \(0 f = g\) and the two functions are linearly dependent. Assume that \(g(t_0) \neq 0\) for some \(t_0\) in \((a, b)\text{.}\) Since \(g\) is differentiable, it must also be continuous and there is some interval \((c, d)\) contained in \((a, b)\) such that \(t_0 \in (c, d)\) and \(g\) does not vanish on this interval. Therefore,

\begin{equation*} \frac{d}{dt} \left( \frac{f}{g} \right) = \frac{f' g - f g'}{g^2} = - \frac{W(f,g)}{g^2} = 0, \end{equation*}

and \(f/g\) is constant on the interval \((c, d)\text{.}\) Thus, \(f(t_0) = c g(t_0)\) and \(f(t'_0) = c g'(t_0)\text{.}\) Since \(f\) and \(cg\) are both solutions to the differential equation \(y'' + p y' + q y = 0\) and have the same initial condition, \(f(t) = cg(t)\) for all \(t \in (a, b)\) by the existence and uniqueness theorem. Consequently, \(f\) and \(g\) are linearly dependent.


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.
  1. We can rewrite \(2 t^2 y'' + 3ty' - y = 0\) as
    \begin{equation*} y'' + \frac{3}{2t} y' - \frac{1}{2t^2} y = 0. \end{equation*}
    Since \(p(t) = 1/2t\text{,}\) Abel's Theorem tells us that
    \begin{equation*} W[y_1, y_2](t) = c \exp\left( - \int \frac{3}{2t} \, dt \right) = c \exp\left( - \frac{3}{2} \ln t \right) = ct^{-3/2}. \end{equation*}
  2. Since \(y_1\) and \(y_2\) are solutions to our differential equation, we know that
    \begin{gather*} y_1'' + p(t) y_1' + q(t) y_1 = 0\\ y_2'' + p(t) y_2' + q(t) y_2 = 0. \end{gather*}
    Multiplying the first equation by \(y_2\) and the second equation by \(y_1\) and subtracting, we obtain
    \begin{equation} (y_1 y_2'' - y_1'' y_2) + p(t) (y_1 y_2' - y_1' y_2) = 0.\label{equation-exercise-secondorder02-abel-hint}\tag{4.2.5} \end{equation}
    \begin{equation*} W(t) = W(y_1, y_2)(t) = y_1 y_2' - y_1' y_2, \end{equation*}
    \begin{equation*} W' = y_1 y_2'' - y_1'' y_2, \end{equation*}
    and equation (4.2.5) becomes
    \begin{equation*} W'' + p(t) W = 0. \end{equation*}
    This equation is separable with solution
    \begin{equation*} W(t) = c \exp\left( - \int p(t) \, dt \right), \end{equation*}

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.2.6} \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.2.6) has the form
    \begin{equation*} y_p(t) = u_1(t) y_1(t) + u_2(t) y_2(t), \end{equation*}
    \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.2.6) 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.2.6) 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*}
  1. If \(y_p = u_1y_1 + u_2 y_2\text{,}\) then
    \begin{gather*} y_p' = u_1' y_1 + u_1 y_1' + u_2' y_2 + u_2 y_2' = u_1 y_1' + u_2 y_2'\\ y_p'' = u_1' y_1' + u_1 y_1'' + u_2' y_2' + u_2 y_2''. \end{gather*}
    Substituting these expressions into equation (4.2.6), we have
    \begin{align*} y_p'' + p y_p' + q y_p & = ( u_1' y_1' + u_1 y_1'' + u_2' y_2' + u_2 y_2'') + p(u_1 y_1' + u_2 y_2')\\ & + q(u_1y_1 + u_2 y_2)\\ & = u_1[y_1'' + p y_1' +q y_1] + u_2[y_2'' + p y_2' +q y_2] + u_1' y_1' + u_2' y_2'\\ & = u_1' y_1' + u_2' y_2'\\ & = f(t). \end{align*}
  2. If we solve the system
    \begin{align*} u_1'(t) y_1(t) + u_2'(t) y_2(t) & = 0\\ u_1'(t) y_1' (t)+ u_2'(t) y_2'(t) & = f(t). \end{align*}
    for \(u_1'\) and \(u_2'\text{,}\) we obtain
    \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*}
  3. Integrate the two equations from part (2).
  4. The general solution to the homogeneous equation \(y'' + 4y = 0\) is
    \begin{equation*} y_h = c_1 \cos 2t + c_2 \sin 2t. \end{equation*}
    To find a particular solution, assume that the solution has the form
    \begin{equation*} y_p = u_1(t) \cos 2t + u_2(t) \sin 2t. \end{equation*}
    By part (2)
    \begin{align*} u_1'(t) & = -3 \cos t\\ u_2'(t) & = \frac{3}{2} \csc t - 3 \sin t. \end{align*}
    Integrating, we obtain
    \begin{align*} u_1(t) & = -3 \sin t\\ u_2(t) & = \frac{3}{2} \ln| \csc t - \cot t| + 3 \cos t. \end{align*}
    \begin{align*} y_p(t) & = u_1(t) y_1(t) + u_2(t) y_2(t)\\ & = -3 \sin t \cos 2t + \left[\frac{3}{2} \ln| \csc t - \cot t| + 3 \cos t\right] \sin 2t, \end{align*}
    and the general solution is
    \begin{align*} y & = y_h + y_p\\ & = c_1 \cos 2t + c_2 \sin 2t -3 \sin t \cos 2t + \left[\frac{3}{2} \ln| \csc t - \cot t| + 3 \cos t\right] \sin 2t. \end{align*}