3.2. Initial-Value Problems#

This section focuses on analytical solutions for initial-value problems, meaning problems where we know the values of \(y(t)\) and \(\frac{dy}{dt}\) at \(t=0\) (or \(y(x)\) and \(\frac{dy}{dx}\) at \(x=0\)): \(y(0)\) and \(y^{\prime}(0)\).

3.2.1. Equations with constant coefficents#

A common category of 2nd-order homogeneous ODEs are equations with constant coefficients, of the form:

(3.24)#\[\begin{equation} y^{\prime\prime} + a y^{\prime} + by = 0 \end{equation}\]

Note that these are unforced, and the right-hand side is zero.

Solutions to these equations take the form \(y(x) = e^{\lambda x}\), and inserting this into the ODE gives us the characteristic equation

(3.25)#\[\begin{equation} \lambda^2 + a \lambda + b = 0 \end{equation}\]

which we can solve to find the solution for given coefficients \(a\) and \(b\) and initial conditions. Depending on those coefficients and the solution to the characteristic equation, our solution can fall into one of three cases:

  • Real roots: \(\lambda_1\) and \(\lambda_2\). This is an overdamped system and the full solution takes the form

(3.26)#\[\begin{equation} y(x) = c_1 e^{\lambda_1 x} + c_2 e^{\lambda_2 x} \end{equation}\]
  • Repeated roots: \(\lambda_1 = \lambda_2 = \lambda\). This is a critically damped system and the full solution is

(3.27)#\[\begin{equation} y(x) = c_1 e^{\lambda x} + c_2 x e^{\lambda x} \end{equation}\]

