Ordinary Differential Equations/Second Order

< Ordinary Differential Equations

In this chapter we will primarily be focused on linear second order ordinary differential equations. That is, we will be interested in equations of the form (\text{LIVP})\qquad\begin{cases}y'' + p(x)y' + q(x)y = g(x)\\y(x_0)=y_0\\y'(x_0)=y'_0\end{cases}.

While it doesn't often enter into the business of finding solutions to differential equations it is important to keep in mind when there is even hope that a solution exists. The following theorem tells us at least one case where we can hope to find solutions.

Theorem Suppose p(x),\, q(x) and g(x)\, are continuous functions defined on an open interval  I and that x_0\in I. Then there exists a unique function y(x) defined on I that satisfies the ordinary differential equation y''(x) + p(x)y' + q(x)y = g(x) and satisfies the initial conditions y(x_0)=y_0, y'(x_0)=y_0'.

Putting the proof of this fact aside for now, even knowing this statement still provides us with a lot of information. In particular it gives some idea of how many solutions there are. One way of looking at what this theorem is saying is that a solution is completely determined by two numbers, namely y_0 and y'_0

We first reduce this problem to the homogeneous case, that is g(x)=0 . Later we will introduce methods that will allow us to leverage our understanding of the homogeneous problem to better understand the non-homogeneous case. Thus we are interested in the problem of fiding solutions to

(\text{LH})\qquad y''+p(x)y'+q(x)y=0

The first thing to notice is that if y_1 and y_2 are solutions to (LH), then for any two real numbers c_1 and c_2, then c_1y_1+c_2y_2 is also a solution. This may be directly verified by substituting into the left hand side of (LH).

=& c_1y_1''+c_2y_2'' + c_1p(x)y_1'+c_2p(x)y_2'+ c_1q(x)y_1+c_2q(x)y_2\\
=& c_1(y_1''+p(x)y_1'+q(x)y_1)+c_2(y_2''+p(x)y_2'+q(x)y_2)=c_1\cdot 0+c_2\cdot 0=0

If you're familiar with linear algebra, then you'll recall that a transformation is called linear if T(v+w)=T(v)+T(w). So what we are really seeing is that the left hand side of the ODE is a linear transformation on functions, and it is for this reason the equation is called linear.

Now this gives us a very interesting fact for the homogeneous case. Recall we mentioned above that our existence theorem tells us all solutions are parametrized by two initial conditions. Putting this together with the fact that linear combinations of solutions to the homogeneous problem are again solutions, it becomes interesting to investigate what initial value problems we can solve simply by taking linear combinations of solutions that we already know.

This is, given fixed numbers y_0 and y'_0 we consider the problem

(\text{LHIVP})\qquad \begin{cases}y''+p(x)y'+q(x)y=0\\y(x_0)=y_0,\quad y'(x_0)=y'_0.\end{cases}

Suppose we know two solutions to the homogeneous problem, y_1 and y_2 but suppose that y_1 and y_2 don't satisfy the initial conditions. Since we are interested in solving the initial value problem y(x_0)=y_0 and y'(x_0)=y'_0 and we know that linear combinations of solutions are again solutions we can ask the question: "Is it possible that y=c_1y_1+c_2y_2?"

If that were the case we could evaluate y to check the initial conditions. So we would need to have that:




But it is important not to lose sight of the fact that we are assuming that y_1 and y_2 are just fixed functions that we know. So y_1(x_0), y_1'(x_0), y_2(x_0), and y_2'(x_0) are simply four numbers that we know.

This means we are really trying to solve the following linear system with two equations and two unknowns:

c_1y_1(t_0) &+ c_2y_2(t_0) &=y_0\\
c_1y_1'(t_0) &+ c_2y_2'(t_0) &=y_0'

From linear algebra we know that such a system can be solved for any set of initial conditions y_0 and y'_0 provided we know the determinant of the coefficient matrix is not zero. In this two by two case that is simply y_1(x_0)y_2'(x_0)-y_2(x_0)y_1'(x_0). This determinant, in the subject of ODE's, is named after the mathematician who first used it systematically. It is known as the Wronskian, which we will now give a more formal definition.

Definition: Given functions y_1 and y_2 the Wronskian of y_1 and y_2 is the function W(y_1, y_2)(x):=y_1(x)y_2'(x)-y_2(x)y_1'(x).

Our discussion above can be summarized by the following theorem.


