Lesson 6.1.1 called an equation for an unknown function y(t) and its derivatives a differential equation, and its order the highest derivative in it. Module 6.1 solved first-order equations such as y′=ky, whose solutions are ekt. This lesson solves equations with a second derivative y′′.
Lesson 2.3.5 met one already, written f′′=−f: the second derivative of sint is −sint. The equation says the curve always bends back towards 0, by as much as it is away from 0. That makes it swing.
This lesson solves the family
ay′′+by′+cy=0
where a, b and c are numbers and a=0. It is linear: y, y′ and y′′ each appear on their own, to the first power, times a constant. It has constant coefficients: a, b and c do not change with t, and the right-hand side is 0.
So y′′+5y′+4y=0 belongs to the family. yy′′=1 (a product), (y′)2=y (a power) and ty′′+y=0 (a coefficient that changes) do not.
Two starting values
A first-order equation needs one starting value, y(0). A second-order equation fixes how the curve bends, so a solution also needs its starting slope y′(0): where it starts, and which way it heads. Lesson 6.2.2 uses those two values to pick one solution.
Units. If t is in years, y′ is in units of y per year and y′′ per year squared. With a=1, b is then per year and c per year squared.
Checking a solution. As in lesson 6.1.1, substitute it. For y=e−t, y′=−e−t and y′′=e−t, so y′′+5y′+4y=(1−5+4)e−t=0. It is a solution.
Trying an exponential
The derivatives of ert are multiples of itself: y′=rert and y′′=r2ert (lesson 2.3.4). Put y=ert into ay′′+by′+cy=0 and every term carries the same factor:
(ar2+br+c)ert=0
Since ert is never 0, the bracket must be. That quadratic in r, ar2+br+c=0, is the characteristic equation of the differential equation, and it decides everything.
Rule: The characteristic equation
ay′′+by′+cy=0has the solution y=ertwhen ar2+br+c=0
Read it off the equation: y′′ becomes r2, y′ becomes r, and y becomes 1. Its roots are the rates r that work.
For y′′+5y′+4y=0 the characteristic equation is r2+5r+4=0. A table of trial rates finds the two that work:
r
0
−1
−2
−3
−4
−5
r2+5r+4
4
0
−2
−2
0
4
The quadratic formula of lesson 1.2.2 gives the same pair: r=2−5±25−16=2−5±3, so r=−1 or r=−4. Both e−t and e−4t solve the equation; e−2t does not.
Try it
The list is the table. np.roots (lesson 1.2.2) takes the coefficients [a, b, c] and returns the roots.
SymPy then substitutes each trial solution into y′′+5y′+4y and simplifies. A solution leaves 0; e−2t leaves −2e−2t, the table's −2 times e−2t.
⌘/Ctrl + Enter runs the cell
Each term of the equation is a constant times y or one of its derivatives. So a sum such as 2e−t−3e−4t is a solution too. Lesson 6.2.2 shows that every solution is such a combination, and how to choose it.
The discriminant b2−4ac of lesson 1.2.2 sorts the equations into three cases: two real roots, one repeated root, or two complex roots.
Two real roots
When b2−4ac>0 there are two real roots r1 and r2, and two solutions er1t and er2t. The signs of the roots say what they do.
Both negative: both solutions die away. In y′′+5y′+4y=0, e−4t fades fastest. At t=2, e−t=0.1353 but e−4t=0.000335, so the root nearer 0 sets the long-run pace.
One positive:y′′−y=0 has r2−1=0, so r=±1. The solution et grows without bound and e−t dies away.
A zero root:y′′+2y′=0 has r2+2r=r(r+2)=0, so r=0 or −2. The root 0 gives e0t=1: the constant 1 is a solution.
The rates are per unit of t: with t in years, e−4t shrinks by the factor e−4 every year.
A repeated root
When b2−4ac=0, the two roots coincide. For y′′+4y′+4y=0, r2+4r+4=(r+2)2, so r=−2 only. That gives one solution, e−2t, but a second-order equation needs two.
The second is te−2t. Check it with the product rule (lesson 2.3.2):
yy′y′′=te−2t=(1−2t)e−2t=(4t−4)e−2t
Then y′′+4y′+4y=[(4t−4)+4(1−2t)+4t]e−2t=0. In numbers:
t
y
y′
y′′
y′′+4y′+4y
0
0
1
−4
0
0.5
0.18394
0
−0.735759
0
1
0.135335
−0.135335
0
0
Rule: A repeated root
ar2+br+c=a(r−r0)2solutions er0t and ter0t
The extra factor t supplies the missing second solution. The root is r0=−2ab: in lesson 1.2.2's picture, the parabola's vertex touches the axis there.
Try it
The loop rebuilds the table from the formulas for y, y′ and y′′ above. round(…, 12) hides rounding noise in the last column.
SymPy then substitutes e−2t and te−2t directly.
⌘/Ctrl + Enter runs the cell
Complex roots: waves
Start with y′′=−y, or y′′+y=0. Its characteristic equation r2+1=0 has no real roots, but it has two complex ones, r=±i (lesson 1.7.2). By Euler's formula (lessons 1.7.3 and 2.7.2),
eit=cost+isint
Its real part, cost, and its imaginary part, sint, are each solutions. Lesson 2.3.5 found this directly: differentiating sint twice gives −sint, and cost gives −cost. The solutions are waves of period 2π.
The same holds for y′′+4y=0. Now r=±2i, and e2it=cos2t+isin2t, so the solutions are cos2t and sin2t. They swing twice as fast, with period 22π=π.
Damped waves
Now add a first-derivative term: y′′+2y′+5y=0. The discriminant is 4−20=−16, and the quadratic formula gives
r=2−2±−16=−1±2i
Split e(−1+2i)t by the exponent rules (lesson 1.4.1), then use Euler's formula:
e(−1+2i)t=e−te2it=e−tcos2t+ie−tsin2t
Because a, b and c are real, the real part and the imaginary part of a complex solution are each real solutions. So the equation has e−tcos2t and e−tsin2t. The other root, −1−2i, gives the same pair again.
The real part α (alpha) sets the size: the waves shrink if α<0, last if α=0 and grow if α>0. The imaginary part ω (omega) sets the speed: the period is ω2π.
The waves of e−tcos2t swing between the curves e−t and −e−t, called the envelope. With t in years, ω=2 is in radians per year (lesson 2.3.5), and one swing takes π≈3.14 years.
The two basic solutions in each case. Real roots give exponentials; a repeated root adds the factor t; complex roots give waves inside the envelope ±eαt, here ±e−t.
Try it
cmath (lesson 1.7.3) computes e(−1+2i)t at t=0.5 and 1. Its real and imaginary parts match e−tcos2t and e−tsin2t.
SymPy then substitutes the four waves of this section into their equations.
⌘/Ctrl + Enter runs the cell
Damping
The by′ term is called damping: with a and c positive, a positive b drains the swing. Hold c=4 and change b in y′′+by′+4y=0:
b
b2−16
roots
solutions
0
−16
±2i
waves that last, period π
0.5
−15.75
−0.25±1.9843i
waves dying down like e−0.25t
4
0
−2, repeated
critically damped: no waves
5
9
−1 and −4
overdamped: no waves, slower return
−0.5
−15.75
0.25±1.9843i
waves growing like e0.25t
Small damping lets the waves die down slowly. At b=4 the waves just disappear.
More damping than that gives two negative real roots, and the one nearer 0 makes the return slower. A negative b feeds the swing instead, and the waves grow.
The explorer solves y′′+by′+cy=0 from y(0)=1 and y′(0)=0; its other presets are rows of the damping table. Pick the preset y′′=−y and raise b from 0: the waves die down faster, and from b=2 on they no longer cross zero. Then drag b below 0, and make c negative.
Explore
The equation y″ + by′ + cy = 0 with y(0) = 1 and y′(0) = 0. Its behaviour is decided by the roots of r² + br + c = 0. Set b = 0 for waves that go on for ever, then raise b to damp them.
With a=1, the point (b,c) tells you the case at a glance. The roots are complex above the parabola c=4b2, where b2−4c<0, and real below it. Below the b-axis, c<0 makes b2−4c larger than ∣b∣, so one root is positive.
Where (b,c) sits decides the kind of solution. The dots are this lesson's examples; the damping table walks along the line c=4, crossing the parabola at b=4.
Checking with solve_ivp
Lesson 6.1.2 solved first-order equations numerically with solve_ivp. A second-order equation becomes two first-order ones if the slope gets its own name, v=y′:
y′v′=v=−abv+cy
The second line is the equation ay′′+by′+cy=0 solved for y′′. Now the unknown is the pair (y,v), which solve_ivp handles as a list.
Try it
The cell solves y′′+2y′+5y=0 from y(0)=1 and y′(0)=−1, the starting value and slope of e−tcos2t. It prints the solution at t=0,0.5,…,5, then the exact wave.
With rtol=1e-10 and atol=1e-12 the two agree to far more than the 6 printed decimals. With the default tolerances of lesson 6.1.2 they differ by about 2×10−4.
⌘/Ctrl + Enter runs the cell
Lesson 6.2.2 combines the two basic solutions to meet given starting values, or conditions at two points. Case study 6.2.4 uses the same trial-solution idea to value a put that never expires.
Common mistakes
Put each coefficient in its place.y′′−9y=0 has no y′ term, so its characteristic equation is r2−9=0, with roots ±3. It is not r2−9r=0.
Keep a.2y′′+3y′+y=0 gives 2r2+3r+1=0, with roots −21 and −1.
A repeated root gives one exponential. The second solution is ter0t, not er0t again. np.roots can report a repeated root as a pair with a tiny imaginary part, such as 10−8; decide the case from b2−4ac.
Complex roots: α for size, ω for speed. For −1±2i the solutions are e−tcos2t and e−tsin2t, not e2tcost. The waves die down only if α<0.
The period is ω2π, in radians.y′′+4y=0 has ω=2 and period π.
The trial ert needs constant coefficients. In ty′′+y=0 the factor t stays, and no single r works. Lesson 6.2.2 tries powers xp for a different family.
With a=0 there is no second derivative. The equation is first order, as in module 6.1.
Constant coefficients and the characteristic equation
0 of 12 correct
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
How to type answers
Powers with ^: x^7, 2^(1/3), a^-2.
Multiply with * or by writing side by side: 3x^2, 2(x+1).
ln(x) is the natural log, log(x, 2) is log base 2, e is Euler's number, sqrt(x) is a square root.
sin(x), cos(x) and tan(x) take radians; write pi for π and sin(x)^2 for sin²x.
Your first answer to each question is saved: it counts towards your score and brings the question back for review.
Exact answers like ln(20)/ln(3) are best. Decimals need about 4 significant figures.
Summary card
ay′′+by′+cy=0, with constants a=0, b and c, is a second-order linear equation. A solution needs two starting values, y(0) and y′(0).
y=ert is a solution exactly when ar2+br+c=0, the characteristic equation.
Two real roots r1, r2: solutions er1t and er2t. A repeated root r0=−2ab: er0t and ter0t.
Complex roots α±iω: eαtcosωt and eαtsinωt, by Euler's formula. y′′=−y gives cost and sint; the period is ω2π.
Damping b>0 (with a,c>0): waves die down while b2<4ac, vanish at b2=4ac (critically damped), and give two decaying exponentials beyond (overdamped). b<0 makes them grow.
For solve_ivp, write v=y′: then y′=v and v′=−abv+cy.