Subsection 2.2.1 Solving constant coefficient equations
Consider the problem
\begin{equation*}
y''-6y'+8y = 0, \qquad y(0) = - 2, \qquad y'(0) = 6 .
\end{equation*}
This is a second order linear homogeneous equation with constant coefficients. Constant coefficients means that the functions in front of \(y''\text{,}\) \(y'\text{,}\) and \(y\) are constants, they do not depend on \(x\text{.}\)
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 a solution of the form \(y = e^{rx}\text{.}\) Then \(y' = r e^{rx}\) and \(y'' = r^2 e^{rx}\text{.}\) Plug in to get
\begin{equation*}
\begin{aligned}
y''-6y'+8y & = 0 , \\
\underbrace{r^2 e^{rx}}_{y''} -6 \underbrace{r e^{rx}}_{y'}+8 \underbrace{e^{rx}}_{y} & = 0 , \\
r^2 -6 r +8 & = 0 \qquad \text{(divide through by } e^{rx} \text{)},\\
(r-2)(r-4) & = 0 .
\end{aligned}
\end{equation*}
Hence, if \(r=2\) or \(r=4\text{,}\) then \(e^{rx}\) is a solution. So let \(y_1 = e^{2x}\) and \(y_2 = e^{4x}\text{.}\)
Exercise 2.2.1.
Check that \(y_1\) and \(y_2\) are solutions.
The functions \(e^{2x}\) and \(e^{4x}\) are linearly independent. If they were not linearly independent, we could write \(e^{4x} = C e^{2x}\) for some constant \(C\text{,}\) implying that \(e^{2x} = C\) for all \(x\text{,}\) which is clearly not possible. Hence, we can write the general solution as
\begin{equation*}
y = C_1 e^{2x} + C_2 e^{4x} .
\end{equation*}
We need to solve for \(C_1\) and \(C_2\text{.}\) To apply the initial conditions, we first find \(y' = 2 C_1 e^{2x} + 4 C_2 e^{4x}\text{.}\) We plug \(x=0\) into \(y\) and \(y'\) and solve.
\begin{equation*}
\begin{aligned}
-2 & = y(0) = C_1 + C_2 , \\
6 & = y'(0) = 2 C_1 + 4 C_2 .
\end{aligned}
\end{equation*}
Either apply some matrix algebra, or just solve these by high school math. For example, divide the second equation by 2 to obtain \(3 = C_1 + 2 C_2\text{,}\) and subtract the two equations to get \(5 = C_2\text{.}\) Then \(C_1 = -7\) as \(-2 = C_1 + 5\text{.}\) Hence, the solution we are looking for is
\begin{equation*}
y = -7 e^{2x} + 5 e^{4x} .
\end{equation*}
We generalize this example into a method. Suppose that we have an equation
\begin{equation}
a y'' + b y' + c y = 0 ,\tag{2.3}
\end{equation}
where \(a, b, c\) are constants. Try the solution \(y = e^{rx}\) to obtain
\begin{equation*}
a r^2 e^{rx} +
b r e^{rx} +
c e^{rx} = 0 .
\end{equation*}
Divide by \(e^{rx}\) to obtain the so-called characteristic equation of the ODE:
\begin{equation*}
a r^2 +
b r +
c = 0 .
\end{equation*}
Solve for the \(r\) by using the quadratic formula:
\begin{equation*}
r_1, r_2 = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} .
\end{equation*}
Suppose that \(b^2 -4ac \geq 0\) for now so that \(r_1\) and \(r_2\) are real. So \(e^{r_1 x}\) and \(e^{r_2 x}\) are solutions. There is still a difficulty if \(r_1 = r_2\text{,}\) but it is not hard to overcome.
Theorem 2.2.1.
Suppose that \(r_1\) and \(r_2\) are the roots of the characteristic equation.
If
\(r_1\) and
\(r_2\) are distinct and real (when
\(b^2 - 4ac > 0\)), then
(2.3) has the general solution
\begin{equation*}
y = C_1 e^{r_1 x} + C_2 e^{r_2 x} .
\end{equation*}
If
\(r_1 = r_2\) (happens when
\(b^2 - 4ac = 0\)), then
(2.3) has the general solution
\begin{equation*}
y = (C_1 + C_2 x)\, e^{r_1 x} .
\end{equation*}
Example 2.2.1.
Solve
\begin{equation*}
y'' - k^2 y = 0 .
\end{equation*}
The characteristic equation is \(r^2 - k^2 = 0\) or \((r-k)(r+k) = 0\text{.}\) Consequently, \(e^{-k x}\) and \(e^{kx}\) are the two linearly independent solutions, and the general solution is
\begin{equation*}
y = C_1 e^{kx} + C_2e^{-kx} .
\end{equation*}
Since \(\cosh s = \frac{e^s+e^{-s}}{2}\) and \(\sinh s = \frac{e^s-e^{-s}}{2}\text{,}\) we can also write the general solution as
\begin{equation*}
y = D_1 \cosh(kx) + D_2 \sinh(kx) .
\end{equation*}
Example 2.2.2.
Find the general solution of
\begin{equation*}
y'' -8 y' + 16 y = 0 .
\end{equation*}
The characteristic equation is \(r^2 - 8 r + 16 = {(r-4)}^2 = 0\text{.}\) The equation has a double root \(r_1 = r_2 = 4\text{.}\) The general solution is, therefore,
\begin{equation*}
y = (C_1 + C_2 x)\, e^{4 x} = C_1 e^{4x} + C_2 x e^{4x} .
\end{equation*}
It is good to check your work. That \(e^{4x}\) solves the equation is clear. Let us check that \(x e^{4x}\) solves the equation. Compute \(y' = e^{4x} + 4xe^{4x}\) and \(y'' = 8 e^{4x} + 16xe^{4x}\text{.}\) Plug in,
\begin{equation*}
y'' - 8 y' + 16 y =
8 e^{4x} + 16xe^{4x} - 8(e^{4x} + 4xe^{4x}) + 16 xe^{4x} =
0 .
\end{equation*}
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 \(x e^{r x}\) works for a doubled root. This case is a limiting case of two distinct but very close roots. Note that \(\frac{e^{r_2 x} - e^{r_1 x}}{r_2 - r_1}\) is a solution when the roots are distinct. When we take the limit as \(r_1\) goes to \(r_2\text{,}\) we are really taking the derivative of \(e^{rx}\) using \(r\) as the variable. Therefore, the limit is \(x e^{rx}\text{,}\) 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 \(r^2 + 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)\text{.}\) 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)\text{.}\) We define multiplication by
\begin{equation*}
(a,b) \times (c,d) \overset{\text{def}}{=} (ac-bd,ad+bc) .
\end{equation*}
It turns out that with this multiplication rule, all the standard properties of arithmetic hold. Further, and most importantly \((0,1) \times (0,1) =
(-1,0)\text{.}\)
Generally we write \((a,b)\) as \(a+ib\text{,}\) and we treat \(i\) as if it were an unknown. When \(b\) is zero, then \((a,0)\) is just the number \(a\text{.}\) We do arithmetic with complex numbers just as we would with polynomials. The property we just mentioned becomes \(i^2 = -1\text{.}\) So whenever we see \(i^2\text{,}\) we replace it by \(-1\text{.}\) For example,
\begin{equation*}
(2+3i)(4i) - 5i =
(2\times 4)i + (3 \times 4) i^2 - 5i
=
8i + 12 (-1) - 5i
=
-12 + 3i .
\end{equation*}
The numbers \(i\) and \(-i\) are the two roots of \(r^2 + 1 = 0\text{.}\) Some engineers use the letter \(j\) instead of \(i\) for the square root of \(-1\text{.}\) We use the mathematicians’ convention and use \(i\text{.}\)
Exercise 2.2.3.
Make sure you understand (that you can justify) the following identities:
\(i^2 = -1\text{,}\) \(i^3 = -i\text{,}\) \(i^4 = 1\text{,}\)
\(\dfrac{1}{i} = -i\text{,}\)
\((3-7i)(-2-9i) = \cdots = -69-13i\text{,}\)
\((3-2i)(3+2i) = 3^2 - {(2i)}^2 = 3^2 + 2^2 = 13\text{,}\)
\(\frac{1}{3-2i} = \frac{1}{3-2i} \frac{3+2i}{3+2i} = \frac{3+2i}{13}
= \frac{3}{13}+\frac{2}{13}i\text{.}\)
We also define the exponential \(e^{a+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: \(e^{x+y} = e^x e^y\text{.}\) This means that \(e^{a+ib} = e^a e^{ib}\text{.}\) Hence if we can compute \(e^{ib}\text{,}\) we can compute \(e^{a+ib}\text{.}\) For \(e^{ib}\text{,}\) we use the so-called Euler’s formula.
Theorem 2.2.2. Euler’s formula.
In other words, \(e^{a+ib} = e^a \bigl( \cos(b) + i \sin(b) \bigr) = e^a \cos(b) + i e^a \sin(b)\text{.}\)
Exercise 2.2.4.
Using Euler’s formula, check the identities:
\begin{equation*}
\cos \theta = \frac{e^{i \theta} + e^{-i \theta}}{2}
\qquad \text{and} \qquad
\sin \theta = \frac{e^{i \theta} - e^{-i \theta}}{2i}.
\end{equation*}
Exercise 2.2.5.
Double angle identities: Start with \(e^{i(2\theta)} = {\bigl(e^{i \theta} \bigr)}^2\text{.}\) Use Euler on each side and deduce:
\begin{equation*}
\cos (2\theta) = \cos^2 \theta - \sin^2 \theta
\qquad \text{and} \qquad
\sin (2\theta) = 2 \sin \theta \cos \theta .
\end{equation*}
For a complex number \(a+ib\text{,}\) we call \(a\) the real part and \(b\) the imaginary part of the number. Often the following notation is used:
\begin{equation*}
\operatorname{Re}(a+ib) = a
\qquad \text{and} \qquad
\operatorname{Im}(a+ib) = b.
\end{equation*}
Subsection 2.2.3 Complex roots
Suppose the differential equation \(ay'' + by' + cy = 0\) has the characteristic equation \(a r^2 + b r + c = 0\) that has complex roots. By the quadratic formula, the roots are \(\frac{-b \pm \sqrt{b^2 - 4ac}}{2a}\text{.}\) These roots are complex if \(b^2 - 4ac < 0\text{.}\) In this case, we write the roots as
\begin{equation*}
r_1, r_2 = \frac{-b}{2a} \pm i\frac{\sqrt{4ac - b^2}}{2a} .
\end{equation*}
As you can see, we get a pair of roots of the form \(\alpha \pm i
\beta\text{.}\) We could still write the solution as
\begin{equation*}
y = C_1 e^{(\alpha+i\beta)x} + C_2 e^{(\alpha-i\beta)x} .
\end{equation*}
However, the exponential is now complex-valued. We need to allow \(C_1\) and \(C_2\) 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.
\begin{equation*}
y_1 = e^{(\alpha+i\beta)x} \qquad \text{and} \qquad y_2 = e^{(\alpha-i\beta)x} .
\end{equation*}
Then
\begin{equation*}
\begin{aligned}
y_1 & = e^{\alpha x} \cos (\beta x) + i e^{\alpha x} \sin (\beta x) , \\
y_2 & = e^{\alpha x} \cos (\beta x) - i e^{\alpha x} \sin (\beta x) .
\end{aligned}
\end{equation*}
Linear combinations of solutions are also solutions. Hence,
\begin{equation*}
\begin{aligned}
y_3 & = \frac{y_1 + y_2}{2} = e^{\alpha x} \cos (\beta x) , \\
y_4 & = \frac{y_1 - y_2}{2i} = e^{\alpha x} \sin (\beta x) ,
\end{aligned}
\end{equation*}
are also solutions. It is not hard to see that \(y_3\) and \(y_4\) are linearly independent (not multiples of each other). So the general solution can be written in terms of \(y_3\) and \(y_4\text{.}\) 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.
Theorem 2.2.3.
Take the equation
\begin{equation*}
ay'' + by' + cy = 0 .
\end{equation*}
If the characteristic equation has the roots \(\alpha \pm i \beta\) (when \(b^2 - 4ac < 0\)), then the general solution is
\begin{equation*}
y = C_1 e^{\alpha x} \cos (\beta x) + C_2 e^{\alpha x} \sin (\beta x) .
\end{equation*}
Example 2.2.3.
Find the general solution of \(y'' + k^2 y = 0\text{,}\) for a constant \(k > 0\text{.}\)
The characteristic equation is \(r^2 + k^2 = 0\text{.}\) Therefore, the roots are \(r = \pm ik\text{,}\) and by the theorem, we have the general solution
\begin{equation*}
y = C_1 \cos (kx) + C_2 \sin (kx) .
\end{equation*}
Example 2.2.4.
Find the solution of \(y'' - 6 y' + 13 y = 0\text{,}\) \(y(0) = 0\text{,}\) \(y'(0) =
10\text{.}\)
The characteristic equation is \(r^2 - 6 r + 13 = 0\text{.}\) Completing the square, we get \({(r-3)}^2 + 2^2 = 0\) and hence the roots are \(r = 3 \pm 2i\text{.}\) Per the theorem, the general solution is
\begin{equation*}
y = C_1 e^{3x} \cos (2x) + C_2 e^{3x} \sin (2x) .
\end{equation*}
To find the solution satisfying the initial conditions, we first plug in zero to get
\begin{equation*}
0 = y(0) = C_1 e^{0} \cos 0 + C_2 e^{0} \sin 0 = C_1 .
\end{equation*}
Hence, \(C_1 = 0\) and \(y = C_2 e^{3x} \sin (2x)\text{.}\) We differentiate,
\begin{equation*}
y' = 3C_2 e^{3x} \sin (2x) + 2C_2 e^{3x} \cos (2x) .
\end{equation*}
We again plug in the initial condition and obtain \(10 = y'(0) = 2C_2\text{,}\) or \(C_2 = 5\text{.}\) The solution we are seeking is
\begin{equation*}
y = 5 e^{3x} \sin (2x) .
\end{equation*}
Exercises 2.2.4 Exercises
2.2.6.
Find the general solution of \(2y'' + 2y' -4 y = 0\text{.}\)
2.2.7.
Find the general solution of \(y'' + 9y' - 10 y = 0\text{.}\)
2.2.8.
Solve \(y'' - 8y' + 16 y = 0\) for \(y(0) = 2\text{,}\) \(y'(0) = 0\text{.}\)
2.2.9.
Solve \(y'' + 9y' = 0\) for \(y(0) = 1\text{,}\) \(y'(0) = 1\text{.}\)
2.2.10.
Find the general solution of \(2y'' + 50y = 0\text{.}\)
2.2.11.
Find the general solution of \(y'' + 6 y' + 13 y = 0\text{.}\)
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
\({(b-a)}^2-4ac < 0\text{.}\) Find a formula for the general solution of
\(a x^2 y'' + b x y' + c y = 0\text{.}\) Hint: Note that
\(x^r = e^{r \ln x}\text{.}\)
2.2.15.
Find the solution to \(y''-(2\alpha) y' + \alpha^2 y=0\text{,}\) \(y(0) = a\text{,}\) \(y'(0)=b\text{,}\) where \(\alpha\text{,}\) \(a\text{,}\) and \(b\) are real numbers.
2.2.16.
Construct an equation such that \(y = C_1 e^{-2x} \cos(3x) + C_2 e^{-2x}
\sin(3x)\) is the general solution.
2.2.101.
Find the general solution to \(y''+4y'+2y=0\text{.}\)
Answer.
\(y =
C_1 e^{(-2+\sqrt{2}) x}
+
C_2 e^{(-2-\sqrt{2}) x}\)
2.2.102.
Find the general solution to \(y''-6y'+9y=0\text{.}\)
Answer.
\(y =
C_1 e^{3x}
+
C_2 x e^{3x}\)
2.2.103.
Find the solution to \(2y''+y'+y=0\text{,}\) \(y(0) = 1\text{,}\) \(y'(0)=-2\text{.}\)
Answer.
\(y =
e^{-x/4} \cos\bigl((\nicefrac{\sqrt{7}}{4})x\bigr)
-
\sqrt{7}
e^{-x/4} \sin\bigl((\nicefrac{\sqrt{7}}{4})x\bigr)\)
2.2.104.
Find the solution to \(2y''+y'-3y=0\text{,}\) \(y(0) = a\text{,}\) \(y'(0)=b\text{.}\)
Answer.
\(y = \frac{2(a-b)}{5} \, e^{-3x/2}+\frac{3 a+2 b}{5} \, e^x\)
2.2.105.
Find the solution to \(z''(t) = -2z'(t)-2z(t)\text{,}\) \(z(0) = 2\text{,}\) \(z'(0)= -2\text{.}\)
Answer.
\(z(t) =
2e^{-t} \cos(t)\)
2.2.106.
Find the solution to \(y''-(\alpha+\beta) y' + \alpha \beta y=0\text{,}\) \(y(0) = a\text{,}\) \(y'(0)=b\text{,}\) where \(\alpha\text{,}\) \(\beta\text{,}\) \(a\text{,}\) and \(b\) are real numbers, and \(\alpha \not=
\beta\text{.}\)
Answer.
\(y =
\frac{a \beta-b}{\beta-\alpha} e^{\alpha x} +
\frac{b-a \alpha}{\beta-\alpha} e^{\beta x}\)
2.2.107.
Construct an equation such that \(y = C_1 e^{3x} + C_2 e^{-2x}\) is the general solution.