Skip to main content
Logo image

Section 2.1 Second order linear ODEs

Note: 1 lecture, reduction of order optional, first part of §3.1 in [EP], parts of §3.1 and §3.2 in [BD]
Consider the general second order linear differential equation
\begin{equation*} A(x) y'' + B(x)y' + C(x)y = F(x) . \end{equation*}
We usually divide through by \(A(x)\) to get
\begin{equation} y'' + p(x)y' + q(x)y = f(x) ,\tag{2.1} \end{equation}
where \(p(x) = \nicefrac{B(x)}{A(x)}\text{,}\) \(q(x) = \nicefrac{C(x)}{A(x)}\text{,}\) and \(f(x) = \nicefrac{F(x)}{A(x)}\text{.}\) The word linear means that the equation contains no powers nor functions of \(y\text{,}\) \(y'\text{,}\) and \(y''\text{.}\)
In the special case when \(f(x) = 0\text{,}\) we have a so-called homogeneous equation
\begin{equation} y'' + p(x)y' + q(x)y = 0 .\tag{2.2} \end{equation}
We have already seen some second order linear homogeneous equations.
\begin{equation*} \begin{aligned} \qquad y'' + k^2 y & = 0 & & \text{Two solutions are:} \quad y_1 = \cos (kx), \quad y_2 = \sin(kx) . \qquad \\ \qquad y'' - k^2 y & = 0 & & \text{Two solutions are:} \quad y_1 = e^{kx}, \quad y_2 = e^{-kx} . \qquad \end{aligned} \end{equation*}
If we know two solutions of a linear homogeneous equation, we know many more of them.
That is, we can add solutions together and multiply them by constants to obtain new and different solutions. We call the expression \(C_1 y_1 + C_2 y_2\) a linear combination of \(y_1\) and \(y_2\text{.}\) Let us prove this theorem; the proof is very enlightening and illustrates how linear equations work.
Proof: Let \(y = C_1 y_1 + C_2 y_2\text{.}\) Then
\begin{equation*} \begin{split} y'' + py' + qy & = (C_1 y_1 + C_2 y_2)'' + p(C_1 y_1 + C_2 y_2)' + q(C_1 y_1 + C_2 y_2) \\ & = C_1 y_1'' + C_2 y_2'' + C_1 p y_1' + C_2 p y_2' + C_1 q y_1 + C_2 q y_2 \\ & = C_1 ( y_1'' + p y_1' + q y_1 ) + C_2 ( y_2'' + p y_2' + q y_2 ) \\ & = C_1 \cdot 0 + C_2 \cdot 0 = 0 . \qed \end{split} \end{equation*}
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 is, but a function eats numbers and spits out numbers). Define the operator \(L\) by
\begin{equation*} Ly = y'' + py' + qy . \end{equation*}
The differential equation now becomes \(Ly=0\text{.}\) The operator (and the equation) \(L\) being linear means that \(L(C_1y_1 + C_2y_2) = C_1 Ly_1 + C_2 Ly_2\text{.}\) It is almost as if we were “multiplying” by \(L\text{.}\) The proof above becomes
\begin{equation*} Ly = L(C_1y_1 + C_2y_2) = C_1 Ly_1 + C_2 Ly_2 = C_1 \cdot 0 + C_2 \cdot 0 = 0 . \end{equation*}
Two different solutions to the second equation \(y'' - k^2y = 0\) are \(y_1 = \cosh (kx)\) and \(y_2 = \sinh (kx)\text{.}\) Recalling the definition of \(\sinh\) and \(\cosh\text{,}\) we note that these are solutions by superposition as they are linear combinations of the two exponential solutions: \(\cosh(kx) = \frac{e^{kx} + e^{-kx}}{2} = (\nicefrac{1}{2}) e^{kx} + (\nicefrac{1}{2}) e^{-kx}\) and \(\sinh(kx) = \frac{e^{kx} - e^{-kx}}{2} = (\nicefrac{1}{2}) e^{kx} - (\nicefrac{1}{2}) e^{-kx}\text{.}\)
The functions \(\sinh\) and \(\cosh\) are sometimes more convenient to use than the exponential. Let us review some of their properties:
\begin{equation*} \begin{aligned} & \cosh 0 = 1 , & & \sinh 0 = 0 , \\ & \frac{d}{dx} \Bigl[ \cosh x \Bigr] = \sinh x , & & \frac{d}{dx} \Bigl[ \sinh x \Bigr] = \cosh x , \\ & \cosh^2 x - \sinh^2 x = 1 . \end{aligned} \end{equation*}

