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
Question 1.3.1. How do I solve \(y'' + 2y' + 5y = 0\text{?}\)
Set \(y = e^{rt}\) to obtain \(r^2 + 2r + 5 = 0\text{.}\) This holds when
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
Therefore, the general solution of \(y'' + 2y' + 5y = 0\) is
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
This gave us a neat solution for \(u_1',u_2'\text{:}\)
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:
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{:}\)
Question 1.3.2. How did you calculate \(W[y_1, y_2](t)\text{?}\)
Here's the work of all this:
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:
We've found \(u_1'\) and \(u_2'\text{:}\)
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!
Question 1.3.3. How do I do this in Mathematica?
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]
Question 1.3.4. How do I do this in Matlab?
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)
Question 1.3.5. How do I do this in Maple?
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)
Question 1.3.6. How do I do this in Sage? (+ bonus Sage cell).
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!
Question 1.3.7. As \(t \to \infty\) what does \(y(t)\) approach?
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
Both \(y_b(t)\) and \(Y_b(t)\) are bounded for all \(t \in \mathbb{R}\text{.}\)
Question 1.3.8. What does it mean for \(y_b(t)\) to be “bounded”?
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.
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.
Question 1.3.9. How do I solve \(y''(t) - 4y'(t) - 5y(t) = 0\text{?}\)
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{.}\)
Question 1.3.10. How do I find \(Y(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
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
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{,}\)
Question 1.3.11. What's \(y'(t)\text{?}\)
We took \(c_2 = 0\text{.}\) Differentiating \(y(t)\) give us
With \(t = 0\) in \(y'(t)\text{,}\)
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{:}\)