Skip to main content

# Introduction to Differential Equations

## Section2.1Second order linear ODEs

We now move to 2nd order ODEs. We shall begin with 2nd order linear ODEs which are much easier to handle than nonlinear ODEs. Some of the theory, like Existence and Uniqueness parallel the 1st order case pretty well. However, we shall see that there are some new complications like Superposition to think about and we are going to have a lot of parallels to linear algebra here.
Let us 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
$$y'' + p(x)y' + q(x)y = f(x) ,\tag{2.1}$$
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
$$y'' + p(x)y' + q(x)y = 0 .\tag{2.2}$$
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{.}$$ 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{.}$$ Let us remind ourselves of the definition, $$\cosh x = \frac{e^x + e^{-x}}{2}$$ and $$\sinh x = \frac{e^x - e^{-x}}{2}\text{.}$$ 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{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: 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. If $$\sin x = A \cos x$$ for some constant $$A\text{,}$$ we let $$x=0$$ and this 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 indepedent, suppose one is a multple 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$$ 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 & = 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{split} \end{equation*}
In other words, $$y_1 v'' + (2 y_1' + p(x) y_1) v' = 0\text{.}$$ Using $$w = v'$$ 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.

### Subsection2.1.1Exercises

#### Exercise2.1.1.

Show that $$y=e^x$$ and $$y=e^{2x}$$ are linearly independent.
Solution.
Let $$y_1=e^x$$ and $$y_2=e^2x\text{.}$$ If they’re linearly independent then $$y_2=Ay_1$$ where $$A$$ cannot be a constant independent of $$x\text{.}$$ $A=\frac{y_2}{y_1}=e^x$ $$A$$ clearly depends on $$x$$ so the two solutions are linearly independent.

#### Exercise2.1.2.

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{.}$$

#### Exercise2.1.3.

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

#### Exercise2.1.4.

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

#### Exercise2.1.5.

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

#### Exercise2.1.6.

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$$

#### Exercise2.1.7.

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{.}$$
Solution.
From $$Ly=f(x)+g(x)$$ $Ly_1+Ly_2=f(x)+g(x)$
\begin{equation*} \underbrace{(Ly_1-f(x))}_{=0,\ \textrm{from}\ Ly_1=f(x)}+\underbrace{(Ly_2-g(x))}_{=0\ \textrm{from}\ Ly_2=g(x)}=0 \end{equation*}

#### Exercise2.1.8.

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{.}$$
Solution.
$y=x^r, y’=rx^{r-1}, y’’=r(r-1)x^{r-2}$ Plugging into the ODE $r(r-1)x^r-rx^r=0 \rightarrow r^2-2r=0$ So $$r=0$$ or $$2\text{.}$$ The two solutions are $$y_1=1$$ and $$y_2=x^2\text{.}$$ Checking for linear dependence $A=\frac{y_2}{y_1}=x^2 \neq \textrm{const}$ So the solutions are linearly independent. The general solution is $y=c_1+c_2x^2$

#### Exercise2.1.9.

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$$
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 that $$x \geq 0$$ for simplicity).

#### Exercise2.1.10.

Suppose that $${(b-a)}^2-4ac > 0\text{.}$$
1. Find a formula for the general solution of $$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{?}$$
Answer.
(a) $$y=c_1x^{r_1}+c_2x^{r_2}$$ where
\begin{equation*} r_1=\frac{-(b-a)+\sqrt{(b-a)^2-4ac}}{2a},\quad r_2=\frac{-(b-a)-\sqrt{(b-a)^2-4ac}}{2a} \end{equation*}
Where $$r_1$$ and $$r_2$$ are real and distinct, since $$(b-a)^2-4ac >0$$ under the square root.
(b) If equal to 0, then $$r_1=r_2=r\text{.}$$ We would need to find another linearly independent solution since the two terms in the solution in part (a) become linearly dependent now.
If $$<0$$ then $$r_1$$ and $$r_2$$ become complex numbers (this case is dealt with in the following section).
We will revisit the case when $${(b-a)}^2-4ac < 0$$ later.

#### Exercise2.1.11.

Same equation as in Exercise 2.1.10. 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.
Answer.
$$y=c_1x^{(a-b)/2a}+c_2x^{(a-b)/2a}\ln x$$

#### Exercise2.1.12.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.
Solution.
\begin{equation*} y_2'=\frac{e^{-\int p(x) dx}}{y_1}+y_1'\int\frac{e^{-\int p(x)dx}}{y_1^2}dx \end{equation*}
\begin{equation*} y''_2=y_1''\int\frac{e^{-\int p(x)dx}}{y_1^2}dx-p(x)\frac{e^{-\int p(x)dx}}{y_1} \end{equation*}
Plugging into the ODE and simplifying
\begin{equation*} y_1''\int\frac{e^{-\int p(x)dx}}{y_1^2}dx+p(x)y_1'\int\frac{e^{-\int p(x)dx}}{y_1^2}dx+q(x)y_1\int\frac{e^{-\int p(x)dx}}{y_1^2}dx=0 \end{equation*}
\begin{equation*} \int\frac{e^{-\int p(x)dx}}{y_1^2}dx\underbrace{\left(y_1''+p(x)y_1'+q(x)y_1\right)}_{=\ 0\ \textrm{since}\ y_1\ \textrm{is a solution}}=0 \end{equation*}
Therefore $$y_2=y_1\int\frac{e^{-\int p(x)dx}}{y_1^2}dx$$ is also a solution.

#### Exercise2.1.13.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.
Solution.
(a) $y=x, y’=1, y’’=0$ Plugging into the ODE gives $0-x+x=0$
(b) The second solution can either be derived from $$y_2=y_1v(x)$$ and plugging into the ODE to find the solution for $$v(x)\text{,}$$ or by applying the result of that directly using the reduction of order formula
\begin{equation*} y_2=y_1\int\frac{e^{-\int p(x)dx}}{y_1^2}dx=x\int\frac{e^{-\int\frac{-x}{1-x^2}dx}}{x^2}dx \end{equation*}
\begin{equation*} y_2=x\int \frac{\lvert 1-x^2 \rvert^{-1/2}}{x^2}dx=\begin{cases} & -\sqrt{1-x^2},\quad -1\leq x \leq 1 \\ & \sqrt{x^2-1},\quad \textrm{otherwise} \end{cases} \end{equation*}

(c) $$y=c_1x+c_2\sqrt{\lvert 1-x^2\rvert}$$ where the sign difference is absorbed in the constant.

#### Exercise2.1.14.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.
Answer.
(b) $$y_2=(1-2x^2)\int_0^x\frac{e^{t^2}}{(1-2t^2)^2}dt$$
(c) $$y=c_1(1-2x^2)+c_2(1-2x^2)\int_0^x\frac{e^{t^2}}{(1-2t^2)^2}dt$$
For a higher quality printout use the PDF version: https://www.jirka.org/diffyqs/diffyqs.pdf