Suppose y_1 and y_2 are two solutions to the linear homogeneous problem (LH). Then every solution to the initial value problem

\begin{cases}y'' + p(x)y' + q(x)y = 0,\\y(x_0)=y_0,\\y'(x_0)=y'_0.\end{cases}

may be written as a linear combination of y_1 and y_2 provided that the Wronskian W(y_1, y_2)(x_0)\neq 0.


Constant CoefficientsEdit

The first tractable problem is to consider the case when p(x) and q(x) are constants. For convenience we also allow y'' to have a non-zero constant. Thus we are interested in the equations.

ay'' + by' + cy = g(x),

where a, b and c are real numbers with a \neq 0.

The homogeneous equation associated with this is

ay'' + by' + cy = 0\,.

Our experience first order differential equations tells us that any solution to ay'-by=0 has form e^{rx} (in this case r=b/a). It turns out to be worth effort to see if such a function will ever be the solution to the equation we are considering. So we simply substitute y = e^{rx} in to our equation to get:

a r^2 e^{rx} + bre^{rx} + ce^{rx} = (ar^2+br+c)e^{rx}=0\,,

Since e^{rx} is never zero, the only way for the product to be zero is if r happend to satisfy:


This equation is known as the characteristic equation associated with the homogeneous differential equation and the polynomial ar^2+br+c is called the characteristic polynomial. Since a, b, c are real numbers there are three cases to consider.

Real distinct rootsEdit

The first case is that b^2-4ac>0, in which case the quadratic formula furnishes us with two real numbers r_1, r_2 so that ar_1^2+br_1+c=0=ar_2^2+br_2+c. In this case our calculation above shows us that e^{r_1x} and e^{r_2x} are two different solutions to our equation. As you will show in the exercises the Wronskian of e^{r_1x} and e^{r_2x} is not zero in this case. Thus we have found two solutions to the equation, and by our theorem we can represent every solution as a linear combination of these two solutions.

Example 1

Find the general solution to y''-3y'+2y=0. In this the characteristic equation is r^2-3r+2=0. The polynomial r^2-3r+2=(r-2)(r-1) has two real roots, r_1=1 and r_2=2. So we have two solutions y_1=e^x and y_2=e^{2x}. Since these are two different solutions to a second order equation they form a fundamental solution set. So if y is a general solution then


Example 2

Find the solution to the initial value problem:

\begin{cases}y''-2y'+3y=0\\y(0)=1\\y'(0)=0 \end{cases}.

For this ODE, r^2-2r+3=0. This characteristic polynomial factors r^2-r+3=(r+1)(r-3) so there two roots: r_1=-1, r_2=3. Thus our two solutions to the ODE are y_1=e^{-x} and y_2=e^{3x}. This leads us to the general solution of:


In order to solve the initial value problem we now substitute in the values given. That is

y(0)=c_1e^{-0}+c_2e^{3\cdot 0}=c_1+c_2 and so c_1+c_2=1.


y'(0)=-c_1e^{-0}+3c_2e^{3\cdot 0}=-c_1+3c_2 and so -c_1+3c_2=0.

This means we need to solve the 2×2 system:

&c_1 +& \!\!\!\!&c_2&\!\!\!\!= 1\\
-&c_1 +&\!\!\!\!3&c_2&\!\!\!\!= 0

Adding the first equation to the second we see that 4c_2=1, and so c_2=\tfrac{1}{4}. Hence, by substituting c_2 into the first equation we get c_1+\tfrac{1}{4}=1 and so c_1=\tfrac{3}{4}.

This means the solution to our initial value problem is y=\tfrac{3}{4}e^{-x}+\tfrac{1}{4}e^{3x}.

Complex rootsEdit

The second case to consider is when b^2-4ac < 0. In this case the theory is almost identical. Since the coefficients of the characteristic equation we know we may right r_1=z+iw and r_2=z-iw and that e^{r_1 x} and e^{r_2 x} are two solutions, and in fact form a fundamental solution set.

This being said, it is perhaps a bit disturbing to some of us to describe a real valued solution to an ode with real coefficients (and real initial data) using complex numbers. For this reason it is atheistically pleasing to find two real valued solutions. In order to do this it helps to know a little bit about what it even meas to raise a number to the a complex power.

