# 2.2 Constant coefficient second order linear ODEs

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 try a solution of the form \(y = e^{rx}\). Then \(y' = re^{rx}\) and \(y'' = r^2e^{rx}\). Plug in to get

\[ y'' - 6y' + 8y = 0 \]

\[r^2e^{rx} - 6re^{rx} + 8e^{rx} = 0\]

\[r^2 - 6r + 8 = 0 \] divide through by \( e^{rx}\)

\[ (r - 2)(r - 4) = 0 \]

Exercise \(\PageIndex{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} = Ce^{2x}\) for some constant \(C\), implying that \(e^{2x} = C\)for all \(x\), which is clearly not possible. Hence, we can write the general solution as

\[ y = C_1e^{2x} + C_2e^{4x} \]

We need to solve for \(C_1\) and \(C_2\). To apply the initial conditions we first find \( y' = 2C_1e^{2x} + 4C_2e^{4x}\). We plug in \(x = 0\) and solve.

\[ -2 = y(0) = C_1 + C_2 \]

\[ 6 = y'(0) = 2C_1 + 4C_2 \]

\[ y = -7e^{2x} + 5e^{4x}\]

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 = e^{rx} \) to obtain

\[ ar^2 e^{rx} + bre^{rx} + ce^{rx} = 0\]

\[ ar^2 + br + c = 0 \]

*characteristic equation*of the ODE. Solve for the \(r\) by using the quadratic formula.

\[ r_1, r_2 = \dfrac {-b \pm \sqrt {b^2 - 4ac}}{2a} \]

Therefore, we have \(e^{r_1x}\) and \(e^{r_2x}\) as solutions. There is still a difficulty if \(r_1 = r_2 \), 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.2.10) has the general solution

\[ y = C_1e^{r_1x} + C_2e^{r_2x}\]

\[ y = (C_1 + C_2x)e^{r_1x}\]

If \(r_1 = r_2 \) (happens when \( b^2 - 4ac = 0 \) ), then (2.2.10) has the general solution

\[ y = C_1e^{r_1x} + C_2e^{r_2x} \]

\[ y = (C_1 + C_2x)e^{r_1x}\]

For another example of the first case, take the equation \(y'' - k^2y = 0 \). Here the characteristic equation is \( r^2 - k^2 = 0 \) or \( (r - k)(r + k) = 0 \). Consequently, \(e^{-kx} \) and \(e^{kx} \) are the two linearly independent solutions.

Example \(\PageIndex{1}\):

Find the general solution of

\[ y'' - 8y' + 16y = 0 \]

The characteristic equation is \( r^2 - 8r + 16 = {( r - 4)}^2 = 0 \). The equation has a double root \( r_1 = r_2 = 4 \). The general solution is, therefore,

\[ y = (C_1 + C_2x)e^{4x} = C_1e^{4x} + C_2xe^{4x} \]

Exercise \(\PageIndex{2}\):

*Check that* \( e^{4x} \)* **and* \( xe^{4x}\) *are linearly independent.*

That \( e^{4x} \) solves the equation is clear. If \( xe^{4x}\) solves the equation, then we know we are done. Let us compute \( y' = e^{4x} + 4xe^{4x} \) and \( y'' = 8e^{4x} + 16xe^{4x} \). Plug in

\[ y'' - 8y' + 16y = 8e^{4x} + 16xe^{4x} - 8(e^{4x} + 4xe^{4x} ) + 16xe^{4x} = 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.

Let us give a short proof for why the solution \(xe^{rx}\) 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 \( \frac {e^r2^x - e^x1^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\), we are really taking the derivative of \(e^{rx} \) using \(r\) as the variable. Therefore, the limit is \( xe^{rx}\), and hence this is a solution in the doubled root case.

#### 2.2.1 Complex numbers and Euler’s formula

It may happen that a polynomial has some complex roots. For example, 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) \). 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) \times (c,d) = (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) \times (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 \( i^2 = -1\). So whenever we see \(i^2\), we replace it by \(-1\). The numbers \(i\) and \(-i\) are the two roots of \(r^2 + 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 \(\PageIndex{3}\):

Make sure you understand (that you can justify) the following identities:

- \( i^2 = -1, i^3 = -1, i^4 = 1 \),
- \( \frac {1}{i} = -i \),
- \( (3 -7i)(-2 -9i) = \dots = -69 - 13i \),
- \( (3 - 2i)(3 + 2i) = 3^2 - {(2i)}^2 = 3^2 + 2^2 = 13 \),
- \( \frac {1}{3-2i} = \frac {1}{3-2i} \frac {3+2i}{3+2i} = \frac{3+2i}{13} = \frac {3}{13} + \frac{2}{13} i \).

We can 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^xe^y\). This means that \(e^{a+ib} = e^ae^{ib} \). Hence if we can compute \(e^{ib}\), we can compute \(e^{a+ib}\). For \(e^{ib}\) we use the so-called Euler’s formula.

**Theorem 2.2.2** (Euler's Formula).

\[ e^{i\theta} = \cos \theta + i \sin \theta ~~~~ { \it{~and~ } }~~~~ e^{-i\theta} = \cos \theta - i\sin \theta \]

Exercise \(\PageIndex{4}\):

*Using Euler’s formula, check the identities*:

\[ \cos \theta = \frac { e^{i \theta} + e^{-i \theta}}{2} ~~~~ { \it{~and~ } }~~~~ \sin \theta = \frac { e^{i \theta} - e^{-i \theta}}{2} \]

Exercise \(\PageIndex{5}\):

*Double angle identities*: *Start with* \( e^{i (2 \theta)} = {(e^{i \theta})}^2 \). *Use Euler on each side and**deduce*:

\[ \cos (2 \theta) = {\cos}^2 \theta - {\sin}^2 \theta ~~~ {\it{~and~}}~~~ \sin (2 \theta) = 2 \sin \theta \cos \theta \]

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) =a ~~~ {\it{~and~}}~~~ Im (a + ib) = b \]

#### 2.2.2 Complex roots

Suppose that the equation \( ay'' + by' + cy = 0\) has the characteristic equation \(ar^2 + br + c = 0 \) that has complex roots. By the quadratic formula, the roots are \( \dfrac{-b \pm \sqrt {b^2 - 4ac}}{2a}\). These roots are complex if \(b^2 - 4ac < 0 \). In this case the roots are

\[r_1, r_2 = \frac {-b}{2a} \pm i \dfrac { \sqrt {4ac - b^2}}{2a} \]

As you can see, we always get a pair of roots of the form \( \alpha \pm i \beta \). In this case we can still write the solution as

\[ y = C_1e^{(\alpha + i \beta )x} + C_2e^{(\alpha - i\beta)x} \]

However, the exponential is now complex valued. We would 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.

Here we can use Euler’s formula. Let

\[ y_1 = e^{(\alpha + i\beta)x} ~~~~ { \it{~and~ } }~~~~ y_2 = e^{( \alpha - i \beta ) x} \]

Then note that

\[y_1 = e^{ax} \cos (\beta x) + ie^{ax} \sin ( \beta x) \]

\[y_2 = e^{ax} \cos (\beta x) - ie^{ax} \sin (\beta x) \]

\[ y_3 = \frac {y_1 + y_2}{2} = e^{ax} \cos (\beta x) \]

\[ y_4 = \frac {y_1 - y_2}{2i} = e^{ax} \sin (\beta x) \]

**Theorem 2.2.3.**

*For the homegneous second order ODE*

\[ ay'' + by' + cy = 0 \]

*If the characteristic equation has the roots* \( \alpha \pm i \beta \) (when \( b^2 - 4ac < 0 \)),* then the general solution** is*

\[ y = C_1e^{ax} \cos (\beta x) + C_2e^{ax} \sin (\beta x) \]

Example \(\PageIndex{2}\):

Find the general solution of \( y'' + k^2 y = 0 \), for a constant \( k > 0 \).

The characteristic equation is \(r^2 + k^2 = 0 \). Therefore, the roots are \( r = \pm ik \) and by the theorem we have the general solution

\[ y = C_1 \cos (kx) + C_2 \sin (kx) \]

Example \(\PageIndex{3}\):

Find the solution of \(y'' - 6y' + 13y = 0, y(0) = 0, y'(0) = 10. \)

The characteristic equation is \( r^2 - 6r + 13 = 0 \). By completing the square we get \( {(r -3)}^2 + 2^2 = 0 \) and hence the roots are \( r = 3 \pm 2i\). By the theorem we have the general solution

\[y = C_1e^{3x} \cos (2x) + C_2 e^{3x} \sin (2x) \]

To find the solution satisfying the initial conditions, we first plug in zero to get

\[ 0 = y(0) = C_1e^0 \cos 0 + C_2e^0 \sin 0 = C_1 \]

Hence \(C_1 = 0 \) and \(y = C_2e^{3x} \sin (2x) \). We differentiate

\[ y' = 3C_2 e^{3x} \sin (2x) + 2C_2e^{3x} \cos (2x) \]

We again plug in the initial condition and obtain \(10 = y'(0) = 2C_2\), or \( C_2 = 5 \). Hence the solution we are seeking is

\[ y = 5e^{3x} \sin (2x) \]

#### 2.2 Exercises

**Exercise 2.2.6:** Find the general solution of \( 2y'' + 2y' - 4y = 0 \).

**Exercise 2.2.7:**Find the general solution of \(y'' + 9y' - 10y = 0 \).

**Exercise 2.2.8:** Solve \( y'' - 8y' + 16y = 0 \) for \(y(0) = 2, y'(0) = 0 \).

**Exercise 2.2.9:** Solve \(y'' + 9y' = 0\) for \( y(0) = 1, y'(0) = 1\).

**Exercise 2.2.10:** Find the general solution of \( 2y'' + 50y = 0 \).

**Exercise 2.2.11:** Find the general solution of \( y'' + 6y' + 13y = 0 \).

**Exercise 2.2.12:** Find the general solution of \( y'' = 0 \) using the methods of this section.

**Exercise 2.2.13:** The method of this section applies to equations of other orders than two. We will see higher orders later. Try to solve the first order equation \( 2y' + 3y = 0 \) using the methods of this section.

**Exercise 2.2.14:** Let us revisit Euler’s equations of Exercise 2.1.6. Suppose now that \( {(b - a)}^2 - 4ac < 0 \). Find a formula for the general solution of \( ax^2y'' + bxy' + cy = 0 \). Hint: Note that \( x^r = e^{r \ln x} \).

**Exercise 2.2.101:** Find the general solution to \(y'' + 4y' + 2y = 0 \).

**Exercise 2.2.102:** Find the general solution to \( y'' - 6y' + 9y = 0\).

**Exercise 2.2.103:** Find the solution to \( 2y'' + y' + y = 0, y(0) = 1, y'(0) = -2 \).

**Exercise 2.2.104: **Find the solution to \( 2y'' + y' - 3y = 0, y(0) = a, y'(0) = b \).

**Exercise 2.2.105:** Find the solution to \( z''(t) = -2z'(t) - 2z (t), z(0) = 2, z'(0) = -2 \).

### Contributors

- Jiří Lebl (Oklahoma State University).These pages were supported by NSF grants DMS-0900885 and DMS-1362337.