2.1: Second Order Linear Differential Equations

Open In Colab

Reading: Notes on Diffy Q’s Section 2.2 Part 1 (real roots)

Second Order Linear Differential Equations


A second order linear differential equation has the form

\[\color{dodgerblue}{P(t)\frac{d^2y}{dt^2}+Q(t)\frac{dy}{dt}+R(t)y=G(t)}\]

where \(P\), \(Q\), \(R\), and \(G\) are continuous functions of the indpendent variable (\(t\)). There are many applications for which this type of differential equation is a useful model.

Applications: Breaking a Glass with your Voice


Glass Breaking: You probably have all seen in cartoons or on Mythbusters where a wineglass is broken by singing a particular high-pitched note. The phenomenon that makes this possible is called resonance. Resonance results from the fact that the crystalline structures of certain solids have natural frequencies of vibration. An external force of the same frequency will “resonate” with the object and create a huge increase in energy. For instance, if the frequency of a musical note matches the natural vibration of a crystal wineglass, the glass will vibrate with increasing amplitude until it shatters. The following is one model for understanding resonance.

\[\frac{d^2x}{dt^2}+k^2x=\cos(kt)\]

If you don’t believe this is possible. Play the video below.

Video Source: “Boy Breaks Wine Glass with Voice.” YouTube, uploaded by chasechocolate, uploaded December 14, 2009.

from IPython.display import YouTubeVideo

YouTubeVideo('sH7XSX10QkM', width=800, height=450)

Applications: Collapsing Bridge


Tacoma Narrows Bridge: The Tacoma Narrows Bridge in Washington State was one of the largest suspended bridges built at the time. The bridge connecting the Tacoma Narrows channel collapsed in a dramatic way on Thursday November 7, 1940. Winds of 35-46 miles/hours produced an oscillation which eventually broke the construction. The bridge began first to vibrate torsionally, giving it a twisting motion. Later the vibrations entered a natural resonance (same term as in the glass breaking) with the bridge. Here is a simplified second order differential equation that models the situation of the Tacoma Bridge.

\[\frac{d^2y}{dt^2}+4y=2\sin(2.1t)\]

If you don’t believe this is possible. Play the video below.

Video Source: “The Collapse of ‘Galloping Gertie’.” YouTube, uploaded by Smithsonian National Air and Space Museum, uploaded November 4, 2019.

from IPython.display import YouTubeVideo

YouTubeVideo('y0xohjV7Avo', width=800, height=450)

More Applications of Second Order Differential Equations


Sometimes resonance is a good thing! Violins, for instance, are designed so that their body resonates at as many different frequencies as possible, which allows you to hear the vibrations of the strings!

There are many other situations that can be modeled with second order differential equations, including mass-spring systems, RLC circuits, pendulums, car springs bouncing, etc. In this section you will learn how to solve second order linear differential equations with constant coefficients. That is, equations where \(P\), \(Q\), and \(R\) are constant. If \(G\) is zero, then the equation is called homogeneous. When \(G\) is nonzero then the equation is called non-homogeneous. As you will discover in the sections that follow, the distinction between homogeneous and non-homogeneous equations will be quite useful.

Guess and Test


Normally, guess and check is not an efficient algorithm for solving mathematical equations. In the case of a differential equation, we have an infinite number of possible solutions that we check.

  • Based on the structure of the differential equation, we can identify the general form of a solution.
  • Then we can test our guess and refine it.

By working through some examples, we can build an intuition for determining what a wise initial guess might be.

Question 1:


Read the following equations with meaning, by completing the following sentence,

\(x(t)\) is a function for which its second derivative …” (try saying itself instead of \(x\)).

\[ \mbox{a. } \frac{d^2x}{dt^2} = -x \qquad \mbox{b. } \frac{d^2x}{dt^2} + x = 0 \qquad \mbox{c. } \frac{d^2x}{dt^2} + 4x = 0 \qquad \mbox{d. } \frac{d^2x}{dt^2} = x\]

Solution to Question 1:







Question 2:


For each differential equation (a)-(d) in Question 1, based on your readings with meaning, find two different solution functions.

