TExcelTAD
Home › Differential Equations › Constant Coefficients: Real Roots

Constant Coefficients: Real Roots

When the coefficients are constants,

ay′′+by′+cy=0,a y'' + b y' + c y = 0,

solutions can be found by pure algebra. The guess y=erxy = e^{rx} turns the differential equation into a quadratic equation for rr.

The characteristic equation

Substitute y=erxy = e^{rx}: y′=rerxy' = re^{rx} and y′′=r2erxy'' = r^2e^{rx}, so

(ar2+br+c) erx=0.(ar^2 + br + c)\,e^{rx} = 0.

Since erx≠0e^{rx} \ne 0, y=erxy = e^{rx} is a solution exactly when rr solves the characteristic equation

ar2+br+c=0.a r^2 + b r + c = 0.

Three cases follow from the discriminant b2−4acb^2 - 4ac:

Discriminant Roots General solution
>0> 0 real r1≠r2r_1 \ne r_2 c1er1x+c2er2xc_1e^{r_1x} + c_2e^{r_2x}
=0= 0 one real rr (double) (c1+c2x)erx(c_1 + c_2x)e^{rx}
<0< 0 complex α±iβ\alpha \pm i\beta eαx(c1cos⁡βx+c2sin⁡βx)e^{\alpha x}(c_1\cos\beta x + c_2\sin\beta x)

This lesson handles distinct real roots; the other two cases are in Complex and Repeated Roots.

Example

Solve y′′+y′−6y=0y'' + y' - 6y = 0, y(0)=1y(0) = 1, y′(0)=8y'(0) = 8.

The characteristic equation r2+r−6=(r+3)(r−2)=0r^2 + r - 6 = (r + 3)(r - 2) = 0 has roots 22 and −3-3, so y=c1e2x+c2e−3xy = c_1e^{2x} + c_2e^{-3x}. The conditions give c1+c2=1c_1 + c_2 = 1 and 2c1−3c2=82c_1 - 3c_2 = 8, so c1=115c_1 = \frac{11}{5}, c2=−65c_2 = -\frac{6}{5}.

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

print("roots:", np.roots([1, 1, -6]))
x = sp.symbols("x")
y = sp.Function("y")
sol = sp.dsolve(y(x).diff(x, 2) + y(x).diff(x) - 6 * y(x), ics={y(0): 1, y(x).diff(x).subs(x, 0): 8})
print(sol)
roots: [-3.  2.]
Eq(y(x), 11*exp(2*x)/5 - 6*exp(-3*x)/5)

Reading behaviour from the roots

Each term erxe^{rx} grows if r>0r > 0 and decays if r<0r < 0. So:

  • both roots negative: every solution decays to 0 (an overdamped spring, see Mechanical Vibrations);
  • one positive root: almost every solution grows; only initial values that exactly cancel the growing term decay;
  • the larger root dominates for large xx.
python · try it yourself
import numpy as np

x = np.array([0.0, 1.0, 2.0, 4.0])
y_general = 2.2 * np.exp(2 * x) - 1.2 * np.exp(-3 * x)    # from the example
y_special = np.exp(-3 * x)                                 # y(0) = 1, y'(0) = -3: only the decaying mode
for xv, a, b in zip(x, y_general, y_special):
    print(f"x = {xv:.0f}: generic {a:12.4f}   special {b:.6f}")
x = 0: generic       1.0000   special 1.000000
x = 1: generic      16.1962   special 0.049787
x = 2: generic     120.1130   special 0.002479
x = 4: generic    6558.1076   special 0.000006

Why exponentials?

erxe^{rx} is the function whose derivative is a multiple of itself, so applying the operator aD2+bD+caD^2 + bD + c (where D=ddxD = \frac{d}{dx}) just multiplies it by the polynomial ar2+br+car^2 + br + c. Factoring the polynomial factors the operator: (D−2)(D+3)y=0(D - 2)(D + 3)y = 0. This operator view extends to any order (Higher-Order Linear ODEs) and to systems, where erxe^{rx} becomes eλtve^{\lambda t}\mathbf{v} with an eigenvector v\mathbf{v} (The Eigenvalue Method).

In software

  • Infinite impulse response (IIR) filters in audio and the "spring" smoothing used for UI animation (for example the damping and stiffness settings of spring animations in iOS and web animation libraries) are discrete versions of ay′′+by′+cy=0ay'' + by' + cy = 0; the roots decide whether the motion overshoots.
  • Characteristic roots are the "poles" of control engineering; Transfer Functions and Stability connects them to the Laplace transform.

Exercises

Exercise 1: General solution

Solve y′′−5y′+4y=0y'' - 5y' + 4y = 0.

Answer

y=c1ex+c2e4xy = c_1e^{x} + c_2e^{4x}.

Solution

r2−5r+4=(r−1)(r−4)=0r^2 - 5r + 4 = (r - 1)(r - 4) = 0.

Exercise 2: Initial value problem

Solve y′′−9y=0y'' - 9y = 0, y(0)=2y(0) = 2, y′(0)=0y'(0) = 0. Write the answer with a hyperbolic function.

Answer

y=e3x+e−3x=2cosh⁡3xy = e^{3x} + e^{-3x} = 2\cosh 3x.

Solution

Roots ±3\pm 3. c1+c2=2c_1 + c_2 = 2 and 3c1−3c2=03c_1 - 3c_2 = 0 give c1=c2=1c_1 = c_2 = 1. Since cosh⁡u=eu+e−u2\cosh u = \frac{e^u + e^{-u}}{2}, y=2cosh⁡3xy = 2\cosh 3x.

Exercise 3: Build the equation (code)

Find a constant-coefficient equation y′′+by′+cy=0y'' + by' + cy = 0 whose solutions include e−xe^{-x} and e−5xe^{-5x}, and confirm with SymPy.

Answer

y′′+6y′+5y=0y'' + 6y' + 5y = 0.

Solution

(r+1)(r+5)=r2+6r+5(r + 1)(r + 5) = r^2 + 6r + 5.

python · try it yourself
import sympy as sp
x = sp.symbols("x"); y = sp.Function("y")
print(sp.dsolve(y(x).diff(x, 2) + 6 * y(x).diff(x) + 5 * y(x)))
Eq(y(x), (C1 + C2*exp(-4*x))*exp(-x))

Test yourself

The characteristic equation of 2y′′−3y′+y=02y'' - 3y' + y = 0 is…

  1. 2r2−3r+1=02r^2 - 3r + 1 = 0
  2. r2−3r+2=0r^2 - 3r + 2 = 0
  3. 2r−3=02r - 3 = 0
  4. r2+1=0r^2 + 1 = 0

If the characteristic roots are −1-1 and −4-4, solutions…

  1. grow
  2. decay to 0
  3. oscillate forever
  4. are constant

The roots of r2−4=0r^2 - 4 = 0 give the general solution…

  1. c1e2x+c2e−2xc_1e^{2x} + c_2e^{-2x}
  2. c1cos⁡2x+c2sin⁡2xc_1\cos 2x + c_2\sin 2x
  3. (c1+c2x)e2x(c_1 + c_2x)e^{2x}
  4. c1+c2xc_1 + c_2x