[For printing, the PDF format is nicer.]

Notes on Second Order Linear Differential Equations

Stony Brook University Mathematics Department

1. The general second order homogeneous linear differential equation with constant coefficients looks like

\begin{displaymath}Ay'' + By' + Cy =0,\end{displaymath}

where $y$ is an unknown function of the variable $x$, and $A$, $B$, and $C$ are constants. If $A=0$ this becomes a first order linear equation, which we already know how to solve. So we will consider the case $A \neq 0$. We can divide through by $A$ and obtain the equivalent equation

\begin{displaymath}y'' + by' + cy = 0\end{displaymath}

where $b=B/A$ and $c=C/A$.

``Linear with constant coefficients'' means that each term in the equation is a constant times $y$ or a derivative of $y$. ``Homogeneous'' excludes equations like $y'' + by' + cy =f(x)$ which can be solved, in certain important cases, by an extension of the methods we will study here.



2. In order to solve this equation, we guess that there is a solution of the form

\begin{displaymath}y=e^{ \lambda x},\end{displaymath}

where $\lambda$ is an unknown constant. Why? Because it works!

We substitute $y=e^{\lambda x}$ in our equation. This gives

\begin{displaymath}\lambda^2 e^{\lambda x}+b\lambda e^{\lambda x}+ce^{\lambda x}=0.\end{displaymath}

Since $e^{\lambda x}$ is never zero, we can divide through and get the equation

\begin{displaymath}\lambda^2 + b\lambda + c = 0.\end{displaymath}

Whenever $\lambda$ is a solution of this equation, $y=e^{\lambda x}$ will automatically be a solution of our original differential equation, and if $\lambda$ is not a solution, then $y=e^{\lambda x}$ cannot solve the differential equation. So the substitution $y=e^{\lambda x}$ transforms the differential equation into an algebraic equation!



Example 1. Consider the differential equation

\begin{displaymath}y''-y=0.\end{displaymath}

Plugging in $y=e^{\lambda x}$ give us the associated equation

\begin{displaymath}\lambda^2-1=0,\end{displaymath}

which factors as

\begin{displaymath}(\lambda + 1)(\lambda -1) = 0;\end{displaymath}

this equation has $\lambda=1$ and $\lambda=-1$ as solutions. Both $y=e^x$ and $y=e^{-x}$ are solutions to the differential equation $y''-y=0$. (You should check this for yourself!)

Example 2. For the differential equation

\begin{displaymath}y''+y'-2y=0,\end{displaymath}

we look for the roots of the associated algebraic equation

\begin{displaymath}\lambda^2+\lambda-2=0.\end{displaymath}

Since this factors as $(\lambda - 1)(\lambda + 2)=0$, we get both $y=e^x$ and $y=e^{-2x}$ as solutions to the differential equation. Again, you should check that these are solutions.



3. For the general equation of the form

\begin{displaymath}y'' + b y' + c y = 0,\end{displaymath}

we need to find the roots of $\lambda^2 + b\lambda + c = 0$, which we can do using the quadratic formula to get

\begin{displaymath}\lambda = \frac{ -b\pm\sqrt{b^2-4c}}{ 2}.\end{displaymath}

If the discriminant $b^2-4c$ is positive, then there are two solutions, one for the plus sign and one for the minus.

This is what we saw in the two examples above.



Now here is a useful fact about linear differential equations: if $y_1$ and $y_2$ are solutions of the homogeneous differential equation $y''+by'+cy=0$, then so is the linear combination $p y_1 + q y_2$ for any numbers $p$ and $q$. This fact is easy to check (just plug $p y_1 + q y_2$ into the equation and regroup terms; note that the coefficients $b$ and $c$ do not need to be constant for this to work.

This means that for the differential equation in Example 1 ($y''-y=0$), any function of the form

\begin{displaymath}p e^{x} + q e^{-x} \qquad \hbox{where $p$ and $q$ are any constants}\end{displaymath}

is a solution. Indeed, while we can't justify it here, all solutions are of this form. Similarly, in Example 2, the general solution of

\begin{displaymath}y''+y'-2y=0\end{displaymath}

is

\begin{displaymath}y=p e^x + q e^{-2x}, \qquad \hbox{where $p$ and $q$ are constants}.\end{displaymath}





4. If the discriminant $b^2-4c$ is negative, then the equation $\lambda^2 + b\lambda + c = 0$ has no solutions, unless we enlarge the number field to include $i=\sqrt{-1}$, i.e. unless we work with complex numbers. If $b^2-4c<0$, then since we can write any positive number as a square $k^2$, we let $k^2=-(b^2-4c)$. Then $ik$ will be a square root of $b^2-4c$, since $(ik)^2 = i^2k^2 = (-1)k^2 = -k^2 = b^2-4c$. The solutions of the associated algebraic equation are then

\begin{displaymath}\lambda_1 = \frac{ -b + ik}{ 2},  
\lambda_2 = \frac{ -b - ik}{ 2}.\end{displaymath}



Example 3. If we start with the differential equation $y''+y=0$ (so $b=0$ and $c=1$) the discriminant is $b^2-4c=-4$, so $2i$ is a square root of the discriminant and the solutions of the associated algebraic equation are $\lambda_1 = i$ and $\lambda_2 = -i$.

Example 4. If the differential equation is $y''+2y'+2y=0$ (so $b=2$ and $c=2$ and $b^2-4c=4-8 =-4$). In this case the solutions of the associated algebraic equation are $\lambda = (-2\pm2i)/2$, i.e. $\lambda_1 = -1+i$ and $\lambda_2 = -1-i$.

