7.4. Homogeneous linear second-order ODEs with constant coefficients#

Equations of the form:

(7.40)#\[\begin{equation} y'' + ay' + by = 0 \end{equation}\]

come up often in chemical engineering, particularly in steady-state heat and mass diffusion, so it is important to know how to solve them!

Guess a solution \(y=e^{\lambda x}\), then substitute into the differential equation:

(7.41)#\[\begin{align} \lambda^2 e^{\lambda x} + a (\lambda e^{\lambda x}) + b e^{\lambda x} &= 0\\ \lambda^2 + a \lambda + b &= 0 \end{align}\]

This characteristic polynomial has two roots \(\lambda_1\) and \(\lambda_2\), and the general solution for y is obtained by superposition of both.

We will consider an example of each case next.

7.4.1. Real distinct roots#

To solve

(7.47)#\[\begin{equation} y'' + y' - 2y = 0, \quad y(0)=4, \quad y'(0)=-5 \end{equation}\]

First write and solve the characteristic polynomial,

(7.48)#\[\begin{align} \lambda^2 + \lambda -2 &= 0 \\ (\lambda + 2)(\lambda + 1) &= 0 \end{align}\]

so \(\lambda_1 = -2\) and \(\lambda_2 =1\). The general solution and its first derivative are:

(7.49)#\[\begin{align} y &= c_1 e^{-2x} + c_2 e^{x} \\ y'&= -2c_1 e^{-2x} + c_2 e^{x} \qquad \end{align}\]

So applying the initial conditions:

(7.50)#\[\begin{align} y(0) &= c_1 + c_2 = 4 \\ y'(0) &= -2c_1 + c_2 = -5 \end{align}\]

These coefficients can be solved by Gauss-Jordan elimination:

(7.51)#\[\begin{align} \begin{bmatrix} 1 & 1 & 4 \\ -2 & 1 & -5 \end{bmatrix} \begin{matrix}\vphantom{R_1} \\ +2 R_1 \end{matrix} &\to \begin{bmatrix} 1 & 1 & 4 \\ 0 & 3 & 3 \end{bmatrix} \begin{matrix}\vphantom{R_1} \\ \div 3 \end{matrix} \\ &\to \begin{bmatrix} 1 & 1 & 4 \\ 0 & 1 & 1 \end{bmatrix} \begin{matrix} -R_2 \\ \vphantom{R_1} \end{matrix} \\ &\to \begin{bmatrix} 1 & 0 & 3 \\ 0 & 1 & 1 \end{bmatrix} \end{align}\]

so \(c_1 = 3\) and \(c_2 = 1\). The final solution is:

(7.52)#\[\begin{equation} y = 3 e^{-2x} + e^x \end{equation}\]

7.4.2. Complex roots#

To solve:

(7.53)#\[\begin{equation} y'' + 0.4y' + 9.04y = 0, \quad y(0)=0, \quad y'(0)=3 \end{equation}\]

Write and solve the characteristic polynomial,

(7.54)#\[\begin{align} \lambda^{2} &+ 0.4\lambda + 9.04 = 0 \\ \lambda_{1,2} &= \frac{-0.4\pm\sqrt{0.4^2- 4 \cdot 9.04}}{2} = -0.2\pm 3i \end{align}\]

Once values of \(\lambda\) are known, write out the general solution and plug in the first initial condition to solve for \(c_1\).

(7.55)#\[\begin{align} y &= e^{-0.2x}(c_1\cos3x + c_2\sin3x) \\ y(0) &= c_1 = 0 \end{align}\]

Hence the first term can be dropped from the solution. In order to solve for \(c_2\), write out the derivative and plug in the second condition:

(7.56)#\[\begin{align} y' &= e^{-0.2x}(3c_2\cos3x) - 0.2e^{-0.2x}c_2\sin 3x \\ y'(0) &= 3c_2 = 3 \end{align}\]

Since \(c_2=1\), the final solution is:

(7.57)#\[\begin{equation} y = e^{-0.2x}\sin 3x \end{equation}\]

7.4.3. Real repeated roots#

To solve:

(7.58)#\[\begin{align} y'' + y' + \frac{1}{4}y=0, \quad y(0)=3, \quad y'(0)= -\frac{7}{2} \end{align}\]

Write and solve the characteristic polynomial,

(7.59)#\[\begin{align} \lambda^2 + \lambda + \frac{1}{4} = 0 \\ \left(\lambda + \frac{1}{2}\right)^2 = 0 \end{align}\]

So \(\lambda = -1/2\) is a real and repeated root. Write out the general equation and its derivative,

(7.60)#\[\begin{align} y &=(c_1 + c_2x)e^{-x/2} \\ y' &=(c_1 + c_2x)(-\frac{1}{2}e^{-x/2}) + c_2 e^{-x/2} \end{align}\]

Use the given conditions to solve for \(c_1\) and \(c_2\):

(7.61)#\[\begin{align} y(0) &= c_1 = 3 \\ y'(0) &= -\frac{c_1}{2} + c_2 = -\frac{7}{2} \to c_2 = -2 \end{align}\]