In our setting the answer is provided by Euler's formula, which states that for a real number \theta: e^{i\theta}=\cos\theta + i\sin\theta. Let's take a quick look at why this is the formula makes any sense at all. The idea is it examine the series power series for e^x=1+x+x^2/2+x^3/3!+\ldots=\sum_{n=0}^\infty \frac{x^n}{n!}. Then plugging in i\theta for x and collecting real and imaginary parts we get:


This calculation is justified because these power series are absolutely convergent, and so we may rearrange the terms as we see fit. For more general complex numbers we may define e^{z+iw} as e^ze^{iw}. Thus using these definitions we may rewrite our two solutions as:

\begin{align}y_1=e^{zx}(\cos(wx) +i\sin(wx))\\y_2=e^{zx}(\cos(wx)-i\sin(wx))\end{align}.

Since any linear combination of these two solutions is again a solution we note that two particularly nice linear combinations are:

\begin{align}&\tilde y_1=\frac{y_1+y_2}{2}=e^{zx}\cos(wx)\\
&\tilde y_2=\frac{y_1-y_2}{2i}=e^{zx}\sin(wx)\end{align}

For those uncomfortable with complex variables the above discussion may seem a bit unclear. But it may simply be considered as motivation. That is if we remember z=\frac{-b}{2a} and w=\frac{\sqrt{4ac-b^2}}{2a} one may directly verify that \tilde y_1 and \tilde{y_2} solve (LH). It is also left to the reader to verify that W(\tilde y_1,\tilde y_2)(x_0)\neq 0. This in this case as well we also find a fundamental solution set.

Example 3

Solve the initial value problem

\begin{cases}y''+2y'+5y=0\\y(0)=0\qquad y'(0)=1.\end{cases}

In this case our characteristic polynomial is r^2+2r+5. Using the quadratic formula we see the roots are r_1=\frac{-2+\sqrt{4-4\cdot 1\cdot 5}}{2\cdot 1}=-1+2i and r_2=-1-2i.. This means two solutions to this differential equation are given by:

y_1=e^{-x}\cos(2x) and y_2=e^{-x}\sin(2x).

So we know that the general solution has the form y=c_1e^{-x}\cos(2x)+c_2e^{-x}\sin(2x). Now we need to use the initial conditions to solve for c_1 and c_2. We start by calculating the derivative of y:

y'=-c_1\big(e^{-x}\cos(2x)+2e^{-x}\sin(2x)\big)+c_2\big(-e^{-x}\sin(2x)+2e^{-x}\cos(2x)\big) .

Thus, using the initial conditions we see that:

\begin{align}&0=y(0)=c_1\cdot 1+c_2\cdot 0=c_1\\&1=y'(0)=-c_1\cdot(0+2)+c_2\cdot(-2+0)=-2c_1-2c_2\end{align}

From this we see immediately that c_1=0 and c_2=-\tfrac{1}{2}. Thus y=-\tfrac{1}{2}e^{-x}\sin(2x) is the solution to our initial value problem.

Example 4

Find the general solution to:


In this case our characteristic equation is 4r^2+1=0, whose roots are r_1=\tfrac{i}{2} and r_2=-\tfrac{i}{2}. Notice that these two solutions have the form 0+\tfrac{1}{2}i and 0-\tfrac{1}{2}i, or in other words using the notation above z=0 and w=\tfrac{1}{2}. When there is no real part to the complex number, that just means the z=0. In this case we get y_1=e^{0\cdot x}\cos(\tfrac{x}{2})=\cos(\tfrac{x}{2}) and similarly y_2=\sin(\tfrac{x}{2}).

Therefore the general solution to this ODE is:


Repeated Real RootsEdit

In the case when b^2-4ac=0 finding two solutions is slightly more difficult. In this case our characteristic polynomial factors into a(r+\frac{b}{2a})^2. In this case we have only one root, namely r_1=\frac{-b}{2a}. We still obtain the solution y_1=e^{r_1x}, the question becomes how do we find a second solution?

Luckily there is one very nice property of the characteristic polynomial. In general, if a polynomial the a repeated root then the derivative of our polynomial also has this root. (Since the polynomial depends on r, we mean here a derivative with respect to r.) In our case this is easily seen, let P(r)= a(r+\frac{b}{2a})^2 then we have

P'(r)=2a(r+\frac{b}{2a})    and so

Since our characteristic polynomial came from considering a(e^{rx})''+b(e^{rx})'+c(e^{rx}) We might hope that taking a derivative in r might help us find another solution to try.

So we start by considering:

