Skip to main content

Section 1.3 More Involved Examples

Subsection 1.3.1 Solve \(y'' + 2y' + 5y = \sin t\)

As with always, we begin by solving \(y'' + 2y' + 5y = 0\text{.}\) The general solution of this ODE is

\begin{gather*} y(t) = c_1e^{-t} \cos 2t + c_2 e^{-t} \sin 2t \end{gather*}

Set \(y = e^{rt}\) to obtain \(r^2 + 2r + 5 = 0\text{.}\) This holds when

\begin{gather*} r = \frac{-2 \pm \sqrt{4 - 4\cdot 5}}{2} = -1 \pm 2i. \end{gather*}

So, \(y = e^{(-1 + 2i)t}\) is a solution of \(y'' + 2y' + 5y = 0\text{.}\) Recall that if \(y(t)\) is a solution of a linear ODE, then so are \(\Re\{y(t)\}\) (real part of \(y\)) and \(\Im\{y(t)\}\) (imaginary part of \(y\)). Writing out \(e^{(-1 + 2i)t}\) shows that

\begin{gather*} e^{(-1 + 2i)t} = e^{-t} \cos 2t + ie^{-t} \sin 2t. \end{gather*}

Therefore, the general solution of \(y'' + 2y' + 5y = 0\) is

\begin{gather*} y(t) = c_1e^{-t} \cos 2t + c_2 e^{-t} \sin 2t. \end{gather*}

With the general solution of the homogeneous ODE \(y'' + 2y' + 5y = 0\text{,}\) we now look for a particular solution of the inhomogeneous ODE \(y'' + 2y' + 5y = \sin t\text{,}\) using variation of parameters of course.

One might remember variation of parameters of the form

\begin{equation} \begin{bmatrix} y_1 \amp y_2 \\ y_1' \amp y_2' \end{bmatrix} \begin{bmatrix} u_1' \\ u_2' \end{bmatrix} = \begin{bmatrix} 0 \\ g(t)/p(t) \end{bmatrix}.\label{eqn-linear-varparam}\tag{1.3.1} \end{equation}

This gave us a neat solution for \(u_1',u_2'\text{:}\)

\begin{align*} \begin{bmatrix} u_1' \\ u_2' \end{bmatrix} = \begin{bmatrix} y_1 \amp y_2 \\ y_1' \amp y_2' \end{bmatrix}^{-1} \begin{bmatrix} 0 \\ g(t)/p(t) \end{bmatrix} = \frac{1}{W[y_1,y_2](t)} \begin{bmatrix} y_2' \amp -y_2 \\ -y_1' \amp y_1 \end{bmatrix} \begin{bmatrix} 0 \\ g(t)/p(t) \end{bmatrix}. \end{align*}

The expression \(W[y_1, y_2](t)\) may look intimidating, but this is just equal to \(y_1y_2' - y_1'y_2\text{.}\)

There's a lot to unpack here! We have \(y_1 = e^{-t} \cos 2t\) and \(y_2 = e^{-t} \sin 2t\text{,}\) and \(g(t)/p(t) = \sin t\text{.}\) We need to calculate \(y_1'\) and \(y_2'\) first, before we continue with our form of variation of parameters above:

\begin{align*} y_1'(t) \amp = -e^{-t} \cos 2t - 2e^{-t} \sin 2t, \\ y_2'(t) \amp = -e^{-t} \sin 2t + 2e^{-t} \cos 2t. \end{align*}

Next, we have to compute \(W[y_1, y_2](t) = y_1y_2' - y_1'y_2\text{.}\) This is pretty annoying computationally, but trudging through it anyway gives us a pretty nice form of \(W[y_1, y_2](t)\text{:}\)

\begin{gather*} W[y_1, y_2](t) = 2e^{-2t} \end{gather*}

Here's the work of all this:

\begin{align*} W[y_1, y_2](t) \amp = \bigg[ e^{-t} \cos 2t \bigg] \bigg[ -e^{-t} \sin 2t + 2e^{-t} \cos 2t \bigg] - \bigg[ -e^{-t} \cos 2t - 2e^{-t} \sin 2t \bigg] \bigg[ e^{-t} \sin 2t \bigg], \\ \amp = -e^{-2t} \sin 2t \cos 2t + 2e^{-2t} \cos^2 2t \\ \amp \qquad + e^{-2t} \sin 2t \cos 2t + 2e^{-2t} \sin^2 2t, \\ \amp = 2e^{-2t} \cos^2 2t + 2e^{-2t} \sin^2 2t, \\ \amp = 2e^{-2t}. \end{align*}

Now we have all the parts we need for (1.3.1)! Substituting all this stuff into there and expanding seems like a lot of work again, but the expansion itself is not too bad:

\begin{align*} \begin{bmatrix} u_1' \\ u_2' \end{bmatrix} \amp = \frac{1}{2e^{-2t}} \begin{bmatrix} -e^{-t} \sin 2t + 2e^{-t} \cos 2t \amp -e^{-t} \sin 2t \\ -e^{-t} \cos 2t - 2e^{-t} \sin 2t \amp e^{-t} \cos 2t \end{bmatrix} \begin{bmatrix} 0 \\ \sin t \end{bmatrix}, \\ \amp = \begin{bmatrix} -e^{-t}\sin 2t \sin t \\ e^{-t}\cos 2t \sin t \end{bmatrix}. \end{align*}

We've found \(u_1'\) and \(u_2'\text{:}\)

\begin{align*} u_1'(t) \amp = -e^{-t}\sin 2t \sin t \\ u_2'(t) \amp = e^{-t}\cos 2t \sin t \end{align*}

We want to take the indefinite integral of both of these, to see what forms \(u_1\) and \(u_2\) can take. But integrating either of these is going to be pretty brutal. That's why it's good to rely on computing packages!

When we want to calculate \(\displaystyle\int f(x) \ dx\text{,}\) we use the command Integrate[f[x], x].

In this case, the integrals of \(u_1'(t)\) and \(u_2'(t)\) can be calculated using

 u1[t_] = Integrate[Exp[-t] * Sin[2t] * Sin[t], t] 
 u2[t_] = Integrate[Exp[-t] * Cos[2t] * Sin[t], t] 

When we want to calculate \(\displaystyle\int f(x) \ dx\text{,}\) we use the command int(f(x), x).

Here, we can calculate the integrals of \(u_1'\) and \(u_2'\) using

 u1(t) = int(-exp(-t) * sin(2 * t) * sin(t), t) 
 u2(t) = int(-exp(-t) * cos(2 * t) * sin(t), t) 

The integration command is actually very similar to what you'd use for Matlab, so you'd use

 u1 := int(-exp(-t) * sin(2 * t) * sin(t), t) 
 u2 := int(-exp(-t) * cos(2 * t) * sin(t), t) 

It's just as simple for Sage as the others: if we wanted to integrate \(f(x)\text{,}\) then we'd write integrate(f(x), x).

There's a Sage window below with the commands already in. Try it out by clicking the “Evaluate Sage” button!

Whatever computing package you use, we find that one possible \(u_1(t)\) is
\begin{gather*} u_1(t) = \frac{e^{-t}}{20} (-5\cos t + \cos 3t + 5\sin t - 3\sin t), \end{gather*}
and that another possible \(u_2(t)\) is
\begin{gather*} u_2(t) = \frac{e^{-t}}{20} (5\cos t - 3\cos 3t + 5\sin t - \sin 3t). \end{gather*}
So, after all this work, we've finally found a particular solution \(Y(t)\) to the inhomogeneous ODE \(y'' + 2y' + 5y = \sin t\text{!}\) (I'm jumping straight to the answer using Mathematica.)
\begin{align*} Y(t) \amp = u_1(t) y_1(t) + u_2(t) y_2(t) = \frac{e^{-2t}}{20} (-5\cos 3t + \cos 5t + 5\sin 3t - 3\sin 5t). \end{align*}
All in all, the general solution to \(y'' + 2y' + 5y = \sin t\) is \(y(t) = c_1y_1(t) + c_2y_2(t) + Y(t)\text{.}\) Plugging in all of our stuff into this gives us that
\begin{align*} y(t) \amp = c_1e^{-t} \cos 2t + c_2e^{-t} \sin 2t \\ \amp \qquad \qquad + \frac{e^{-2t}}{20} (-5\cos 3t + \cos 5t + 5\sin 3t - 3\sin 5t). \end{align*}
What a messy answer! The important thing is to look at the form of \(y(t)\text{,}\) as demonstrated by the following question.

The answer is pretty simple: as \(t \to \infty\) we get \(y(t) \to 0\text{.}\)

As hinted to before, the general solution \(y(t)\) can be summarized pretty well with the equation

\begin{align*} y(t) \amp = e^{-t} y_b(t) + e^{-2t} Y_b(t). \end{align*}

Both \(y_b(t)\) and \(Y_b(t)\) are bounded for all \(t \in \mathbb{R}\text{.}\)

Intuitively, we mean to say that \(y_b(t)\) never goes to infinity for any real \(t\text{.}\)

More rigourously, we'd say that there exists constants \(A\) and \(B\) such that \(A \leq y_b(t) \leq B\) for all real \(t\text{.}\)

The important takeaway is that \(y_b(t)\) never gets “extremely big”, as big as something like \(e^{t}\) as \(t \to \infty\text{.}\)

You can think of \(y_b\) fitting between two horizontal lines on the \(xy\)-plane.

Since \(e^{-t} \to 0\) and \(e^{-2t} \to 0\) as \(t \to \infty\) we get that \(y(t) \to 0\) too.

Subsection 1.3.2 Suppose \(y''(t) - 4y'(t) - 5y(t) = e^{-t}\text{.}\) Which initial values \(y(0),y'(0)\) allow \(y(t) \to 0\) as \(t \to \infty\text{?}\)

There's a lot to unpack here! The first thing we might think to do is to solve that ODE. And, as with most inhomogeneous ODEs, we solve the homogeneous ODE version first.

Plug in \(y = e^{rt}\text{.}\) This'll give us \(r^2 - 4r - 5 = 0\text{,}\) which has roots \(r = -1,5\text{.}\) So, the general solution to \(y''(t) - 4y'(t) - 5y(t) = 0\) is
\begin{align*} y(t) \amp = c_1 e^{-t} + c_2 e^{5t}. \end{align*}

So now that we know that the general solution to \(y''(t) - 4y'(t) - 5y(t) = 0\) is \(y(t) = c_1 e^{-t} + c_2 e^{5t}\text{,}\) we want to solve \(y''(t) - 4y'(t) - 5y(t) = e^{-t}\text{.}\)

Here, we'll set \(y_1 = e^{-t}\) and \(y_2 = e^{5t}\text{.}\) In line with variation of parameters, we want to find a particular solution of the form \(Y(t) = u_1y_1 + u_2 y_2\) that solves \(y''(t) - 4y'(t) - 5y(t) = e^{-t}\text{.}\)

As we've seen a lot already, it's good to memorize at least one of the forms of variation of parameters. Personally, my favorite form to memorize is

\begin{align*} \begin{bmatrix} y_1 \amp y_2 \\ y_1' \amp y_2' \end{bmatrix} \begin{bmatrix} u_1' \\ u_2' \end{bmatrix} = \begin{bmatrix} 0 \\ g(t)/p(t) \end{bmatrix}. \end{align*}
We have \(y_1 = e^{-t}\) and \(y_2 = e^{5t}\) and \(g(t) / p(t) = e^{-t}\text{.}\) Plugging these in gives us
\begin{align*} \begin{bmatrix} e^{-t} \amp e^{5t} \\ -e^{-t} \amp 5e^{5t} \end{bmatrix} \begin{bmatrix} u_1' \\ u_2' \end{bmatrix} = \begin{bmatrix} 0 \\ e^{-t} \end{bmatrix}. \end{align*}
And now, we solve this linear equation. In a test environment, be careful to not forget small details like dividing by the determinant for the inverse.
\begin{align*} \begin{bmatrix} u_1' \\ u_2' \end{bmatrix} \amp = \begin{bmatrix} e^{-t} \amp e^{5t} \\ -e^{-t} \amp 5e^{5t} \end{bmatrix}^{-1} \begin{bmatrix} 0 \\ e^{-t} \end{bmatrix} \\ \amp = \frac{1}{6e^{4t}} \begin{bmatrix} 5e^{5t} \amp -e^{5t} \\ e^{-t} \amp e^{-t} \end{bmatrix} \begin{bmatrix} 0 \\ e^{-t} \end{bmatrix} \\ \amp = \frac{e^{-4t}}{6} \begin{bmatrix} -e^{4t} \\ e^{-2t} \end{bmatrix} \\ \amp = \begin{bmatrix} -1/6 \\ e^{-6t} / 6 \end{bmatrix}. \end{align*}
So we get the relatively nice forms
\begin{gather*} u_1'(t) = -\frac{1}{6} \quad \text{and} \quad u_2'(t) = \frac{e^{-6t}}{6}. \end{gather*}
These are much much much nicer than the previous problem. We take an indefinite integral to find \(u_1,u_2\text{.}\)
\begin{gather*} u_1(t) = -\frac{t}{6} \quad \text{and} \quad u_2(t) = - \frac{e^{-6t}}{36}. \end{gather*}
So, with \(Y(t) = u_1y_1 + u_2y_2\text{,}\) we get
\begin{gather*} Y(t) = -\frac{t}{6} \cdot e^{-t} - \frac{e^{-6t}}{36} \cdot e^{5t} = -\frac{te^{-t}}{6} - \frac{e^{-t}}{36}. \end{gather*}

The general solution of \(y''(t) - 4y'(t) - 5y(t) = e^{-t}\) is then equal to \(y(t) = c_1y_1 + c_2y_2 + Y\text{,}\) so

\begin{align*} y(t) \amp = c_1 e^{-t} + c_2 e^{5t} - \frac{te^{-t}}{6} - \frac{e^{-t}}{36}. \end{align*}

Now comes the tricky part, when does \(y(t) \to 0\) as \(t \to \infty\text{?}\) We want to find \(y(0)\) and \(y'(0)\) so that this occurs. From experience with 2nd order ODEs, this should make sense as we always need two initial conditions to jump from a general solution to a particular solution.

Looking at the terms above, we know that \(e^{-t} \to 0\) and \(te^{-t} \to 0\) as \(t \to \infty\text{.}\) But, \(e^{5t} \to \infty\) as \(t \to \infty\text{.}\)

So, as long as \(y(t)\) has an \(e^{5t}\) term, \(y(t) \to \infty\) as \(t \to \infty\text{.}\) The best way to remedy this is to “remove” the \(e^{5t}\) term: just set \(c_2 = 0\text{.}\)

Now, \(y(t) \to 0\) as \(t \to \infty\) since all the other stuff went to \(0\text{.}\) Therefore, we want to find \(y(0)\) such that \(c_1\) is any arbitrary constant and \(c_2 = 0\text{.}\)

Set \(c_2 = 0\text{.}\) With \(t = 0\) in \(y(t)\text{,}\)

\begin{align*} y(0) \amp = c_1 - \frac{1}{36}. \end{align*}

We took \(c_2 = 0\text{.}\) Differentiating \(y(t)\) give us

\begin{align*} y'(t) \amp = -c_1e^{-t} - \frac{1}{6} \Big(e^{-t} - te^{-t}\Big) + \frac{e^{-t}}{36}. \end{align*}

With \(t = 0\) in \(y'(t)\text{,}\)

\begin{align*} y'(0) \amp = -c_1 - \frac{1}{6} + \frac{1}{36} = -c_1 - \frac{5}{36}. \end{align*}

What does this all mean? It means that if there is a real number \(c_1\) such that \(y(0) = c_1 - 1/36\) and \(y'(0) = -c_1 - 5/36\text{,}\) then \(y(t) \to 0\) as \(t \to \infty\text{.}\) These conditions are exactly what we wanted to show!

As an added bonus, we can compress this condition quite neatly into one equation by adding \(y(0)\) and \(y'(0)\text{:}\)

\begin{gather*} y(0) + y'(0) = -\frac16. \end{gather*}