Solution to Question 2:







Question 3:


Your task in this question is to use the “guess and test” approach to find a solution to the linear second order, homogeneous differential equation

\[\frac{d^2x}{dt^2}+10\frac{dx}{dt}+9x=0\]

By now you know very well that solutions are functions. What is your best guess for a function whose second derivative plus 10 times its first derivative plus 9 times the function itself sum to zero? Explain briefly the rationale for your guess and then test it out to see if it works. If it doesn’t work refine your guess and keep trying.

Solution to Question 3:







Question 4:


Determine if a constant multiple of your solution in Question 3 is also a solution.

Solution to Question 4:







Question 5:


Try and find a different solution, one that is not a constant multiple of your solution to Question 3

Solution to Question 5:







Question 6:


Determine the general solution to \(\dfrac{d^2x}{dt^2}+10\dfrac{dx}{dt}+9x=0\).

Solution to Question 6:







Question 7:


Consider again the differential equation \(\dfrac{d^2x}{dt^2}+10\dfrac{dx}{dt}+9x=0\).

Solution to Question 7:



Step 1:


By guessing \(x(t) = e^{rt}\), show that this guess yields a solution to the differential equation precisely when \(r^2 + 10r + 9 = 0\).






Step 2:


Solve this quadratic equation to find two different values of \(r\).






Step 3:


State two different solutions for the differential equation, one for each value of \(r\).






Step 4:


Form the general solution by multiplying your two solutions by constants \(c_1\) and \(c_2\), and adding the results.






Step 5:


Congratulate yourself :)


Question 8:


Find the general solution to the following differential equation: \(\dfrac{d^2x}{dt^2}+\dfrac{dx}{dt}-6x=0\).

Solution to Question 8:







Question 9:


