14.4: Constant coefficient second order linear ODEs
- Last updated
- May 12, 2023
- Save as PDF
- Page ID
- 128078
( \newcommand{\kernel}{\mathrm{null}\,}\)
Solving Constant Coefficient Equations
Suppose we have the problem
y″−6y′+8y=0,y(0)=−2,y′(0)=6
This is a second order linear homogeneous equation with constant coefficients. Constant coefficients means that the functions in front of y″, y′, and y are constants and do not depend on x.
To guess a solution, think of a function that you know stays essentially the same when we differentiate it, so that we can take the function and its derivatives, add some multiples of these together, and end up with zero.
Let us try1 a solution of the form y=erx. Then y′=rerx and y″=r2erx. Plug in to get
y″−6y′+8y=0,r2erx⏟y″−6rerx⏟y′+8erx⏟y=0,r2−6r+8=0(divide through by erx),(r−2)(r−4)=0.
Hence, if r=2 or r=4, then erx is a solution. So let y1=e2x and y2=e4x.
Exercise 14.4.1
Check that y1 and y2 are solutions.
Solution
The functions e2x and e4x are linearly independent. If they were not linearly independent we could write e4x=Ce2x for some constant C, implying that e2x=Cfor all x, which is clearly not possible. Hence, we can write the general solution as
y=C1e2x+C2e4x
We need to solve for C1 and C2. To apply the initial conditions we first find y′=2C1e2x+4C2e4x. We plug in x=0 and solve.
−2=y(0)=C1+C26=y′(0)=2C1+4C2
Either apply some matrix algebra, or just solve these by high school math. For example, divide the second equation by 2 to obtain 3=C1+2C2, and subtract the two equations to get 5=C2. Then C1=−7 as −2=C1+5. Hence, the solution we are looking for is
y=−7e2x+5e4x
Let us generalize this example into a method. Suppose that we have an equation
ay″+by′+cy=0,
where a,b,c are constants. Try the solution y=erx to obtain
ar2erx+brerx+cerx=0
Divide by erx to obtain the so-called characteristic equation of the ODE:
ar2+br+c=0
Solve for the r by using the quadratic formula.
r1,r2=−b±√b2−4ac2a
Therefore, we have er1x and er2x as solutions. There is still a difficulty if r1=r2, but it is not hard to overcome.
Theorem 14.4.1
Suppose that r1 and r2 are the roots of the characteristic equation.
If r1 and r2 are distinct and real (when b2−4ac>0 ), then (???) has the general solution
y=C1er1x+C2er2x
If r1=r2 (happens when b2−4ac=0 ), then (???) has the general solution
y=(C1+C2x)er1x
For another example of the first case, take the equation y″−k2y=0. Here the characteristic equation is r2−k2=0 or (r−k)(r+k)=0. Consequently, e−kx and ekx are the two linearly independent solutions.
Below is a video on the characteristic equation of a differential equation.
Example 14.4.1
Solve
y″−k2y=0.
Solution
The characteristic equation is r2−k2=0 or (r−k)(r+k)=0. Consequently, e−kx and ekx are the two linearly independent solutions, and the general solution is y=C1ekx+C2e−kx.
Since coshs=es+e−s2 and sinhs=es−e−s2, we can also write the general solution as y=D1cosh(kx)+D2sinh(kx).
Below is a video on finding the finding the general solution to a differential equation.
Example 14.4.2:
Find the general solution of y″−8y′+16y=0
Solution
The characteristic equation is r2−8r+16=(r−4)2=0. The equation has a double root r1=r2=4. The general solution is, therefore,
y=(C1+C2x)e4x=C1e4x+C2xe4x
Below is a video on finding the general solution to a differential equation involving two real irrational roots.
Exercise 14.4.2: Linear Independence
Check that e4x and xe4x are linearly independent.
- Answer
-
That e4x solves the equation is clear. If xe4x solves the equation, then we know we are done. Let us compute y′=e4x+4xe4x and y″=8e4x+16xe4x. Plug in
y″−8y′+16y=8e4x+16xe4x−8(e4x+4xe4x)+16xe4x=0
We should note that in practice, doubled root rarely happens. If coefficients are picked truly randomly we are very unlikely to get a doubled root.
Below is a video on finding the the general solution to a differential equation.
Let us give a short proof for why the solution xerx works when the root is doubled. This case is really a limiting case of when the two roots are distinct and very close. Note that er2x−ex1xr2−r1 is a solution when the roots are distinct. When we take the limit as r1 goes to r2, we are really taking the derivative of erx using r as the variable. Therefore, the limit is xerx, and hence this is a solution in the doubled root case.
Below is a video on finding the solution to a differential equation involving repeated roots.
Complex numbers and Euler’s formula
It may happen that a polynomial has some complex roots. For example, the equation r2+1=0 has no real roots, but it does have two complex roots. Here we review some properties of complex numbers.
Complex numbers may seem a strange concept, especially because of the terminology. There is nothing imaginary or really complicated about complex numbers. A complex number is simply a pair of real numbers, (a,b). We can think of a complex number as a point in the plane. We add complex numbers in the straightforward way, (a,b)+(c,d)=(a+c,b+d). We define multiplication by
(a,b)×(c,d)def=(ac−bd,ad+bc).
It turns out that with this multiplication rule, all the standard properties of arithmetic hold. Further, and most importantly (0,1)×(0,1)=(−1,0).
Generally we just write (a,b) as (a+ib), and we treat i as if it were an unknown. We do arithmetic with complex numbers just as we would with polynomials. The property we just mentioned becomes i2=−1. So whenever we see i2, we replace it by −1. The numbers i and −i are the two roots of r2+1=0.
Note that engineers often use the letter j instead of i for the square root of −1. We will use the mathematicians’ convention and use i.
Exercise 14.4.3
Make sure you understand (that you can justify) the following identities:
- i2=−1,i3=−1,i4=1,
- 1i=−i,
- (3−7i)(−2−9i)=⋯=−69−13i,
- (3−2i)(3+2i)=32−(2i)2=32+22=13,
- 13−2i=13−2i3+2i3+2i=3+2i13=313+213i.
We can also define the exponential ea+ib of a complex number. We do this by writing down the Taylor series and plugging in the complex number. Because most properties of the exponential can be proved by looking at the Taylor series, these properties still hold for the complex exponential. For example the very important property: ex+y=exey. This means that ea+ib=eaeib. Hence if we can compute eib, we can compute ea+ib. For eib we use the so-called Euler’s formula.
Theorem 14.4.2
Euler's Formula
eiθ=cosθ+isinθ and e−iθ=cosθ−isinθ
In other words, ea+ib=ea(cos(b)+isin(b))=eacos(b)+ieasin(b).
Exercise 14.4.4:
Using Euler’s formula, check the identities:
cosθ=eiθ+e−iθ2andsinθ=eiθ−e−iθ2i
Exercise 14.4.5
Double angle identities: Start with ei(2θ)=(eiθ)2. Use Euler on each side and deduce:
- Answer
-
cos(2θ)=cos2θ−sin2θandsin(2θ)=2sinθcosθ
For a complex number a+ib we call a the real part and b the imaginary part of the number. Often the following notation is used,
Re(a+ib)=aandIm(a+ib)=b
Complex roots
Suppose that the equation ay″+by′+cy=0 has the characteristic equation ar2+br+c=0 that has complex roots. By the quadratic formula, the roots are −b±√b2−4ac2a. These roots are complex if b2−4ac<0. In this case the roots are
r1,r2=−b2a±i√4ac−b22a
As you can see, we always get a pair of roots of the form α±iβ. In this case we can still write the solution as
y=C1e(α+iβ)x+C2e(α−iβ)x
However, the exponential is now complex valued. We would need to allow C1 and C2 to be complex numbers to obtain a real-valued solution (which is what we are after). While there is nothing particularly wrong with this approach, it can make calculations harder and it is generally preferred to find two real-valued solutions.
Here we can use Euler’s formula. Let
y1=e(α+iβ)xandy2=e(α−iβ)x
Then note that
y1=eaxcos(βx)+ieaxsin(βx)y2=eaxcos(βx)−ieaxsin(βx)
Linear combinations of solutions are also solutions. Hence,
y3=y1+y22=eaxcos(βx)y4=y1−y22i=eaxsin(βx)
are also solutions. Furthermore, they are real-valued. It is not hard to see that they are linearly independent (not multiples of each other). Therefore, we have the following theorem.
Theorem 14.4.3
For the homegneous second order ODE
ay″+by′+cy=0
If the characteristic equation has the roots α±iβ (when b2−4ac<0), then the general solution is
y=C1eaxcos(βx)+C2eaxsin(βx)
Below is a video on finding the solution to a differential equation using the principal of superposition.
Example 14.4.3
Find the general solution of y″+k2y=0, for a constant k>0.
Solution
The characteristic equation is r2+k2=0. Therefore, the roots are r=±ik and by the theorem we have the general solution
y=C1cos(kx)+C2sin(kx)
Below is a video on finding the solution to a differential equation involving complex roots.
Example 14.4.4
Find the solution of y″−6y′+13y=0,y(0)=0,y′(0)=10.
Solution
The characteristic equation is r2−6r+13=0. By completing the square we get (r−3)2+22=0 and hence the roots are r=3±2i. By the theorem we have the general solution
y=C1e3xcos(2x)+C2e3xsin(2x)
To find the solution satisfying the initial conditions, we first plug in zero to get
0=y(0)=C1e0cos0+C2e0sin0=C1
Hence C1=0 and y=C2e3xsin(2x). We differentiate
y′=3C2e3xsin(2x)+2C2e3xcos(2x)
We again plug in the initial condition and obtain 10=y′(0)=2C2, or C2=5. Hence the solution we are seeking is
y=5e3xsin(2x)
Below is a video on finding the solution to an initial value problem.
Below is a video on finding the solution to a differential equation given initial values.
Below is another video on finding the solution to a differential equation given initial values.
Footnotes
[1] Making an educated guess with some parameters to solve for is such a central technique in differential equations, that people sometimes use a fancy name for such a guess: ansatz, German for “initial placement of a tool at a work piece.” Yes, the Germans have a word for that.