Second-order linear differential equations with constant coefficients

,

Note: This article contains mathematical notation rendered via KaTeX, which requires JavaScript. For better formatting and accessibility, a PDF version is provided here.

Homogeneous 2nd-order linear DEs with constant coefficients

You want to solve a second-order DE of the following form (Equation 1, with $a \ne 0$):

$$ ay'' + by' + cy = 0 $$

Try $y = e^{rt}$ as a solution. Just because that's what the solution to the first-order DE looks like. So find $y'$ and $y''$:

$$ y' = re^{rt} $$

$$ y'' = [y']' = r^2 e^{rt} $$

and plug them into Equation 1:

$$ a \cdot r^2e^{rt} + c \cdot e^{rt} = 0 $$

Now factor out the $e^{rt}$:

$$ e^{rt} \cdot (ar^2 + br +c) = 0 $$

You know that $e^{rt}$ is never zero for any value of $t$, so the expression above is true only if;

$$ ar^2 + br + c = 0 $$

The values of $r_1$, $r_2$ can be found with the quadratic formula:

$$ r_1, r_2 = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} = \frac{-b \pm \sqrt{D}}{2a} $$

The determinant $D = b^2 - 4ac$ can be either positive, negative, or zero.

Case I: $D>D$

In this case, $r_1$ and $r_2$ are real and distinct. This means that $y_1 = e^{r_1 t}$ and $y_2 = e^{r_2 t}$ are two particular solutions to Equation 1, and the general solution is given by their linear combination:

$$ y = A \cdot e^{r_1 t} + B \cdot e^{r_2 t} $$

Case II: $D = 0$

In this case, $r_1 = r_2$, so $y = e^{rt}$ is a solution to Equation 1.