\frac{d}{dr}\big(a(e^{rx})''+b(e^{rx})'+c(e^{rx})\big)=\frac{d}{dr}\big((ar^2+br+c)e^{rx}\big)=(2ar+b)e^{rx} + (ar^2+br+c)xe^{rx}.

Now if r=r_1=\frac{-b}{2a} then (2ar_1+b)=0 and (ar_1^2+br_1+c)=0. Hence (2ar_1+b)e^{r_1x} + (ar_1^2+br_1+c)xe^{rx}

On the other hand, remembering that derivatives commute, we might have calculated this a bit differently to get:


That is we are really just looking at xe^{rx} plugged into our differential equation, but we know from our first calculation this should be zero. So it seems that xe^{rx} should be a solution.

Changing the order of the derivatives in x and the derivatives in r is allowed because e^{rt} has continuous derivatives of all orders in x and r. So we can let y_2=xe^{r_1x}. It can be checked that W(y_1, y_2)(x_0)\neq 0 and so we again have that y_1 and y_2 form a fundamental solution set.

Example 5

Suppose we want to find the general solution to


In this case our characteristic equation is r^2+4r+4=0 which has only one root r_1=-2. And so according to our theory above a fundamental set of solutions are given by y_1=e^{-2x} and y_2=xe^{-2x}, and so the general solution is given by:

Example 6

If we want to solve the initial value problem

\begin{cases}9y''-6y+y\\y(0)=3\quad y'(0)=1.\end{cases}

Then our characteristic equation is 9r^2-6r+1=0. The quadratic formula gives r_{1,2}=\tfrac{6\pm\sqrt{36-4(9)(1)}}{2\cdot 9}=\tfrac{1}{3}. The fundamental solution set is given by y_1=e^{x/3} and y_1=xe^{x/3}, and therefore our general solution is y_1=c_1e^{x/3}+c_2xe^{x/3}. We can now calculate y_1'=c_1(\tfrac{1}{3}e^{x/3})+c_2(e^{x/3}+\tfrac{1}{3}xe^{x/3}).

More about the WronskianEdit

In the above conversation we it was always necessary to check the Wronskian at the initial point x_0 in order to see if the set of functions formed a fundamental solution set. This leaves us with the uncomfortable possibility that perhaps our fundamental solution set at one point x_0 would not be a fundamental solution set if we choose to have our initial conditions at x_1. Thankfully this turns out not to be the case.

Abel's Theorem

Suppose that y_1, and y_2 are solutions to (LH). Then we have that

W(y_1, y_2)(x)=Ce^{-\int_{x_0}^x p(t)\,dt},

where C is a constant depending on y_1 and y_2

To begin proving this we start by taking the derivative of W(y_1, y_2).

W'(y_1, y_2)=(y_1y_2')'-(y_2y_1')'=y_1'y_2'+y_1y_2''-y_2'y_1'-y_2y_1''=y_1y_2''-y_2y_1''.

Next we use the equation (LH) to work out what y_1'' and y_2'' are.

y_1''=-p(x)y_1'-q(x)y_1 and