The final solution is:

(7.62)#\[\begin{equation} y = (3-2x)e^{-x/2} \end{equation}\]

7.4.4. Applications#

Example: Spring and dashpot

We are analyzing how the drag force affects the spring oscilations. This is a mechanics example, but models like this are also used for the rheology of viscoelastic materials.

A mass m is attached to a Hookean spring with spring constant k and experiences a drag force as it moves with drag coefficient \(\gamma\).

../_images/Spring_and_Dashpot.jpg

If x is the displacement of the spring, the governing equation for x is given by Newton’s equations:

(7.63)#\[\begin{equation} m x'' + \gamma x' + k x = 0 \end{equation}\]

The first term represents the acceleration of the mass, the second term is the drag force, and the third term is the spring force.

For what values of \(\gamma\) will the mass oscillate after it is stretched?


To answer this, first solve the roots of the characteristic polynomial for this second-order ODE:

(7.64)#\[\begin{align} &m \lambda^2 + \gamma \lambda + k = 0 \\ \lambda_{1,2} &= \frac{ -\gamma \pm \sqrt{\gamma^2 - 4mk}}{2m} \end{align}\]

You will only get oscillations if \(\lambda_{1,2}\) is complex, which only occurs when \(\gamma^2 < 4mk\). In this case:

(7.65)#\[\begin{equation} \lambda_{1,2} = -\frac{\gamma}{2m} \pm \frac{i}{2m}\sqrt{4mk - \gamma^2} \end{equation}\]

so the general solution for x is:

(7.66)#\[\begin{equation} x(t) = \exp\left(-\frac{\gamma}{2m} t \right) \left [ c_1 \cos(\omega t)+ c_2 \sin(\omega t) \right] \end{equation}\]

where \(\omega = \sqrt{4mk - \gamma^2}\). What does \(\gamma\) do to the solution?

  • \(\gamma\) dampens the oscillations to decay to zero. The decay time \(2m/\gamma\) increases as \(\gamma\) decreases, and without it, oscillations go on forever.

  • \(\gamma\) also changes the frequency of the oscillations through \(\omega\).

Second-order ODEs also come up frequently in steady-state transport problems involving diffusion.

Example: Steady-state reaction-diffusion

A first-order reaction is occuring in a liquid film of thickness L. The reactant concentration at \(x = 0\) is fixed to the bulk value \(c_0\), while a solid substrate at \(x=L\) prevents any mass flux.

One-dimensional reaction-diffusion

At steady-state, the reactant concentration c can be modeled by:

(7.67)#\[\begin{align} D \dd{2}{c}{x} -k c = 0, \quad c(L) = c_0, \quad -D c'(0) = 0 \end{align}\]

where D is the reactant’s diffusion coefficient and k is the reaction rate constant. Determine \(c(x)\).


First, rewrite in standard form:

(7.68)#\[\begin{equation} c'' - \frac{k}{D} c = 0 \end{equation}\]

The characteristic polynomial is

(7.69)#\[\begin{align} \lambda^2 - \frac{k}{D} &= 0 \lambda &= \pm \sqrt{\frac{k}{D}} \end{align}\]

The general solution and its first derivative are:

(7.70)#\[\begin{align} c &= a_1 e^{x \sqrt{k/D}} + a_2 e^{-x\sqrt{k/D}} \\ c' &= a_1 \sqrt{\frac{k}{D}} e^{x \sqrt{k/D}} - a_2 \sqrt{\frac{k}{D}} e^{-x\sqrt{k/D}} \end{align}\]

Evaluating the boundary conditions:

(7.71)#\[\begin{align} c(0) &= a_1 + a_2 = 0 \\ c'(L) &= a_1 \sqrt{\frac{k}{D}} e^{L \sqrt{k/D}} - a_2 \sqrt{\frac{k}{D}} e^{-L \sqrt{k/D}} = 0 \end{align}\]

This is a linear system of equations. Solving for \(a_1\) and \(a_2\) simultaneously gives

(7.72)#\[\begin{equation} a_1 = \frac{c_0}{1+e^{2L\sqrt{k/D}}} \qquad a_2 = \frac{c_0}{1+e^{-2L\sqrt{k/D}}} \end{equation}\]

Thus,

(7.73)#\[\begin{align} c = c_0\Biggl(\frac{e^{x\sqrt{k/D}}}{1+e^{2L\sqrt{k/D}}} +\frac{e^{x\sqrt{k/D}}}{1+e^{-2L\sqrt{k/D}}}\Biggr) \end{align}\]

7.4.5. Skill builder problems#

