TExcelTAD
Home › Differential Equations › Higher-Order Linear ODEs

Higher-Order Linear ODEs

Everything from the second-order case carries over to order nn:

y(n)+pn−1(x) y(n−1)+⋯+p1(x) y′+p0(x) y=f(x).y^{(n)} + p_{n-1}(x)\,y^{(n-1)} + \dots + p_1(x)\,y' + p_0(x)\,y = f(x).

The general solution of the homogeneous equation is a combination of nn independent solutions, an initial value problem needs nn conditions y(x0),y′(x0),…,y(n−1)(x0)y(x_0), y'(x_0), \dots, y^{(n-1)}(x_0), and the Wronskian is now an n×nn \times n determinant. Beam deflection (fourth order) and some control systems are the typical applications.

Constant coefficients

With constant coefficients, y=erxy = e^{rx} again reduces the equation to a polynomial, the characteristic polynomial of degree nn. Each root contributes solutions according to its type and multiplicity:

Root Multiplicity Solutions contributed
real rr kk erx,xerx,…,xk−1erxe^{rx}, xe^{rx}, \dots, x^{k-1}e^{rx}
complex pair α±iβ\alpha \pm i\beta kk xjeαxcos⁡βxx^je^{\alpha x}\cos\beta x, xjeαxsin⁡βxx^je^{\alpha x}\sin\beta x for j=0,…,k−1j = 0, \dots, k - 1

The total count is always nn.

Example. y′′′−3y′′+3y′−y=0y''' - 3y'' + 3y' - y = 0 has characteristic polynomial (r−1)3(r - 1)^3, so y=(c1+c2x+c3x2)exy = (c_1 + c_2x + c_3x^2)e^x.

Example. y(4)−y=0y^{(4)} - y = 0: r4−1=(r−1)(r+1)(r2+1)r^4 - 1 = (r - 1)(r + 1)(r^2 + 1), so y=c1ex+c2e−x+c3cos⁡x+c4sin⁡xy = c_1e^x + c_2e^{-x} + c_3\cos x + c_4\sin x.

python · try it yourself
import numpy as np
import sympy as sp

x = sp.symbols("x")
y = sp.Function("y")
print("roots of r^4 - 1:", np.round(np.roots([1, 0, 0, 0, -1]), 6))
print(sp.dsolve(y(x).diff(x, 4) - y(x)))
print(sp.dsolve(y(x).diff(x, 3) - 3 * y(x).diff(x, 2) + 3 * y(x).diff(x) - y(x)))
roots of r^4 - 1: [-1.+0.j  0.+1.j  0.-1.j  1.+0.j]
Eq(y(x), C1*exp(-x) + C2*exp(x) + C3*sin(x) + C4*cos(x))
Eq(y(x), (C1 + x*(C2 + C3*x))*exp(x))

Finding the roots

For degree 3 and more, roots are found numerically (np.roots) or by factoring with SymPy (sp.roots returns roots with multiplicities, which you need for the table above).

python · try it yourself
import sympy as sp

r = sp.symbols("r")
p = r**5 + 2 * r**3 + r            # = r (r^2 + 1)^2
print(sp.factor(p))
print(sp.roots(p, r))
r*(r**2 + 1)**2
{-I: 2, I: 2, 0: 1}

So y(5)+2y′′′+y′=0y^{(5)} + 2y''' + y' = 0 has the solutions 1,cos⁡x,sin⁡x,xcos⁡x,xsin⁡x1, \cos x, \sin x, x\cos x, x\sin x.

Initial conditions as a linear system

For nn basis solutions, matching y(0),…,y(n−1)(0)y(0), \dots, y^{(n-1)}(0) is an n×nn \times n linear system whose matrix is the Wronskian matrix at 0.

python · try it yourself
import sympy as sp

x = sp.symbols("x")
basis = [sp.exp(x), sp.exp(-x), sp.cos(x), sp.sin(x)]        # y'''' = y
targets = [1, 0, 0, 0]                                         # y(0)=1, y'(0)=y''(0)=y'''(0)=0
M = sp.Matrix([[sp.diff(b, x, k).subs(x, 0) for b in basis] for k in range(4)])
c = M.solve(sp.Matrix(targets))
print("c =", list(c))
print("y =", sum(ci * b for ci, b in zip(c, basis)))
c = [1/4, 1/4, 1/2, 0]
y = exp(x)/4 + cos(x)/2 + exp(-x)/4