To find the general solution, let $y = e^{rt} \cdot u(t)$ (with $u(t)$ a generic function to be determined) and try that as a solution. (This method is called a "reduction of order"; it's used find a second, linearly independent solution from a solution that is already knwon, in this case $y_1 = e^{rt}$).

$$ y' = r \cdot e^{rt} \cdot u + e^{rt} \cdot u' = e^{rt} \cdot (ru + u') $$

$$ y'' = e^{rt} \cdot r \cdot (ru + u') + e^{rt} \cdot (ru' + u'') $$

$$ = e^{rt} \cdot (r^2 r + ru' + ru' + u'') $$

$$ = e^{rt} \cdot (r^2 u + 2ru' + u'') $$

Plug into Equation 1:

$$ a \cdot e^{rt} \cdot (r^2 u + 2ru' + u'') + b \cdot e^{rt} \cdot (ru + u') + c \cdot e^{rt} \cdot u = 0 $$

$$ ae^{rt}r^2u + ae^{rt}2ru' + ae^{rt}u'' + be^{rt}ru + be^{rt}u' + ce^{rt}u = 0 $$

$$ e^{rt} \cdot (ar^2u + a2ru' + au'' + bru + bu' + cu) = 0 $$

$$ e^{rt} \cdot (au'' + (2ar+b)u' + (ar^2+br+c)u) = 0 $$

Now, you know that:

So:

$$ e^{rt} \cdot (au'' + (2ar + b)u'' + (ar^2 + br + c)u) = 0 $$

$$ e^{rt} \cdot au'' = 0 \rightarrow u'' = 0 $$

Thus the equation is reduced to $u'' = 0$ ($a \ne 0$ otherwise Equation 1 wouldn't be second-order). From this, compute the integral twice and find that $u = A+Bt$ for arbitrary constants $A$ and $B$.
The general solution was defined as $y = e^{rt} \cdot u(t)$, therefore:

$$ y = e^{rt} \cdot (A+Bt) $$

$$ y = Ae^{rt} + Bte^{rt} $$

Case III: $D < 0$

The two roots are given by

$$ r_1, r_2 = \frac{-b \pm i \sqrt{b^2 -4c}}{2a} = \frac{-b \pm \sqrt{D}}{2a} $$

When $D<0$, that means:

$$ D = - |D| $$

$$ \sqrt{D} = \sqrt{-|D|} = i \cdot \sqrt{|D|} $$

which, when plugged in the quadratic formula, gives:

$$ r_1, r_2 = \frac{-b \pm i \sqrt{|D|}}{2a} = k \pm i \omega $$

where $k = \frac{-b}{2a}$ and $\omega = \sqrt{\frac{4ac-b^2}{2a}}$. Therefore, there are two complex solutions to Equation 1:

$$ y_1^* = e^{k+i\omega} $$

$$ y_2^* = e^{k-i\omega} $$

In order to obtain two real solutions, conveniently combine $y_1^* $ and $y_2^* $ and use Euler's relation:

$$ e^{ix} = \cos{x} + i\sin{x} $$

$$ y_1 = \frac{1}{2}y_1^* + \frac{1}{2}y_2^* = \frac{1}{2} (e^{(k+i\omega)t} + e^{(k-i\omega)t}) = \frac{1}{2}(e^{kt}e^{i\omega t}+e^{kt}e^{-i\omega t}) = \frac{1}{2}e^{kt}(e^{i\omega t} + e^{-i\omega t} $$

$$ = \frac{1}{2}e^{kt} [(\cos{\omega t} + i\sin{\omega t} + \cos{\omega t} -i\sin{\omega t}] = \frac{1}{2} e^{kt} 2\cos{\omega t} = \boxed{e^{kt} \cos{\omega t}} $$

$$ y_2 = \frac{1}{2i}y_1^* - \frac{1}{2i}y_2^* = \frac{1}{2i}(e^{kt}e^{i\omega t} - e^{kt}e^{-i\omega t}) = \frac{1}{2i}e^{kt} (e^{i\omega t} -e^{-i\omega t}) $$

$$ = \frac{1}{2i}e^{kt}(\cos{\omega t} + i \sin{\omega t} - \cos{\omega t} + i \sin{\omega t}) = \frac{e^{kt}}{2i} 2i \sin{\omega t} = \boxed{e^{kt} \sin{\omega t}} $$

So $y_1, y_2$ are two real solutions to Equation 1. Their linear combination is then the general solution:

$$ \boxed{y = A \cdot e^{kt} \cos{\omega t} + B \cdot e^{kt} \sin{\omega t}} $$

Non-homogeneous 2nd-order linear DE with constant coefficients

You want to solve a second-order DE of the following form ($a \ne 0$; $f(x) \ne 0$):

$$ a_2(x)y'' + a_1(x)y' + a_0(x)y = f(x) $$

Assume that you know two independent solutions to its associated (or complementary) homogeneous equation, $y_1(x)$ and $y_2(x)$ (the section above explains how to find them). Then their linear combination $y_h = C_1y_1 + C_2y_2$ is the general solution to the complementary homogeneous equation, and it is called the complementary function of the non-homogeneous DE Equation 5.
The general solution to the non-homogeneous DE Equation 5 is

$$ y = y_p(x) + y_h(x) $$

where $y_p(x)$ is any particular solution to the non-homogeneous DE (due to the principle of superposition for linear ODEs). Therefore, to solve Equation 5, all you need is any particular solution. There are two methods to find one.

Method of undetermined coefficients

This method consists of making an educated guess for the form of the solution you're looking for, based on the non-homogeneous term. This generic form contains some uknown coefficients; the generic form of the candidate solution with unknown coefficients is then plugged into the non-homogeneous DE, and the resulting equation is solved for the unknown coefficients.
Sometimes, it is necessary to add an "extra degree of freedom" to the candidate solution, because without it it becomes impossible so solve for the coefficients. This happens when the candidate solution is also a solution ot the complementary homogeneous equation.
There are some appropriate forms to try as candidate particular solutions, in Table 1 below:

fcandidate $y_p$
$d$ (constant)$\alpha$ (constant)
$ex + d$$\alpha x + \beta$
$e^{\mu x}$$\alpha e^{\mu x}$
$\cos{\omega x}$ or $\sin{\omega x}$$\alpha \cos{\omega x} + \beta \sin{\omega x}$

If any term of $y_p$ is a solution of the homogeneous equation, multiply $y_p$ by $x$ (or by $x^2$ if necessary).

Method of variation of parameters

Another, more formal method to find a particular solution to a second-order linear non-homogeneous DE with constant coefficients, when you already know two independent solutions to the complementary homogeneous equation, is to replace the constants in the complementary function with functions. That is, search for a $y_p$ in the form

$$ y_p = u_1(x)y_1(x) + u_2(x)y_2(x) $$

Requiring $y_p$ to satisfy the non-homogeneous DE provides one equation that must be satisfied by the two functions $u_1$ and $u_2$. You can require them to satisfy a second, arbitrary equation, to have enough pieces of information to solve or $u_1$ and $u_2$ (a system of two equations with two unknowns). To simplify future calculations, this second arbitrary equation is chosen to be

$$ u_1'y_1 + u_2'y_2 = 0 $$

Now you have:

$$ y_p = u_1y_1 + u_2y_2 $$

$$ y_p' = u_1'y_1 + u_1y_1' + u_2'y_2 + u_2y_2' \rightarrow y_p' = u_1y_1' + u_2y_2' $$

$$ y_p'' = u_1'y_1' + u_1y_1'' + u_2'y_2' + u_2y_2'' $$

which you can plug into Equation 5:

$$ a_2y'' + a_1y' + a_0y = f(x) $$

$$ a_2(u_1'y_1' + u_1y_1'' + u_2'y_2' + u_2y_2'') + a_1(u_1y_1' + u_2y_2') + a_0(u_1y_1 + u_2y_2) = f(x) $$

$$ \textcolor{DarkRed}{a_2u_1'y_1'} + \textcolor{DarkGreen}{a_2u_1y_1''} + \textcolor{DarkRed}{a_2u_2'y_2'} + \textcolor{DarkBlue}{a_2u_2y_2''} + \textcolor{DarkGreen}{a_1u_1y_1'} + \textcolor{DarkBlue}{a_1u_2y_2'} + \textcolor{DarkGreen}{a_0u_1y_1} + \textcolor{DarkBlue}{a_0u_2y_2} = f(x) $$

$$ \textcolor{DarkRed}{a_2(u_1'y_1' + u_2'y_2')} + \textcolor{DarkGreen}{u_1(a_2y_1'' + a_1y_1' + a_0y)} + \textcolor{DarkBlue}{u_2(a_2y_2'' + a_1y_2' + a_0y_2)} = f(x) $$

$$ a_2(u_1'y_1' + u_2'y_2') = f(x) $$

Thus, the two unknown functions $u_1$ and $u_2$ satisfy the two equations:

$$ u_1'y_1 + u_2'y_2 = 0 $$

$$ u_1'y_1' + u_2'y_2' = \frac{f(x)}{a_2} $$

The system can be solved (e.g. with Cramer's rule):

$$ u_1' = -\frac{y_2(x)}{W(x)} \frac{f(x)}{a_2(x)} $$

$$ u_2' = \frac{y_1(x)}{W(x)} \frac{f(x)}{a_2(x)} $$

where $W(x)$ (the Wronskian of $y_1$ and $y_2$) is the determinant:

$$ W(x) = \begin{vmatrix} y_1(x) & y_2(x) \\ y_1'(x) & y_2'(x) \end{vmatrix} $$

At this point, $u_1$ and $u_2$ are found by integration and plug into the expression for the particular solution.