Skip to main content
Logo image

Section 2.2 Constant coefficient second order linear ODEs

Note: more than 1 lecture, second part of §3.1 in [EP], §3.1 in [BD]

Subsection 2.2.1 Solving constant coefficient equations

Consider the problem
y6y+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, they do not depend on x.
To guess a solution, think of a function that 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. Yes, we are talking about the exponential.
Let us try
 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.
a solution of the form y=erx. Then y=rerx and y=r2erx. Plug in to get
y6y+8y=0,r2erxy6rerxy+8erxy=0,r26r+8=0(divide through by erx),(r2)(r4)=0.
Hence, if r=2 or r=4, then erx is a solution. So let y1=e2x and y2=e4x.

Exercise 2.2.1.

Check that y1 and y2 are solutions.
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=C for 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 x=0 into y and y and solve.
2=y(0)=C1+C2,6=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.
We generalize this example into a method. Suppose that we have an equation
(2.3)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±b24ac2a.
Suppose that b24ac0 for now so that r1 and r2 are real. So er1x and er2x are solutions. There is still a difficulty if r1=r2, but it is not hard to overcome.

Example 2.2.1.

Solve
yk2y=0.
The characteristic equation is r2k2=0 or (rk)(r+k)=0. Consequently, ekx and ekx are the two linearly independent solutions, and the general solution is
y=C1ekx+C2ekx.
Since coshs=es+es2 and sinhs=eses2, we can also write the general solution as
y=D1cosh(kx)+D2sinh(kx).

Example 2.2.2.

Find the general solution of
y8y+16y=0.
The characteristic equation is r28r+16=(r4)2=0. The equation has a double root r1=r2=4. The general solution is, therefore,
y=(C1+C2x)e4x=C1e4x+C2xe4x.
It is good to check your work. That e4x solves the equation is clear. Let us check that xe4x solves the equation. Compute y=e4x+4xe4x and y=8e4x+16xe4x. Plug in,
y8y+16y=8e4x+16xe4x8(e4x+4xe4x)+16xe4x=0.
In some sense, a doubled root rarely happens. If coefficients are picked randomly, a doubled root is unlikely. There are, however, some real-world problems where a doubled root does happen naturally (e.g., critically damped mass-spring system as we will see).
Let us give a short argument for why the solution xerx works for a doubled root. This case is a limiting case of two distinct but very close roots. Note that er2xer1xr2r1 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. We remark that in some numerical computations, two very close roots may lead to numerical instability while a doubled root will not.

Subsection 2.2.2 Complex numbers and Euler’s formula

A polynomial may have complex roots. 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). 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(acbd,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 write (a,b) as a+ib, and we treat i as if it were an unknown. When b is zero, then (a,0) is just the number a. 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. For example,
(2+3i)(4i)5i=(2×4)i+(3×4)i25i=8i+12(1)5i=12+3i.
The numbers i and i are the two roots of r2+1=0. Some engineers use the letter j instead of i for the square root of 1. We use the mathematicians’ convention and use i.

Exercise 2.2.3.

Make sure you understand (that you can justify) the following identities:
  1. i2=1, i3=i, i4=1,
  2. 1i=i,
  3. (37i)(29i)==6913i,
  4. (32i)(3+2i)=32(2i)2=32+22=13,
  5. 132i=132i3+2i3+2i=3+2i13=313+213i.
We 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.
In other words, ea+ib=ea(cos(b)+isin(b))=eacos(b)+ieasin(b).

Exercise 2.2.4.

Using Euler’s formula, check the identities:
cosθ=eiθ+eiθ2andsinθ=eiθeiθ2i.

Exercise 2.2.5.

Double angle identities: Start with ei(2θ)=(eiθ)2. Use Euler on each side and deduce:
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.

Subsection 2.2.3 Complex roots

Suppose the differential 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±b24ac2a. These roots are complex if b24ac<0. In this case, we write the roots as
r1,r2=b2a±i4acb22a.
As you can see, we get a pair of roots of the form α±iβ. We could still write the solution as
y=C1e(α+iβ)x+C2e(αiβ)x.
However, the exponential is now complex-valued. We 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.
Euler’s formula comes to the rescue. Let
y1=e(α+iβ)xandy2=e(αiβ)x.
Then
y1=eαxcos(βx)+ieαxsin(βx),y2=eαxcos(βx)ieαxsin(βx).
Linear combinations of solutions are also solutions. Hence,
y3=y1+y22=eαxcos(βx),y4=y1y22i=eαxsin(βx),
are also solutions. It is not hard to see that y3 and y4 are linearly independent (not multiples of each other). So the general solution can be written in terms of y3 and y4. And as they are real-valued, no complex numbers need to be used for the arbitrary constants in the general solution. We summarize what we found as a theorem.

Example 2.2.3.

Find the general solution of y+k2y=0, for a constant k>0.
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).

Example 2.2.4.

Find the solution of y6y+13y=0, y(0)=0, y(0)=10.
The characteristic equation is r26r+13=0. Completing the square, we get (r3)2+22=0 and hence the roots are r=3±2i. Per the theorem, the general solution is
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. The solution we are seeking is
y=5e3xsin(2x).

Exercises 2.2.4 Exercises

2.2.6.

Find the general solution of 2y+2y4y=0.

2.2.7.

Find the general solution of y+9y10y=0.

2.2.8.

Solve y8y+16y=0 for y(0)=2, y(0)=0.

2.2.9.

Solve y+9y=0 for y(0)=1, y(0)=1.

2.2.10.

Find the general solution of 2y+50y=0.

2.2.11.

Find the general solution of y+6y+13y=0.

2.2.12.

Find the general solution of y=0 using the methods of this section.

2.2.13.

The method of this section applies to equations of other orders than two. We will see higher orders later. Solve the first order equation 2y+3y=0 using the methods of this section.

2.2.14.

Let us revisit the Cauchy–Euler equations of Exercise 2.1.6. Suppose now that (ba)24ac<0. Find a formula for the general solution of ax2y+bxy+cy=0. Hint: Note that xr=erlnx.

2.2.15.

Find the solution to y(2α)y+α2y=0, y(0)=a, y(0)=b, where α, a, and b are real numbers.

2.2.16.

Construct an equation such that y=C1e2xcos(3x)+C2e2xsin(3x) is the general solution.

2.2.101.

Find the general solution to y+4y+2y=0.
Answer.
y=C1e(2+2)x+C2e(22)x

2.2.102.

Find the general solution to y6y+9y=0.
Answer.
y=C1e3x+C2xe3x

2.2.103.

Find the solution to 2y+y+y=0, y(0)=1, y(0)=2.
Answer.
y=ex/4cos((7/4)x)7ex/4sin((7/4)x)

2.2.104.

Find the solution to 2y+y3y=0, y(0)=a, y(0)=b.
Answer.
y=2(ab)5e3x/2+3a+2b5ex

2.2.105.

Find the solution to z(t)=2z(t)2z(t), z(0)=2, z(0)=2.
Answer.
z(t)=2etcos(t)

2.2.106.

Find the solution to y(α+β)y+αβy=0, y(0)=a, y(0)=b, where α, β, a, and b are real numbers, and αβ.
Answer.
y=aβbβαeαx+baαβαeβx

2.2.107.

Construct an equation such that y=C1e3x+C2e2x is the general solution.
Answer.
yy6y=0
For a higher quality printout use the PDF version: https://www.jirka.org/diffyqs/diffyqs.pdf