The result 14ex+14e−x+12cos⁡x\frac{1}{4}e^x + \frac{1}{4}e^{-x} + \frac{1}{2}\cos x is 12(cosh⁡x+cos⁡x)\frac{1}{2}(\cosh x + \cos x).

Linear independence

Functions y1,…,yny_1, \dots, y_n are linearly independent if c1y1+⋯+cnyn=0c_1y_1 + \dots + c_ny_n = 0 for all xx forces all ci=0c_i = 0. For solutions of the same nnth-order linear equation, this is equivalent to a nonzero Wronskian W=det⁡[yj(i)]W = \det\big[y_j^{(i)}\big].

In software

  • Euler-Bernoulli beam theory, EI y(4)=q(x)EI\,y^{(4)} = q(x), is a fourth-order linear ODE behind structural engineering tools and the bending of tree branches or rods in physics-based animation.
  • Numerical solvers handle order nn by rewriting the equation as a system of nn first-order equations, the same trick as in Differential Equations with Python.

Exercises

Exercise 1: Read the roots

The characteristic polynomial is (r+2)2(r2+9)(r + 2)^2(r^2 + 9). Write the general solution.

Answer

y=(c1+c2x)e−2x+c3cos⁡3x+c4sin⁡3xy = (c_1 + c_2x)e^{-2x} + c_3\cos 3x + c_4\sin 3x.

Solution

−2-2 is a double real root (two solutions), ±3i\pm 3i a simple complex pair (two solutions): four in all, matching the degree.

Exercise 2: Third order

Solve y′′′−y′=0y''' - y' = 0.

Answer

y=c1+c2ex+c3e−xy = c_1 + c_2e^x + c_3e^{-x}.

Solution

r3−r=r(r−1)(r+1)r^3 - r = r(r - 1)(r + 1). The root r=0r = 0 gives the constant solution e0x=1e^{0x} = 1.

Exercise 3: Beam (code)

A beam of length 1 with y(4)=1y^{(4)} = 1 (uniform load, units scaled) is clamped at x=0x = 0 (y=y′=0y = y' = 0) and free at x=1x = 1 (y′′=y′′′=0y'' = y''' = 0). Find the tip deflection y(1)y(1).

Answer

y(1)=18y(1) = \frac{1}{8}.

Solution

Integrate four times and fit the four conditions:

python · try it yourself
import sympy as sp
x = sp.symbols("x"); c = sp.symbols("c0:4")
y = x**4 / 24 + c[3] * x**3 + c[2] * x**2 + c[1] * x + c[0]
eqs = [y.subs(x, 0), y.diff(x).subs(x, 0), y.diff(x, 2).subs(x, 1), y.diff(x, 3).subs(x, 1)]
s = sp.solve(eqs, c)
print(sp.expand(y.subs(s)), "| tip:", y.subs(s).subs(x, 1))
x**4/24 - x**3/6 + x**2/4 | tip: 1/8

This is the textbook cantilever result qL48EI\frac{qL^4}{8EI} with everything scaled to 1.

Test yourself

How many independent solutions does a fifth-order linear homogeneous ODE have?

  1. 2
  2. 4
  3. 5
  4. infinitely many

A triple root r=1r = 1 of the characteristic polynomial contributes…

  1. exe^x only
  2. ex,xex,x2exe^x, xe^x, x^2e^x
  3. ex,e2x,e3xe^x, e^{2x}, e^{3x}
  4. 1,x,x21, x, x^2

Which equation has cos⁡2x\cos 2x and xcos⁡2xx\cos 2x among its solutions?

  1. y′′+4y=0y'' + 4y = 0
  2. (D2+4)2y=0(D^2 + 4)^2y = 0
  3. y′′−4y=0y'' - 4y = 0
  4. y′′′+4y=0y''' + 4y = 0