Solve the following:

  1. \(y'' - 2y' - 3y = 0\), \(y(0) = 2\), \(y'(0) = 14\)

    Solution

    Write and solve the characteristic polynomial:

    (7.74)#\[\begin{align} \lambda^2 - 2\lambda - 3 &= 0 \\ (\lambda - 3)(\lambda + 1) &= 0 \end{align}\]

    so \(\lambda_1 = 3\) and \(\lambda_2 = -1\). The general solution and its first derivative are:

    (7.75)#\[\begin{align} y &= c_1 e^{3t} + c_2 e^{-t} \\ y' &= 3c_1 e^{3t} - c_2 e^{-t} \end{align}\]

    Apply the initial conditions:

    (7.76)#\[\begin{align} y(0) &= c_1 + c_2 = 2\\ y'(0) &= 3c_1 - c_2 = 14 \end{align}\]

    and solve the system for \(c_1\) and \(c_2\) using Gauss-Jordan elimination:

    (7.77)#\[\begin{align} \begin{bmatrix} 1 & 1 & 2 \\ 3 & -1 & 14 \end{bmatrix} \begin{matrix}\vphantom{R_1} \\ -3 R_1 \end{matrix} &\to \begin{bmatrix} 1 & 1 & 2 \\ 0 & -4 & 8 \end{bmatrix} \begin{matrix}\vphantom{R_1} \\ \div -4 \end{matrix} \\ &\to \begin{bmatrix} 1 & 1 & 2 \\ 0 & 1 & -2 \end{bmatrix} \begin{matrix} -R_2 \\ \vphantom{R_2} \end{matrix} \\ &\to \begin{bmatrix} 1 & 0 & 4 \\ 0 & 1 & -2 \end{bmatrix} \end{align}\]

    Therefore:

    (7.78)#\[\begin{equation} y = 4e^{3t} - 2e^{-t} \end{equation}\]
  2. \(y'' + 2y' + y = 0\), \(y(0) = 4\), \(y'(0) = -6\)

    Solution

    Write and solve the characteristic polynomial:

    (7.79)#\[\begin{align} \lambda^2 + 2\lambda + 1 &= 0 \\ (\lambda + 1)^2 &= 0 \end{align}\]

    so \(\lambda = -1\) (repeated root). The general solution and its first derivative are:

    (7.80)#\[\begin{align} y &= (c_1 + c_2 t) e^{-t} \\ y' &= (c_1 + c_2 t)(-e^{-t}) + c_2 e^{-t} \end{align}\]

    Apply the initial conditions:

    (7.81)#\[\begin{align} y(0) &= c_1 = 4\\ y'(0) &= -c_1 + c_2 = -6 \to c_2 = -2 \end{align}\]

    Therefore:

    (7.82)#\[\begin{align} y = (4 - 2t)e^{-t} \end{align}\]
  3. \(10y'' - 50y' + 65y = 0\), \(y(0) = \frac{3}{2}\), \(y'(0) = \frac{3}{2}\)

    Solution

    Write and solve the characteristic polynomial:

    (7.83)#\[\begin{align} 10\lambda^2 - 50\lambda + 65 &= 0 \\ \lambda_{1,2} &= \frac{50 \pm \sqrt{50^2 - 4 \cdot 10 \cdot 65}}{20} \\ &= \frac{5 \pm i}{2} \end{align}\]

    Since we have complex roots, the general solution and its first derivative are:

    (7.84)#\[\begin{align} y &= e^{\frac{5t}{2}} \left(c_1 \cos\frac{t}{2} + c_2 \sin\frac{t}{2} \right) \\ y' &= e^{\frac{5t}{2}} \Biggl( -\frac{c_1}{2} \sin\frac{t}{2} + \frac{c_2}{2} \cos\frac{t}{2} \Biggr) + \frac{5}{2}e^{\frac{5t}{2}} \Biggl( c_1 \cos\frac{t}{2} + c_2 \sin\frac{t}{2} \Biggr) \end{align}\]

    Apply the initial conditions:

    (7.85)#\[\begin{align} y(0) &= c_1 = \frac{3}{2} \\ y'(0) &= \frac{c_2}{2} + \frac{5}{2}c_1 = \frac{3}{2} \to c_2 = -\frac{9}{2} \end{align}\]

    Therefore:

    (7.86)#\[\begin{align} y = e^{\frac{5t}{2}} \left( \frac{3}{2} \cos\frac{t}{2} - \frac{9}{2} \sin\frac{t}{2} \right) \end{align}\]
  4. \(y'' + \pi y' = 0\), \(y(0) = 3\), \(y'(0) = -\pi\)

    Solution

    Write and solve the characteristic polynomial:

    (7.87)#\[\begin{align} \lambda^2 + \pi\lambda &= 0 \\ \lambda(\lambda + \pi) &= 0 \end{align}\]

    so \(\lambda_1 = 0\) and \(\lambda_2 = -\pi\). The general solution and its first derivative are:

    (7.88)#\[\begin{align} y &= c_1 + c_2 e^{-\pi t} \\ y' &= -c_2 \pi e^{-\pi t} \end{align}\]

    Apply the initial conditions:

    (7.89)#\[\begin{align} y(0) &= c_1 + c_2 = 3 \\ y'(0) &= -c_2 \pi = -\pi \end{align}\]

    so \(c_1 = 2\) and \(c_2 = 1\). Therefore:

    (7.90)#\[\begin{equation} y = 2 + e^{-\pi t} \end{equation}\]