# 2.1: Second order linear ODEs

$$\newcommand{\vecs}{\overset { \rightharpoonup} {\mathbf{#1}} }$$ $$\newcommand{\vecd}{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}}$$$$\newcommand{\id}{\mathrm{id}}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\kernel}{\mathrm{null}\,}$$ $$\newcommand{\range}{\mathrm{range}\,}$$ $$\newcommand{\RealPart}{\mathrm{Re}}$$ $$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$ $$\newcommand{\Argument}{\mathrm{Arg}}$$ $$\newcommand{\norm}{\| #1 \|}$$ $$\newcommand{\inner}{\langle #1, #2 \rangle}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\id}{\mathrm{id}}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\kernel}{\mathrm{null}\,}$$ $$\newcommand{\range}{\mathrm{range}\,}$$ $$\newcommand{\RealPart}{\mathrm{Re}}$$ $$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$ $$\newcommand{\Argument}{\mathrm{Arg}}$$ $$\newcommand{\norm}{\| #1 \|}$$ $$\newcommand{\inner}{\langle #1, #2 \rangle}$$ $$\newcommand{\Span}{\mathrm{span}}$$$$\newcommand{\AA}{\unicode[.8,0]{x212B}}$$

Let us consider the general second order linear differential equation

$A(x)y'' + B(x)y' + C(x)y = F(x). \nonumber$

We usually divide through by $$A(x)$$ to get

$y'' + p(x)y' + q(x)y = f(x), \nonumber$

where $$p(x) = \frac{B(x)}{A(x)}$$, $$q(x)=\frac{C(x)}{A(x)}$$, and $$f(x) = \frac{F(x)}{A(x)}$$. The word linear means that the equation contains no powers nor functions of $$y$$, $$y'$$, and $$y''$$.

In the special case when $$f(x)=0$$ we have a so-called homogeneous equation

$\label{eq:3}y'' + p(x)y' + q(x)y = 0,$

We have already seen some second order linear homogeneous equations:

$\begin{array}{lll}{y''+k^{2}y=0}&{\text{Two solutions are:}}&{y_{1}=\cos(kx),\quad y_{2}=\sin (kx).} \\ {y''-k^{2}y=0}&{\text{Two solutions are:}}&{y_{1}=e^{kx},\quad y_{2}=e^{-kx}.} \end{array} \nonumber$

If we know two solutions of a linear homogeneous equation, we know a lot more of them.

## Theorem $$\PageIndex{1}$$: Superposition

Suppose $$y_1$$ and $$y_2$$ are two solutions of the homogeneous equation $$\eqref{eq:3}$$. Then

$y(x) = C_1y_1(x) + C_2y_2(x), \nonumber$

also solves $$\eqref{eq:3}$$ for arbitrary constants $$C_1$$ and $$C_2$$.

That is, we can add solutions together and multiply them by constants to obtain new and different solutions. We call the expression $$C_1y_1+C_2y_2$$ a linear combination of $$y_1$$ and $$y_2$$. Let us prove this theorem; the proof is very enlightening and illustrates how linear equations work.

Proof

Let $$y = C_1y_1 + C_2y_2$$. Then

\begin{aligned} y'' + py' + qy &= (C_1y_1 + C_2y_2)'' + p(C_1y_1 + C_2y_2)' + q(C_1y_1 + C_2y_2)\\ &= C_1y''_1 + C_2y''_2 + C_1py'_1 + C_2py'_2 + C_1qy_1 + C_2qy_2 \\ &= C_1(y''_1 + py'_1 + qy_1) + C_2(y''_2 + py'_2 + qy_2) \\ & = C_1.0 + C_2.0 = 0 \end{aligned} \nonumber

The proof becomes even simpler to state if we use the operator notation. An operator is an object that eats functions and spits out functions (kind of like what a function, which eats numbers and spits out numbers). Define the operator $$L$$ by

$Ly=y''+py'+qy. \nonumber$

The differential equation now becomes $$Ly=0$$. The operator (and the equation) $$L$$ being linear means that $$L(C_1y_1 + C_2y_2) = C_1Ly_1 + C_2Ly_2$$. The proof above becomes

$Ly = L(C_1y_1 + C_2y_2) = C_1Ly_1 + C_2Ly_2 = C_1.0 + C_2.0 = 0 \nonumber$

Two different solutions to the second equation $$y'' - k^2y = 0$$ are $$y_1 = \cosh(kx)$$ and $$y_2 = \sinh (kx)$$. Let us remind ourselves of the definition, $$\cosh x = \frac {e^x + e^{-x}}{2}$$ and $$\sinh x = \frac {e^x - e^{-x}}{2}$$. Therefore, these are solutions by superposition as they are linear combinations of the two exponential solutions.

The functions $$\sinh$$ and $$\cosh$$ are sometimes more convenient to use than the exponential. Let us review some of their properties.

$\begin{array}{lll}{\cosh 0=1}&{\quad}&{\sinh 0=0,} \\ {\frac{d}{dx}\left[\cosh x \right]=\sinh x,} &{\quad}&{\frac{d}{dx}\left[\sinh x\right] =\cosh x,} \\ {\cosh^{2}x-\sinh^{2}x=1.}&{}&{}\end{array} \nonumber$

## Exercise $$\PageIndex{1}$$

Derive these properties using the definitions of $$\sinh$$ and $$\cosh$$ in terms of exponentials.

Linear equations have nice and simple answers to the existence and uniqueness question.

## Theorem $$\PageIndex{2}$$: Existence and Uniqueness

Suppose $$p(x)$$, $$q(x)$$, and $$f(x)$$ are continuous functions on some interval $$I$$ containing $$a$$ with $$a$$, $$b_0$$ and $$b_1$$ constants. The equation

$y'' + p(x)y' + q(x)y = f(x). \nonumber$

has exactly one solution $$y(x)$$ defined on the same interval $$I$$ satisfying the initial conditions

$y(a)=b_{0},\quad y'(a)=b_{1}. \nonumber$

For example, the equation $$y'' + k^2y = 0$$ with $$y(0) = b_0$$ and $$y'(0) = b_1$$ has the solution

$y(x) = b_0 \cos (kx) + \frac {b_1}{k} \sin (kx) \nonumber$

The equation $$y'' - k^2y = 0$$ with $$y(0) = b_0$$ and $$y'(0) = b_1$$ has the solution

$y(x) = b_0 \cosh (kx) + \frac {b_1}{k} \sinh (kx) \nonumber$

Using $$\cosh$$ and $$\sinh$$ in this solution allows us to solve for the initial conditions in a cleaner way than if we have used the exponentials.

The initial conditions for a second order ODE consist of two equations. Common sense tells us that if we have two arbitrary constants and two equations, then we should be able to solve for the constants and find a solution to the differential equation satisfying the initial conditions.

## Exercise $$\PageIndex{2}$$

Suppose we find two different solutions $$y_1$$ and $$y_2$$ to the homogeneous equation $$\eqref{eq:3}$$. Can every solution be written (using superposition) in the form $$y = C_1y_1 + C_2y_2$$?

Answer is affirmative! Provided that $$y_1$$ and $$y_2$$ are different enough in the following sense. We will say $$y_1$$ and $$y_2$$ are linearly independent if one is not a constant multiple of the other.

## Theorem $$\PageIndex{3}$$

Let $$p(x)$$ and $$q(x)$$ be continuous functions and let $$y_1$$ and $$y_2$$ be two linearly independent solutions to the homogeneous equation $$\eqref{eq:3}$$. Then every other solution is of the form

$y=C_1y_1 + C_2y_2. \nonumber$

That is, $$y = C_1 y_1 + C_2 y_2$$ is the general solution.

For example, we found the solutions $$y_1 = \sin x$$ and $$y_2 = \cos x$$ for the equation $$y'' + y = 0$$. It is not hard to see that sine and cosine are not constant multiples of each other. If $$\sin x = A \cos x$$ for some constant $$A$$, we let $$x=0$$ and this would imply $$A = 0$$. But then $$\sin x = 0$$ for all $$x$$, which is preposterous. So $$y_1$$ and $$y_2$$ are linearly independent. Hence, $y = C_1 \cos x + C_2 \sin x \nonumber$ is the general solution to $$y'' + y = 0$$.

For two functions, checking linear independence is rather simple. Let us see another example. Consider $$y''-2x^{-2}y = 0$$. Then $$y_1 = x^2$$ and $$y_2 = \frac{1}{x}$$ are solutions. To see that they are linearly independent, suppose one is a multiple of the other: $$y_1 = A y_2$$, we just have to find out that $$A$$ cannot be a constant. In this case we have $$A = \frac{y_1}{y_2} = x^3$$, this most decidedly not a constant. So $$y = C_1 x^2 + C_2 \frac{1}{x}$$ is the general solution.

If you have one solution to a second order linear homogeneous equation, then you can find another one. This is the reduction of order method. The idea is that if we somehow found $$y_1$$ as a solution of $$y'' + p(x) y' + q(x) y = 0$$ we try a second solution of the form $$y_2(x) = y_1(x) v(x)$$. We just need to find $$v$$. We plug $$y_2$$ into the equation:

\begin{align}\begin{aligned} 0 = y_2'' + p(x) y_2' + q(x) y_2 & = y_1'' v + 2 y_1' v' + y_1 v'' + p(x) ( y_1' v + y_1 v' ) + q(z) y_1 v \\ & = y_1 v'' + (2 y_1' + p(x) y_1) v' + \cancelto{0}{\bigl( y_1'' + p(x) y_1' + q(x) y_1 \bigr)} v . \end{aligned}\end{align} \nonumber In other words, $$y_1 v'' + (2 y_1' + p(x) y_1) v' = 0$$. Using $$w = v'$$ we have the first order linear equation $$y_1 w' + (2 y_1' + p(x) y_1) w = 0$$. After solving this equation for $$w$$ (integrating factor), we find $$v$$ by antidifferentiating $$w$$. We then form $$y_2$$ by computing $$y_1 v$$. For example, suppose we somehow know $$y_1 = x$$ is a solution to $$y''+x^{-1}y'-x^{-2} y=0$$. The equation for $$w$$ is then $$xw' + 3 w = 0$$. We find a solution, $$w = Cx^{-3}$$, and we find an antiderivative $$v = \frac{-C}{2x^2}$$. Hence $$y_2 = y_1 v = \frac{-C}{2x}$$. Any $$C$$ works and so $$C=-2$$ makes $$y_2 = \frac{1}{x}$$. Thus, the general solution is $$y = C_1 x + C_2\frac{1}{x}$$.

Since we have a formula for the solution to the first order linear equation, we can write a formula for $$y_2$$: $y_2(x) = y_1(x) \int \frac{e^{-\int p(x)\,dx}}{{\bigl(y_1(x)\bigr)}^2} \,dx \nonumber$ However, it is much easier to remember that we just need to try $$y_2(x) = y_1(x) v(x)$$ and find $$v(x)$$ as we did above. Also, the technique works for higher order equations too: you get to reduce the order for each solution you find. So it is better to remember how to do it rather than a specific formula.

We will study the solution of nonhomogeneous equations in Section 2.5. We will first focus on finding general solutions to homogeneous equations.

This page titled 2.1: Second order linear ODEs is shared under a not declared license and was authored, remixed, and/or curated by Jiří Lebl.