W'(y_1, y_2)=y_1(-p(x)y_2'-q(x)y_2)-y_2(-p(x)y_1'-q(x)y_1)=-p(x)y_1y_2'+p(x)y_2y_1'

By inspection we see that W'(y_1,y_2)=-p(x)W(y_1,y_2). We know the solution to this ODE is given by

W(y_1, y_2)=Ce^{-\int_{x_0}^x p(t)\,dt}.

Finally if we plug in t_0 we get that C=W(y_1, y_2)(x_0). Thus we can write our final formula as

W(y_1,y_2)(t)=W(y_1, y_2)(x_0)e^{\int_{x_0}^x p(t)\,dt}.

The important thing for us to notice is that e^{\int_{x_0}^x p(t)\,dt} is never zero. So for any real number x we see that W(y_1, y_2)(t)=0 if and only if W(y_1, y_2)(x_0)=0. This tells us exactly that either y_1 and y_2 are a fundamental solution set or they are not, where we take our initial data does not change that fact.

2: Series SolutionsEdit

As mentioned when we began second order ODE's, equations of the form y'' + p(x)y' + q(x)y = g(x) are guaranteed to have a unique solution when p(x),q(x), g(x)and are continuous on an open interval that includes the initial condition. However, problems of this form are not guaranteed to have a closed-form solution, a solution that can be expressed in terms of "well-known" functions like x^2 and \sin(x). We can get arround this by using Taylor's theorem from Calculus. Because we don't know the solution itself, we try a solution of the form  y=\sum_{n=0}^{\infin} a_n(x-x_0)^{n}, a power series, instead of using the definition of the Taylor series.

Series Solutions of Homogeneous ODE'sEdit

Much like the method used for constant coefficients, we take our assumed solution form, differentiate it, and plug it into the equation. We then collect each series into a single series after matching both the powers of x and the indices. Because the collected series is equal to zero in the homogeneous case, each coefficient of x must also be equal to zero. We then use this fact to find a recurrence relationship between the successive values of a_n.

Example 1

Find a series solution to the following initial value problem about x_0=0.

y'' + x^2 y' + y = 0, \, y(0)=y_0, \, y'(0)=y'_0

We begin by differentiation and plugging in our assumed form.

y=\sum_{n=0}^{\infin} a_n x^{n}
y'=\sum_{n=1}^{\infin} a_n n x^{n-1}
y''=\sum_{n=2}^{\infin} a_n n(n-1) x^{n-2}
\sum_{n=2}^{\infin} a_n n(n-1) x^{n-2}+x^2\sum_{n=1}^{\infin} a_n n x^{n-1}+\sum_{n=0}^{\infin} a_n x^{n}=0

Note that because the first term of each series is a constant, and the derivative of a constant is zero, each derivative has its starting index increased by one. We then move the x^2 into the series.

\sum_{n=2}^{\infin} a_n n(n-1) x^{n-2}+\sum_{n=1}^{\infin} a_n n x^{n+1}+\sum_{n=0}^{\infin} a_n x^{n}=0

In order to combine the series in a useful manner, we match the powers of x and the indices. To match the powers we change the indices. To do so, we add (or subtract) an integer to the index and substitute n minus (or plus) that number for n in the series itself.

\sum_{n=0}^{\infin} a_{n+2} (n+2)(n+1) x^{n}+\sum_{n=2}^{\infin} a_{n-1} (n-1) x^{n}+\sum_{n=0}^{\infin} a_n x^{n}=0

The last step before combining the series is pulling terms out of the series to match the indices.

a_{2}(2)(1)+a_{3}(3)(2) x+\sum_{n=2}^{\infin} a_{n+2} (n+2)(n+1) x^{n} + \sum_{n=2}^{\infin} a_{n-1} (n-1) x^{n}+a_0+a_1 x + \sum_{n=2}^{\infin} a_n x^{n}=0

Combining the series and like powers of x yields

(2 a_2+a_0)+(6a_3+a_1)+\sum_{n=2}^{\infin} [a_{n+2} (n+2)(n+1)+a_{n-1} (n-1)+a_n] x^{n}=0

In order for that equation to hold for every value of x, the coefficients of each power of x must be zero. This yields

2 a_2 + a_0 = 0
6 a_3 + a_1 = 0
a_{n+2}(n+2)(n+1) + a_{n-1}(n-1) + a_n = 0

Solving each for the last a_n yields

a_2 = (-1/2) \, a_0
a_3 = (-1/6) \, a_1
a_{n+2}  = \frac{- a_{n-1}(n-1) - a_n}{(n+2)(n+1)}

The last equation above is called a recurrence relation. Given the previous three values of a, the next value of a can be determined. Note that given a_0 and a_1, we can determine the values of all a_n. This is consistent with our expectation that the solution to a second order linear ODE should have two arbitrary constants.

Taking derivatives and plugging in zero, we find that a_0=y_0 and a_1=y'_0. Thus, the solution to our initial value problem is

y=\sum_{n=0}^{\infin} a_n x^{n}
a_2 = (-1/2) \, a_0
a_3 = (-1/6) \, a_1
a_{n+2}  = \frac{- a_{n-1}(n-1) - a_n}{(n+2)(n+1)}

Series Solutions of Nonhomogeneous ODE'sEdit

Series Solutions of ODE's about Regular Singular PointsEdit

Series Solutions of ODE's about Irregular Singular PointsEdit

3: Hypergeometric EquationsEdit

4: Frobenius Solution to the Hypergeometric EquationEdit

5: Legendre EquationEdit

6: Bessel EquationEdit

The Bessel differential equation has the form x2y+xy'+(x2-n2)y=0

7: Mathieu EquationEdit

8: Continued Fraction SolutionsEdit