5. Going from the solutions of the associated algebraic equation to the solutions of the differential equation involves interpreting $e^{\lambda x}$ as a function of $x$ when $\lambda$ is a complex number. Suppose $\lambda$ has real part $a$ and imaginary part $ib$, so that $\lambda = a+ib$ with $a$ and $b$ real numbers. Then

\begin{displaymath}e^{\lambda x} = e^{(a+ib)x} = e^{ax}e^{ibx}\end{displaymath}

assuming for the moment that complex numbers can be exponentiated so as to satisfy the law of exponents. The factor $e^{ax}$ does not cause a problem, but what is $e^{ibx}$? Everything will work out if we take

\begin{displaymath}e^{ibx} = \cos (bx) + i\sin(bx),\end{displaymath}

and we will see later that this formula is a necessary consequence of the elementary properties of the exponential, sine and cosine functions.

6. Let us try this formula with our examples.

Example 3. For $y''+y=0$ we found $\lambda_1 = i$ and $\lambda_2 = -i$, so the solutions are $y_1=e^{ix}$ and $y_2=e^{-ix}$. The formula gives us $y_1=\cos x + i\sin x$ and $y_2=\cos x - i\sin x$.

Our earlier observation that if $y_1$ and $y_2$ are solutions of the linear differential equation, then so is the combination $p y_1 + q y_2$ for any numbers $p$ and $q$ holds even if $p$ and $q$ are complex constants.

Using this fact with the solutions from our example, we notice that $\frac{1}{2}(y_1+y_2) = \cos x$ and $\frac{1}{2i}(y_1-y_2) = \sin x$ are both solutions. When we are given a problem with real coefficients it is customary, and always possible, to exhibit real solutions. Using the fact about linear combinations again, we can say that $y=p\cos x + q\sin x$ is a solution for any $p$ and $q$. This is the general solution. (It is also correct to call $y=p e^{ix} +
q e^{-ix}$ the general solution; which one you use depends on the context.)

Example 4. $y''+2y'+2y=0$. We found $\lambda_1 = -1+i$ and $\lambda_2 = -1-i$. Using the formula we have

\begin{displaymath}y_1 = e^{\lambda_1x}=e^{(-1+i) x}=e^{-x}e^{ix}=e^{-x}(\cos x + i\sin x),\end{displaymath}


\begin{displaymath}y_2 = e^{\lambda_2x}=e^{(-1-i) x}=e^{-x}e^{-ix}=e^{-x}(\cos x - i\sin x).\end{displaymath}

Exactly as before we can take $\frac{1}{2}(y_1+y_2)$ and $\frac{1}{2i}(y_1-y_2)$ to get the real solutions $e^{-x}\cos x$ and $e^{-x}\sin x$. (Check that these functions both satisfy the differential equation!) The general solution will be $y = p e^{-x}\cos x + q e^{-x}\sin x$.



7. Repeated roots. Suppose the discriminant is zero: $b^2-4c =0$. Then the ``characteristic equation'' $\lambda^2 + b\lambda + c = 0$ has one root. In this case both $e^{\lambda x}$ and $x e^{\lambda x}$ are solutions of the differential equation.

Example 5. Consider the equation $y''+4y'+4y=0$. Here $b = c = 4$. The discriminant is $b^2-4c = 4^2-4\times 4 = 0$. The only root is $\lambda = -2$. Check that both $e^{-2x}$ and $x e^{-2x}$ are solutions. The general solution is then $y = p e^{-2x} + q x e^{-2x}$.



8. Initial Conditions. For a first-order differential equation the undetermined constant can be adjusted to make the solution satisfy the initial condition $y(0)=y_0$; in the same way the $p$ and the $q$ in the general solution of a second order differential equation can be adjusted to satisfy initial conditions. Now there are two: we can specify both the value and the first derivative of the solution for some ``initial'' value of $x$.

Example 5. Suppose that for the differential equation of Example 2, $y''+y'-2y=0$, we want a solution with $y(0)=1$ and $y'(0)=-1$. The general solution is $y=p e^x + q e^{-2x}$, since the two roots of the characteristic equation are 1 and $-2$. The method is to write down what the initial conditions mean in terms of the general solution, and then to solve for $p$ and $q$. In this case we have

\begin{displaymath}1 = y(0)=p e0 + q e^{-2\times 0} = p + q\end{displaymath}


\begin{displaymath}-1 = y'(0)=p e0 -2 q e^{-2\times 0} = p -2q.\end{displaymath}

This leads to the set of linear equations $p + q = 1, p -2q = -1$ with solution $q = 2/3, p = 1/3$. You should check that the solution

\begin{displaymath}y = \frac{1}{3}e^x + \frac{2}{3}e^{-2x}\end{displaymath}

satisfies the initial conditions.

Example 6. For the differential equation of Example 4, $y''+2y'+2y=0$, we found the general solution $y = p e^{-x}\cos x + q e^{-x}\sin x$. To find a solution satisfying the initial conditions $y(0)=-2$ and $y'(0)=1$ we proceed as in the last example:

\begin{displaymath}-2 = y(0) = p e^{-0}\cos 0 + q e^{-0}\sin 0 = p\end{displaymath}


\begin{displaymath}1 = y'(0)= -p e^{-0}\cos 0 -p e^{-0}\sin 0 -q e^{-0}\sin 0 + qe^{-0}\cos 0=
-p +q.\end{displaymath}

So $p = -2$ and $q = -1$. Again check that the solution

\begin{displaymath}y=-2e^{-x}\cos x-e^{-x}\sin x\end{displaymath}

satisfies the initial conditions.







Scott Sutherland 2006-02-08