(Where does that second part come from, you might ask? Well, we know that \(y_1\) is \(e^{\lambda x}\), but the second part cannot also be \(e^{\lambda x}\) because those are linearly dependent. So, we use reduction of order to find \(y_2\), which is \(x e^{\lambda x}\).

  • Imaginary roots: \(\lambda = \frac{-a}{2} \pm \beta i\), where \(\beta = \frac{1}{2} \sqrt{4b - a^2}\). This is an underdamped system and the solution takes the form

(3.28)#\[\begin{equation} y(x) = e^{-ax/2} \left( c_1 \sin \beta x + c_2 \cos \beta x \right) \end{equation}\]

Some examples:

  1. \(y^{\prime\prime} + 3 y^{\prime} + 2y = 0\)

(3.29)#\[\begin{align} \rightarrow \lambda^2 + 3\lambda + 2 &= 0 \\ (\lambda + 2)(\lambda + 1) &= 0 \\ \lambda &= -2, -1 \\ y(x) &= c_1 e^{-x} + c_2 e^{-2x} \end{align}\]

Then, we would use the initial conditions given for \(y(0)\) and \(y^{\prime}(0)\) to find \(c_1\) and \(c_2\).

  1. \(y^{\prime\prime} + 6 y^{\prime} + 9y = 0\)

(3.30)#\[\begin{align} \rightarrow \lambda^2 + 6\lambda + 9 &= 0 \\ (\lambda + 3)(\lambda + 3) &= 0 \\ \lambda &= -3 \\ y(x) &= c_1 e^{-3x} + c_2 x e^{-3x} \end{align}\]
  1. \(y^{\prime\prime} + 6 y^{\prime} + 25 y = 0\)

(3.31)#\[\begin{align} \rightarrow \lambda^2 + 6\lambda + 25 &= 0 \\ \lambda &= -3 \pm 4i \\ y(x) &= e^{-3x} \left( c_1 \sin 4x + c_2 \cos 4x \right) \end{align}\]

3.2.2. Euler-Cauchy equations#

Euler-Cauchy equations are of the form

(3.32)#\[\begin{equation} x^2 y^{\prime\prime} + axy^{\prime} + by = 0 \end{equation}\]

Solutions take the form \(y = x^m\), which when plugged into the ODE leads to a different characterisic equation to find \(m\):

(3.33)#\[\begin{align} y &= x^m \\ y^{\prime} &= m x^{m-1} \\ y^{\prime\prime} &= m (m-1) x^{m-2} \\ \rightarrow x^2 m (m-1) x^{m-2} + axmx^{m-1} + bx^m &= 0 \\ m^2 + (a-1)m + b &= 0 \end{align}\]

This is our new characteristic formula for these problems, and solving for the roots of this equation gives us \(m\) and thus our general solution.

Like equations with constant coefficients, we have three solution forms depending on the roots of the characteristic equation:

  • Real roots: \(y(x) = c_1 x^{m_1} + c_2 x^{m_2}\)

  • Repeated roots: \(y(x) = c_1 x^m + c_2 x^m \ln x\)

  • Imaginary roots: \(m = \alpha \pm \beta i\), and \(y(x) = x^{\alpha} \left[c_1 \cos (\beta \ln x) + c_2 \sin (\beta \ln x)\right]\)

3.2.3. Inhomogeneous 2nd-order ODEs#

Inhomogeneous, or forced, 2nd-order ODEs with constant coefficients take the form

(3.34)#\[\begin{equation} y^{\prime\prime} + a y^{\prime} + by = F(t) \end{equation}\]

with initial conditions \(y(0) = y_0\) and \(y^{\prime}(0) = y_0^{\prime}\). Depending on the form of the forcing function \(F(t)\), we can solve with techniques such as

  • the method of undetermined coefficients

  • variation of parameters

  • LaPlace transforms

The solution in general to inhomogeneous ODEs includes two parts:

(3.35)#\[\begin{equation} y(t) = y_{\text{H}} + y_{\text{IH}} = c_1 y_1 + c_2 y_2 + y_{\text{IH}} \;, \end{equation}\]

where \(y_{\text{H}}\) is the solution from the equivalent homogeneous ODE \(y^{\prime\prime} + a y^{\prime} + b y = 0\).

The forcing function \(F(t)\) may be

  • continuous

  • periodic

  • aperiodic/discontinuous

3.2.3.1. Continuous \(F(t)\): method of undetermined coefficients#

For continuous forcing functions, we have two solution methods: the method of undetermined coefficients, and variation of parameters.

Generally you’ll want to use the method of undetermined coefficients when possible, which depends on if \(F(t)\) matches one of a set of functions. In that case, the form of the inhomogeneous solution \(y_{\text{IH}}(t)\) follows that of the forcing function \(F(t)\), with one or more unknown constants:

\(F(t)\)

\(y_{\text{IH}}(t)\)

constant

\(K\)

\(\cos \omega t\)

\(K_1 \cos \omega t + K_2 \sin \omega t\)

\(\sin \omega t\)

\(K_1 \cos \omega t + K_2 \sin \omega t\)

\(e^{-at}\)

\(K e^{-at}\)

\((A) t\)

\(K_0 + K_1 t\)

\(t^n\)

\(K_0 + K_1 t + K_2 t^2 + \ldots + K_n t^n\)

For combinations of these functions, we can combine functions; for example, given

(3.36)#\[\begin{align} F(t) &= e^{-at} \cos \omega t \quad \text{or} e^{-at} \sin \omega t \\ y_{\text{IH}} &= K_1 e^{-at} \cos \omega t + K_2 e^{-at} \sin \omega t \end{align}\]

(Note how in all the above cases how the inhomogeneous solution follows the functional form of the forcing function; for example, the exponential decay rate \(a\) or the sinusoidal frequency \(\omega\) match.

The method of undetermined coefficients works by plugging the candidate inhomogeneous solutionn \(y_{\text{IH}}\) into the full ODE, and solving for the constants (e.g., \(K\))—but not from the initial conditions.

For example, let’s solve

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

with initial conditions \(y(0) = y^{\prime}(0) = 0\). First, we should find the solution to the homogeneous equation

(3.38)#\[\begin{equation} y^{\prime\prime} + 2y^{\prime} + y = 0 \;. \end{equation}\]

We can do this by using the associated characteristic formula

(3.39)#\[\begin{align} \lambda^2 + 2 \lambda + 1 &= 0 \\ (\lambda + 1)(\lambda + 1) &= 0 \\ \rightarrow y_{\text{H}} &= c_1 e^{-x} + c_2 x e^{-x} \end{align}\]

To find the inhomogeneous solution, we would look at the table above to find what matches the forcing function \(e^{-x}\). Normally, we’d grab \(K e^{-x}\), but that would not be linearly independent from the first part of the homogeneous solution \(y_{\text{H}}\). The same is true for \(K x e^{-x}\), which is linearly dependent with the second part of \(y_{\text{H}}\), but \(K x^2 e^{-x}\) works! Then, we just need to find \(K\) by plugging this into the ODE:

(3.40)#\[\begin{align} y_{\text{IH}} &= K x^2 e^{-x} \\ y^{\prime} &= K e^{-x} (2x - x^2) \\ y^{\prime\prime} &= K e^{-x} (x^2 - 4x + 2) \\ 2 K &= 1 \\ \rightarrow K &= \frac{1}{2} \\ y_{\text{IH}} &= \frac{1}{2} x^2 e^{-x} \end{align}\]

Thus, the overall general solution is

(3.41)#\[\begin{equation} y(x) = c_1 e^{-x} + c_2 x e^{-x} + \frac{1}{2} x^2 e^{-x} \end{equation}\]

and we would solve for the integration constants \(c_1\) and \(c_2\) using the initial conditions.

Important points to remember:

  • The constants of the inhomogeneous solution \(y_{\text{IH}}\) come from the ODE, not the initial conditions.

  • Only solve for the integration constants \(c_1\) and \(c_2\) (part of the homogeneous solution) once you have the full general solution \(y = c_1 y_1 + c_2 y_2 + y_{\text{IH}}\).

3.2.3.2. Continuous \(F(t)\): variation of parameters#

We have the variation of parameters approach to solve for inhomogeneous 2nd-order ODEs that are more general:

(3.42)#\[\begin{equation} y^{\prime\prime} + p(x) y^{\prime} + q(x) y = r(x) \end{equation}\]

In this case, we can assume a solution \(y(x) = y_1 u_1 + y_2 u_2\).

The solution procedure is:

  1. Obtain \(y_1\) and \(y_2\) by solving the homogeneous equation: \(y^{\prime\prime} + p(x) y^{\prime} + q(x) y = 0\)

  2. Solve for \(u_1\) and \(u_2\):

(3.43)#\[\begin{align} u_1 &= - \int \frac{y_2 r(x)}{W} dx + c_1 \\ u_2 &= \int \frac{y_1 r(x)}{W} dx + c_2 \\ W &= \begin{vmatrix} y_1 & y_2\\ y_1^{\prime} & y_2^{\prime}\\ \end{vmatrix} = y_1 y_2^{\prime} - y_2 y_1^{\prime} \;, \end{align}\]

where \(W\) is the Wronksian.

  1. Then, we have the general solution:

(3.44)#\[\begin{align} y &= u_1 y_1 + u_2 y_2 \\ &= \left( -\int \frac{y_2 r(x)}{W} dx + c_1 \right) y_1 + \left( \int \frac{y_1 r(x)}{W} dx + c_2 \right) y_2 \;, \end{align}\]

where we solve for \(c_1\) and \(c_2\) using the two initial conditions.

3.2.3.2.1. Example 1: variation of parameters#

First, let’s try the same example we used for the method of undetermined coefficients above:

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

We already found the homogeneous solution, so we know that \(y_1 = e^{-x}\) and \(y_2 = x e^{-x}\). Next, let’s get the Wronksian, and then \(u_1\) and \(u_2\).

(3.46)#\[\begin{align} W &= \begin{vmatrix} y_1 & y_2 \\ y_1^{\prime} & y_2^{\prime} \end{vmatrix} = e^{-x} e^{-x}(1-x) - x e^{-x} (-e^{-x}) = e^{-2x} \\ % u_1 &= -\int \frac{x e^{-x} e^{-x}}{e^{-2x}} dx + c_1 = -\int x dx + c_1 = -\frac{1}{2} x^2 + c_1 \\ u_2 &= \int \frac{e^{-x} e^{-x}}{e^{-2x}} dx + c_2 = \int dx + c_2 = x + c_2 \\ y(x) &= \left(-\frac{1}{2} x^2 + c_1\right) e^{-x} + (x + c_2) x e^{-x} \\ \end{align}\]

After simplifying, we obtain the same solution as via the method of undetermined coefficients (but with a bit more work):

(3.47)#\[\begin{equation} y(x) = x_1 e^{-x} + c_2 x e^{-x} + \frac{1}{2} x^2 e^{-x} \end{equation}\]

3.2.3.2.2. Example 2: variation of parameters#

Now let’s try an example that we could not solve using the method of undetermined coefficients, with a forcing term that involves hyperbolic cosine (cosh); recall that \(\cosh(x) = \frac{e^x + e^{-x}}{2}\).

(3.48)#\[\begin{equation} y^{\prime\prime} + 4 y^{\prime} + 4y = \cosh(x) \end{equation}\]

First, we need to find the homogeneous solution:

(3.49)#\[\begin{align} y^{\prime\prime} + 4 y^{\prime} + 4y &= 0 \\ \lambda^2 + 4 \lambda + 4 &= 0 \\ \rightarrow \lambda &= -2 \end{align}\]

So our homogeneous solution involves repeated roots:

(3.50)#\[\begin{equation} y_H = c_1 e^{-2x} + c_2 x e^{-2x} \end{equation}\]

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

Then, we need to find \(u_1\) and \(u_2\), so let’s get the Wronksian and then solve

(3.51)#\[\begin{align} W &= \begin{vmatrix} y_1 & y_2 \\ y_1^{\prime} & y_2^{\prime} \end{vmatrix} = e^{-2x} (e^{-2x}) (1 - 2x) - x e^{-2x}(-2 e^{-2x}) = e^{-4x} \\ % u_1 &= - \int \frac{x e^{-2x} \cosh x}{e^{-4x}} dx + c_1 = -\int \frac{x \frac{1}{2}(e^x + e^{-x})}{e^{-2x}} dx + c_1 \\ &= -\frac{1}{2} \int x (e^{3x} + e^x) dx + c_1 = -\frac{1}{2} \left[ \frac{1}{9} e^{3x}(3x-1) + e^x(x-1) \right] + c_1 \\ u_1 &= -\frac{1}{18} e^{3x}(3x-1) - \frac{1}{2} e^x (x-1) + c_1 \\ % u_2 &= \int \frac{e^{-2x} \cosh x}{e^{-4x}} dx + c_2 = \frac{1}{2} \int e^{2x}(e^x + e^{-x}) dx + c_2 = \frac{1}{2} \int (e^{3x} + e^x) dx + c_2 \\ u_2 &= \frac{1}{6} e^{3x} + \frac{1}{2} e^x + c_2 \end{align}\]

Then, when we put these all together, we get the full (complicated) solution:

(3.52)#\[\begin{equation} y(x) = \left[ -\frac{1}{18} e^{3x} (3x-1) - \frac{1}{2} e^x (x-1) + c_1 \right] e^{-2x} + \left( \frac{1}{6} e^{3x} + \frac{1}{2} e^x + c_2 \right) x e^{-2x} \end{equation}\]