Second-Order Linear ODEs
A second-order linear equation has the form
Springs, pendulums at small angles, electrical circuits and beams all lead to it. Before learning to solve particular cases, this lesson sets up the theory that makes every method work: superposition, linear independence and the Wronskian.
Homogeneous equations and superposition
When the equation is homogeneous. Write . The operator is linear: . Hence
Superposition. If and solve , so does every combination .
For example, is solved by and , hence by every .
Existence and uniqueness
If , and are continuous on an interval containing , then for any numbers , the problem , , has exactly one solution, and it exists on all of . Unlike nonlinear equations, linear equations never blow up inside an interval where the coefficients are continuous.
Linear independence and the general solution
Two solutions , are linearly independent if neither is a constant multiple of the other. Then the general solution of the homogeneous equation is
because we can match any initial values , by solving the system
The determinant of that matrix is the Wronskian . For two solutions of the same equation, is either zero everywhere or never zero, and it is nonzero exactly when the solutions are independent.
import sympy as sp
x = sp.symbols("x")
pairs = [(sp.cos(x), sp.sin(x)), (sp.exp(x), sp.exp(-x)), (sp.exp(2*x), 3*sp.exp(2*x))]
for y1, y2 in pairs:
W = sp.simplify(sp.wronskian([y1, y2], x))
print(f"W({y1}, {y2}) = {W}")W(cos(x), sin(x)) = 1
W(exp(x), exp(-x)) = -2
W(exp(2*x), 3*exp(2*x)) = 0
The last pair is dependent: is a multiple of , and the Wronskian is 0.
Matching initial conditions
Take with solutions , and initial values , . The system is , :
import numpy as np
A = np.array([[1.0, 1.0], [1.0, -1.0]]) # rows: y(0), y'(0) of e^x and e^-x
c = np.linalg.solve(A, [2.0, -1.0])
print("c1, c2 =", c)
x = 1.0
print("y(1) =", round(c[0] * np.exp(x) + c[1] * np.exp(-x), 6))c1, c2 = [0.5 1.5]
y(1) = 1.91096
Nonhomogeneous equations
If is any one solution of , then every solution is
because the difference of two solutions of solves . Finding , is the topic of the next two lessons; finding is Undetermined Coefficients and Variation of Parameters.
Reduction of order
If you know one solution , try . Substituting gives a first-order equation for , whose solution is
Example. () has . In standard form , so and .
In software
- Superposition is why linear systems are easy to simulate and analyse: engineers compute the response to simple inputs (steps, impulses, sine waves) and add them up. Audio filters, structural analysis (FEM) and control design all rely on it.
- Solving for the constants from initial conditions is a small linear system,
np.linalg.solve, the same operation that dominates large simulations.
Exercises
Exercise 1: Superposition
Verify that solves , and find and .
Answer
, .
Solution
. , so .
Exercise 2: Wronskian
Compute . Are the functions independent?
Answer
: independent.
Solution
.
Exercise 3: Reduction of order (code)
Given solves (), find and check it with SymPy.
Answer
.
Solution
, , .
import sympy as sp
x = sp.symbols("x", positive=True)
y2 = x * sp.log(x)
print(sp.simplify(x**2 * y2.diff(x, 2) - x * y2.diff(x) + y2))0
Test yourself
If and solve , which of these is also a solution?
Two solutions of the same second-order homogeneous equation are independent exactly when…
- their Wronskian is nonzero
- they are both nonzero
- they are equal at
- they are polynomials
The general solution of is…