Exercise 2.1.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.
For example, the equation \(y'' + k^2 y = 0\) with \(y(0) = b_0\) and \(y'(0) = b_1\) has the solution
\begin{equation*} y(x) = b_0 \cos (kx) + \frac{b_1}{k} \sin (kx) . \end{equation*}
The equation \(y'' - k^2 y = 0\) with \(y(0) = b_0\) and \(y'(0) = b_1\) has the solution
\begin{equation*} y(x) = b_0 \cosh (kx) + \frac{b_1}{k} \sinh (kx) . \end{equation*}
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.
Question: Suppose we find two different solutions \(y_1\) and \(y_2\) to the homogeneous equation (2.2). Can every solution be written (using superposition) in the form \(y = C_1 y_1 + C_2 y_2\text{?}\)
Answer is affirmative! Provided that \(y_1\) and \(y_2\) are different enough in the following sense. We say \(y_1\) and \(y_2\) are linearly independent if one is not a constant multiple of the other.
For example, we found the solutions \(y_1 = \sin x\) and \(y_2 = \cos x\) for the equation \(y'' + y = 0\text{.}\) It is not hard to see that sine and cosine are not constant multiples of each other. Indeed, if \(\sin x = A \cos x\) for some constant \(A\text{,}\) plugging in \(x=0\) would imply \(A = 0\text{.}\) But then \(\sin x = 0\) for all \(x\text{,}\) which is preposterous. So \(y_1\) and \(y_2\) are linearly independent. Hence,
\begin{equation*} y = C_1 \cos x + C_2 \sin x \end{equation*}
is the general solution to \(y'' + y = 0\text{.}\)
For two functions, checking linear independence is rather simple. Let us see another example. Consider \(y''-2x^{-2}y = 0\text{.}\) Then \(y_1 = x^2\) and \(y_2 = \nicefrac{1}{x}\) are solutions. To see that they are linearly independent, suppose one is a multiple of the other: \(y_1 = A y_2\text{,}\) we just have to find out that \(A\) cannot be a constant. In this case we have \(A = \nicefrac{y_1}{y_2} = x^3\text{,}\) this most decidedly not a constant. So \(y = C_1 x^2 + C_2 \nicefrac{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\text{,}\) then we try a second solution of the form \(y_2(x) = y_1(x) v(x)\text{.}\) We just need to find \(v\text{.}\) We plug \(y_2\) into the equation:
\begin{equation*} \begin{split} 0 = y_2'' + p(x) y_2' + q(x) y_2 & = \underbrace{y_1'' v + 2 y_1' v' + y_1 v''}_{y_2''} + p(x) \underbrace{( y_1' v + y_1 v' )}_{y_2'} + q(x) \underbrace{y_1 v}_{y_2} \\ & = 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{split} \end{equation*}
In other words, \(y_1 v'' + (2 y_1' + p(x) y_1) v' = 0\text{.}\) Using \(w = v'\text{,}\) we have the first order linear equation \(y_1 w' + (2 y_1' + p(x) y_1) w = 0\text{.}\) After solving this equation for \(w\) (integrating factor), we find \(v\) by antidifferentiating \(w\text{.}\) We then form \(y_2\) by computing \(y_1 v\text{.}\) For example, suppose we somehow know \(y_1 = x\) is a solution to \(y''+x^{-1}y'-x^{-2} y=0\text{.}\) The equation for \(w\) is then \(xw' + 3 w = 0\text{.}\) We find a solution, \(w = Cx^{-3}\text{,}\) and we find an antiderivative \(v = \frac{-C}{2x^2}\text{.}\) Hence \(y_2 = y_1 v = \frac{-C}{2x}\text{.}\) Any \(C\) works and so \(C=-2\) makes \(y_2 = \nicefrac{1}{x}\text{.}\) Thus, the general solution is \(y = C_1 x + C_2\nicefrac{1}{x}\text{.}\)
Since we have a formula for the solution to the first order linear equation, we can write a formula for \(y_2\text{:}\)
\begin{equation*} y_2(x) = y_1(x) \int \frac{e^{-\int p(x)\,dx}}{{\bigl(y_1(x)\bigr)}^2} \,dx \end{equation*}
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.

Exercises Exercises

2.1.2.

Show that \(y=e^x\) and \(y=e^{2x}\) are linearly independent.

2.1.3.

Take \(y'' + 5 y = 10 x + 5\text{.}\) Find (guess!) a solution.

2.1.4.

Prove the superposition principle for nonhomogeneous equations. Suppose that \(y_1\) is a solution to \(L y_1 = f(x)\) and \(y_2\) is a solution to \(L y_2 = g(x)\) (same linear operator \(L\)). Show that \(y = y_1+y_2\) solves \(Ly = f(x) + g(x)\text{.}\)

2.1.5.

For the equation \(x^2 y'' - x y' = 0\text{,}\) find two solutions, show that they are linearly independent and find the general solution. Hint: Try \(y = x^r\text{.}\)
Equations of the form \(a x^2 y'' + b x y' + c y = 0\) are called Euler’s equations or Cauchy–Euler equations. They are solved by trying \(y=x^r\) and solving for \(r\) (assume \(x \geq 0\) for simplicity).

2.1.6.

Suppose that \({(b-a)}^2-4ac > 0\text{.}\)
  1. Find a formula for the general solution of Euler’s equation (see above) \(a x^2 y'' + b x y' + c y = 0\text{.}\) Hint: Try \(y=x^r\) and find a formula for \(r\text{.}\)
  2. What happens when \({(b-a)}^2-4ac = 0\) or \({(b-a)}^2-4ac < 0\text{?}\)
We will revisit the case when \({(b-a)}^2-4ac < 0\) later.

2.1.7.

Same equation as in Exercise 2.1.6. Suppose \({(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: Try \(y=x^r \ln x\) for the second solution.

2.1.8. reduction of order.

Suppose \(y_1\) is a solution to \(y'' + p(x) y' + q(x) y = 0\text{.}\) By directly plugging into the equation, show that
\begin{equation*} y_2(x) = y_1(x) \int \frac{e^{-\int p(x)\,dx}}{{\bigl(y_1(x)\bigr)}^2} \,dx \end{equation*}
is also a solution.

2.1.9. Chebyshev’s equation of order 1.

Take \((1-x^2)y''-xy' + y = 0\text{.}\)
  1. Show that \(y=x\) is a solution.
  2. Use reduction of order to find a second linearly independent solution.
  3. Write down the general solution.

2.1.10. Hermite’s equation of order 2.

Take \(y''-2xy' + 4y = 0\text{.}\)
  1. Show that \(y=1-2x^2\) is a solution.
  2. Use reduction of order to find a second linearly independent solution. (It’s OK to leave a definite integral in the formula.)
  3. Write down the general solution.

2.1.101.

Are \(\sin(x)\) and \(e^x\) linearly independent? Justify.
Answer.
Yes. To justify try to find a constant \(A\) such that \(\sin(x) = A e^x\) for all \(x\text{.}\)

2.1.102.

Are \(e^x\) and \(e^{x+2}\) linearly independent? Justify.
Answer.
No. \(e^{x+2} = e^2 e^x\text{.}\)

2.1.103.

Guess a solution to \(y'' + y' + y= 5\text{.}\)
Answer.
\(y=5\)

2.1.104.

Find the general solution to \(x y'' + y' = 0\text{.}\) Hint: It is a first order ODE in \(y'\text{.}\)
Answer.
\(y=C_1 \ln(x) + C_2\)

2.1.105.

Write down an equation (guess) for which we have the solutions \(e^x\) and \(e^{2x}\text{.}\) Hint: Try an equation of the form \(y''+Ay'+By = 0\) for constants \(A\) and \(B\text{,}\) plug in both \(e^x\) and \(e^{2x}\) and solve for \(A\) and \(B\text{.}\)
Answer.
\(y''-3y'+2y = 0\)
For a higher quality printout use the PDF version: https://www.jirka.org/diffyqs/diffyqs.pdf