Show \(y=Cte^{2t}\) is a solution to \(y''-4y'+4y=0\).

Solution to Question 9:







Question 10:


Why do you think the previous example has a “different” looking solution?

Solution to Question 10:







Question 11:


Solve the differential equation \(z''+z'=z\).

Solution to Question 12:







Question 12:


Solve the differential equation \(3w''+18w'+27w=0\).

Solution to Question 12:







Question 13:


Solve the initial value probelm: \(w''+8w'+16w=0\); \(w(0)=-2\); \(w'(0)=12\).

Tip

You may use the linalg.solve() function in Python to solve the system of two linear equations you get as a result of using the initial conditions to solve for the general constants. See Appendix section on linalg.solve.

Solution to Question 13:







# Optional Code to Use Python to Solve for C_1 and C_2

# STUDENT TO_DO: Replace each ?? with an appropriate number

import numpy as np  # Import NumPy library

# Enter coefficient matrix 
A = np.array([[??, ??],
              [??, ??]])

# Enter vector of constants on right side
b = np.array([[??],[??]])

# Solve Ax=b and store solution in x
x = np.linalg.solve(A,b)

# Print solution to the screen
print("The solution to the system is \n", x)

Question 14:


Solve the initial value probelm: \(y'' +3y'-10y=0\); \(y(0)=8\), \(y'(0)=6\).

Tip

You may use the linalg.solve() function in Python to solve the system of two linear equations you get as a result of using the initial conditions to solve for the general constants. See Appendix section on linalg.solve.

Solution to Question 14:







# Optional Code to Use Python to Solve for C_1 and C_2

# STUDENT TO_DO: Replace each ?? with an appropriate number

#import numpy as np  # Do not need to run if already imported

# Enter coefficient matrix 
A = np.array([[??, ??],
              [??, ??]])

# Enter vector of constants on right side
b = np.array([[??],[??]])

# Solve Ax=b and store solution in x
x = np.linalg.solve(A,b)

# Print solution to the screen
print("The solution to the system is \n", x)

Appendix: Solving Systems of Linear Equations with Python


When given initial conditions as in Question 13 and Question 14, we typically need to set up and solve a system of linear equations to find the values of the constants.

  • For second linear differential equations with constant coefficients, typically we have a system of two linear equations in two unknowns.
  • For an \(n^\mbox{th}\) order linear differential equation with constant coefficients, we have a system of \(n\) linear equations in unknowns.

For example, solving an initial value problem for a third order linear differential equation with constant coefficient we might have for example a resulting system of three linear equations such as We would like to solve the following system of linear equations:

\[\begin{array}{rcrcrcr} 2C_1 & + & C_2 & + & C_3 & = & 5\\ 4C_1 & - & 6C_2 & & & = & -2\\ -2C_1 & + & 7C_2 & + & 2C_3 & = & 9 \end{array}\]

LaTeX’ing a System of Equations


My LaTeX code for the system above is entered in the array environment with 7 columns so the variables are nicely aligned. You could LaTeX the system above using a more simple array such as:

\[\begin{array}{rcr} 2C_1 + C_2 + C_3 & = & 5\\ 4C_1 - 6C_2 & = & -2\\ -2C_1 + 7C_2 + 2C_3 & = & 9 \end{array}\]

Using more columns in the array is more complicated to LaTeX, but (I think) looks nicer. Feel free to align and style as you like.

LaTeX’ing the Relevant Matrices and Vectors


The system of equations has the following coefficient matrix I will denote \(A\).

\[A = \begin{bmatrix} 2 & 1 & 1\\ 4 & -6 & 0\\ -2 & 7 & 2 \end{bmatrix}\]

The column vector of constants on the right side of the equations I denote \(\mathbf{b}\) is given below.

\[\mathbf{b} = \begin{bmatrix} 5\\-2\\9 \end{bmatrix}\]

Lastly, the column vector representing the variables is given below.

\[\mathbf{x} = \begin{bmatrix} C_1 \\ C_2 \\ C_3 \end{bmatrix}\]

Thereore the original system of linear equations has the matrix equation

\[A \mathbf{x} = \mathbf{b}\]

where \(A\), \(\mathbf{x}\), and \(\mathbf{b}\) are all defined above.

Solving the Matrix Eq \(A\mathbf{x} = \mathbf{b}\) Using NumPy


Imagine in the course of solving an initial value problem for a third order differential equation that we would like to solve the following system of linear equations

\[\begin{array}{rcrcrcr} 2C_1 & + & C_2 & + & C_3 & = & 5\\ 4C_1 & - & 6C_2 & & & = & -2\\ -2C_1 & + & 7C_2 & + & 2C_3 & = & 9 \end{array}\]

which has corresponding matrix equation \(A \mathbf{x} = \mathbf{b}\) where

\[A = \begin{bmatrix} 2 & 1 & 1\\ 4 & -6 & 0\\ -2 & 7 & 2 \end{bmatrix} \quad \mbox{and} \quad \mathbf{b} = \begin{bmatrix} 5\\-2\\9 \end{bmatrix}.\]

  • The NumPy library has a built-in function called linalg.solve(A,b) that can solve a matrix equation of the form \(A \mathbf{x} = \mathbf{b}\).
import numpy as np  # Import NumPy library

# Enter coefficient matrix 
A = np.array([[2., 1., 1.],
              [4., -6., 0.],
              [-2., 7., 2.]])

# Enter vector of constants on right side
b = np.array([[5.],[-2.],[9]])

# Solve Ax=b and store solution in x
x = np.linalg.solve(A,b)

# Print solution to the screen
print("The solution to the system is \n", x)

Interpreting the Output of linalg.solve()


From the output of the previous code cell, we see that

\[ \mathbf{x} = \begin{bmatrix} C_1 \\ C_2 \\ C_3 \end{bmatrix} = \begin{bmatrix} 1 \\ 1 \\ 2 \end{bmatrix},\]

which gives the solution \(C_1 = 1\), \(C_2 = 1\), and \(C_3 = 2\).

Creative Commons License Information


Creative Commons License
Exploring Differential Equations by Adam Spiegler is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Based on a work at https://github.com/CU-Denver-MathStats-OER/ODEs and original content created by Rasmussen, C., Keene, K. A., Dunmyre, J., & Fortune, N. (2018). Inquiry oriented differential equations: Course materials. Available at https://iode.sdsu.edu.