Wichita State University Logo

Math 555: Differential Equations

6.4 Discontinuous Forcing Functions


6.4.1 Discontinuities in Forcing Functions

In previous chapters, if an initial value problem featured a discontinuous forcing function, we had to solve the problem by breaking the forcing function up into a sum of continuous functions or describe the function using a piece-wise definition. We could then solve the differential equation for each continuous piece and add the solutions together. The Laplace transform allows us to solve such an initial value problem using a single process without needing solve multiple problems and then stitch them together.

The difficult part of the process will be writing a piece-wise defined function as a linear combination of step functions (Heaviside functions) so that we can use the Laplace Transform Table to compute the transform of the discontinuous function.

Example 6.4.1

Solve the initial value problem

$$2y'' + y' + 2y = g(t),\quad y(0) = 0,\ \ y'(0) = 0,$$
where

$$g(t) = \left\{\begin{array}{rl} 1, &5\le t<20, \\ 0, &\text{otherwise} \end{array}\right. = u_5(t) - u_{20}(t).$$

Solution

Computing the Laplace transform of both sides of the differential equation gives us

$$2s^2Y(s) + sY(s) + 2Y(s) = \dfrac{e^{-5s}}{s} - \dfrac{e^{-20s}}{s}.$$
Solving for $Y(s)$ results in

$$ Y(s) = \dfrac{e^{-5s} - e^{-20s}}{s(2s^2 + s + 2)}.$$
Defining

$$H(s) = \dfrac{1}{s(2s^2 + s + 2)},$$
the expression for $Y(s)$ is given by

$$Y(s) = H(s)e^{-5s} - H(s)e^{-20s}.$$
Determining the inverse Laplace Transform of $H(s)$ allows us to use line 13 of our Laplace Transform Table to obtain the solution. Employing partial fraction decomposition,

$$ H(s) = \dfrac{1}{s(2s^2 + s + 2)} = \dfrac{A}{s} + \dfrac{Bs + C}{2s^2 + s + 2} $$

If we write the rightmost expression as a single fraction, numerators of these two fractions must match, so

$$ \begin{align*} 1 &= A(2s^2 + s + 2) + (Bs + C)s \\ \\ &= (2A + B)s^2 + (A+C)s + 2A. \end{align*}$$
This yields a system of 3 equations and 3 unknowns:

$$ 2A + B = 0\qquad A+C = 0\qquad 2A = 1. $$
Which is very easily solved for $A = \frac{1}{2}$, $B = -1$, and $C = -\frac{1}{2}$.

Writing $H(s)$ using the decomposition,

$$ H(s) = \dfrac{1}{2}\cdot\dfrac{1}{s} - \dfrac{s + \frac{1}{2}}{2s^2 + s + 2}. $$
Analyzing this form, the left term is ready to be inverted, so we need to only worry about the right term. Its denominator is an irreducible quadratic and is not the sum of squares, so we will have to use lines 9 and 10 from the Laplace Transform Table . Therefore, we complete the square the denominator:

$$ \begin{align*} H(s) &= \dfrac{1}{2}\cdot\dfrac{1}{s} - \dfrac{s + \frac{1}{2}}{2(s^2 + \frac{s}{2} + 1)} \\ \\ &= \dfrac{1}{2}\cdot\dfrac{1}{s} - \dfrac{1}{2}\cdot\dfrac{s + \frac{1}{2}}{s^2 + \frac{s}{2} + 1} \\ \\ &= \dfrac{1}{2}\cdot\dfrac{1}{s} - \dfrac{1}{2}\cdot\dfrac{s + \frac{1}{2}}{s^2 + \frac{s}{2} \color{#307fe2}{+\frac{1}{16}} \color{#ec008c}{-\frac{1}{16}} + 1} \\ \\ &= \dfrac{1}{2}\cdot\dfrac{1}{s} - \dfrac{1}{2}\cdot\dfrac{s + \frac{1}{2}}{ \color{#307fe2}{\left(s^2 + \frac{s}{2}+\frac{1}{16}\right)} + \color{#ec008c}{\left(1-\frac{1}{16}\right) }} \\ \\ &= \dfrac{1}{2}\cdot\dfrac{1}{s} - \dfrac{1}{2}\cdot\dfrac{s + \frac{1}{2}}{ \color{#307fe2}{\left(s + \frac{1}{4}\right)^2} + \color{#ec008c}{\left(\frac{\sqrt{15}}{4}\right)^2}} \end{align*} $$
Our denominator is in the appropriate form with $a = -\frac{1}{4}$ and $b = \frac{\sqrt{15}}{4}$, but we must now manipulate the numerator so that it matches the table of transforms.

$$\begin{align*} H(s) &= \dfrac{1}{2}\cdot\dfrac{1}{s} - \dfrac{1}{2}\left(\dfrac{s + \frac{1}{4}+\frac{1}{4}}{\left(s + \frac{1}{4}\right)^2 + \left(\frac{\sqrt{15}}{4}\right)^2}\right) \\ \\ &= \dfrac{1}{2}\cdot\dfrac{1}{s} - \dfrac{1}{2}\left(\dfrac{s + \frac{1}{4}}{\left(s + \frac{1}{4}\right)^2 + \left(\frac{\sqrt{15}}{4}\right)^2} + \dfrac{\frac{1}{4}}{\left(s+\frac{1}{4}\right)^2 + \left(\frac{\sqrt{15}}{4}\right)^2} \right) \\ \\ &= \dfrac{1}{2}\cdot\dfrac{1}{s} - \dfrac{1}{2}\left(\dfrac{s + \frac{1}{4}}{\left(s + \frac{1}{4}\right)^2 + \left(\frac{\sqrt{15}}{4}\right)^2} + \dfrac{1}{\color{#307fe2}{\sqrt{15}}}\dfrac{\frac{\color{#307fe2}{\sqrt{15}}}{4}}{\left(s+\frac{1}{4}\right)^2 + \left(\frac{\sqrt{15}}{4}\right)^2} \right) \end{align*} $$
Finally, we may apply the inverse transform to obtain

$$ h(t) = \dfrac{1}{2} - \dfrac{1}{2}e^{-\frac{t}{4}}\left(\cos\left(\dfrac{\sqrt{15}}{4}\,t\right) + \dfrac{1}{\sqrt{15}}\sin\left(\dfrac{\sqrt{15}}{4}\,t\right)\right). $$
For compactness, we may rewrite the linear combination of $\cos(\omega t)$ and $\sin(\omega t)$ in the form $R\cos(\omega t -\delta)$ with

$$ R = \sqrt{ 1^2 + \left(\frac{1}{\sqrt{15}}\right)^2 } = \frac{4}{\sqrt{15}}$$
and

$$ \delta = \arctan\left(\frac{1}{\sqrt{15}}\right). $$
Hence,

$$ h(t) = \dfrac{1}{2} - \dfrac{2}{\sqrt{15}}e^{-\frac{t}{4}}\cos\left(\dfrac{\sqrt{15}}{4}\,t-\delta\right) $$
Using this formulation of $h(t)$, by line 13 of the transform table the inverse Laplace transform of $Y(s)$ is

$$y(t) = u_5(t)h(t-5) - u_{20}(t)h(t-20).$$
In piece-wise form, this looks like

$$ y(t) = \left\{\begin{array}{cc} 0 & t \lt 5 \\ \dfrac{1}{2} - \dfrac{2}{\sqrt{15}}e^{-\frac{t-5}{4}}\cos\left(\dfrac{\sqrt{15}}{4}\,(t-5)-\delta\right) & 5 \ge t \lt 20 \\ \dfrac{2}{\sqrt{15}}\left(e^{-\frac{t-20}{4}}\cos\left(\dfrac{\sqrt{15}}{4}\,(t-20)-\delta\right) - e^{-\frac{t-5}{4}}\cos\left(\dfrac{\sqrt{15}}{4}\,(t-5)-\delta\right) \right) & t \ge 20 \end{array}\right. $$

Plot of solution for Example 1, showing the effect of the discontinuous forcing function.

This is a lot to process at first. To understand better what is happening, we can think of our solution as a combination of the solutions to two separate differential equations. Recall that for $t\ge 20,\ $ our differential equation is homogeneous, since the forcing function is $0$. Let's analyze the solution to the initial value problem for the homogeneous equation

$$2w'' + w' + 2w = 0,\quad w(0) = w_0 = y(20),\ \ w'(0) = w_0' = y'(20).$$
We need the values of $y(20)$ and $y'(20)$ to solve our homogeneous differential equation for $t\ge 20$. Using $y(20) = h(20-5) = h(15)\ $ we have

$$\begin{align*} y(t) &= \dfrac{1}{2} - \dfrac{2}{\sqrt{15}}e^{-\frac{t-5}{4}}\cos\left(\dfrac{\sqrt{15}}{4}\,(t - 5) - \phi\right) \\ \\ y(20) &= \dfrac{1}{2} - \dfrac{2}{\sqrt{15}}e^{-15/4}\cos\left(\dfrac{15}{4}\sqrt{15} - \phi\right)\\ \\ &\approx 0.501620577296880 = w_0 \\ \\ y'(t) &= \dfrac{1}{2}e^{-\frac{t-5}{4}}\left(\dfrac{1}{\sqrt{15}}\cos\left(\dfrac{\sqrt{15}}{4}\,(t - 5) - \phi\right) + \sin\left(\dfrac{\sqrt{15}}{4}\,(t - 5) - \phi\right)\right) \\ \\ y'(20) &= \dfrac{1}{2}e^{-\frac{15}{4}}\left(\dfrac{1}{\sqrt{15}}\cos\left(\dfrac{\sqrt{15}}{4}\,(15) - \phi\right) + \sin\left(\dfrac{\sqrt{15}}{4}\,(15) - \phi\right)\right) \\ \\ &\approx 0.011248565972730 = w_0' \\ \end{align*}$$
To solve our homogeneous differential equation for $w(t) = y(t-20)$,

$$ 2w'' + w' + 2w = 0 \quad w(0) = w_0,\ \ w'(0) = w_0' $$
we can use our techniques from chapter 3. After finding that the roots of the characteristic equation are $s = -\frac{1}{4} \pm \frac{\sqrt{15}}{4}i$, we see that the general form of the solution resembles what we found earlier.

$$ w(t) = e^{-t/4}\left(c_1\cos\left(\dfrac{\sqrt{15}}{4}\,t\right) + c_2\sin\left(\dfrac{\sqrt{15}}{4}\,t\right)\right) $$
Plugging in $t = 0$ shows that $c_1 = w_0$. To find $c_2$, we differentiate $w(t)$

$$\begin{align*} w'(t) &= -\dfrac{1}{4}e^{-t/4}\left(w_0\cos\left(\dfrac{\sqrt{15}}{4}\,t\right) + c_2\sin\left(\dfrac{\sqrt{15}}{4}\,t\right)\right) \\ \\ &\qquad + e^{-t/4}\left(-\dfrac{\sqrt{15}}{4}w_0\sin\left(\dfrac{\sqrt{15}}{4}\,t\right) + \dfrac{\sqrt{15}}{4}c_2\cos\left(\dfrac{\sqrt{15}}{4}\,t\right)\right) \end{align*} $$
and set $w'(0) = w_0'$:

$$\begin{align*} w'(0) &= -\dfrac{w_0}{4} + \dfrac{\sqrt{15}}{4}c_2 = w_0' \\ \\ \dfrac{\sqrt{15}}{4}c_2 &= w_0' + \dfrac{w_0}{4} = \dfrac{4w_0' + w_0}{4} \\ \\ c_2 &= \dfrac{4w_0'+ w_0}{\sqrt{15}} \\ \end{align*}$$
Now, we can combine the two solutions, $h(t-5)$ for $5\le t \lt 20$ and $w(t-20)$ for $t \ge 20$.

Plots the sum of the two pieces of the solution, with the homogeneous part displayed in magenta.

6.4.2 Practice for Yourself

There are two elements to the following exercises. The first is to express the forcing function properly in terms of step functions. The second is to perform the necessary algebra to find an expression for $Y(s)$ that can be inverted using the Laplace transform table. This second element is the principle skill in solving differential equations with Laplace transforms. A fair bit of algebra will be needed for most problems, so do plenty of practice to develop familiarity with the common operations necessary to match the forms of the transform table. Partial fractions and completing the square are particularly common.

Exercise 6.4.1

Solve the initial value problem

$$y'' + y = g(t),\quad y(0)=0,\ \ y'(0)=1,$$
where $g(t)$ ramps up from the value zero at $t=0$ to one at $t=\pi$, and then ramps back down to zero at $t=2\pi$.

"Ramp up/down" in this context means that the forcing function increases or decreases linearly between the specified values.

View Solution Using the Heaviside function $u_c(t)$ we can write

$$g(t) = \dfrac{1}{\pi}\left(t - 2u_{\pi}(t)(t-\pi) + u_{2\pi}(t)(t-2\pi))\right).$$
Plot for the forcing function g(t). Grows linearly from (0,0) to (pi,1) and decreases linearly from (pi,1) to (2*pi,0). It is 0 for all t larger than 2*pi. Computing the Laplace transform of both sides of the differential equation and solving for $Y(s)$ yields

$$\begin{align*} s^2Y(s) - 1 + Y(s) &= \dfrac{1}{\pi}\left(\dfrac{1}{s} - \dfrac{2}{s}e^{-\pi s} + \dfrac{1}{s}e^{-2\pi s}\right) \\ \\ \left(s^2 + 1\right)Y(s) &= 1 + \dfrac{1}{\pi s} - 2\dfrac{1}{\pi s}e^{-\pi s} + \dfrac{1}{\pi s}e^{-2\pi s} \\ \\ Y(s) &= \dfrac{1}{s^2 + 1} + \dfrac{1}{\pi}\dfrac{1}{s\left(s^2+1\right)} + \dfrac{1}{\pi}\dfrac{1}{s\left(s^2+1\right)}\left(e^{-2\pi} - 2e^{-\pi s}\right) \\ \\ &= \dfrac{1}{s^2 + 1} + \dfrac{1}{\pi}H(s) + \dfrac{1}{\pi}H(s)\left(e^{-2\pi} - 2e^{-\pi s}\right), \end{align*}$$ where

$$ H(s) = \dfrac{1}{\left(s^2+1\right)s} $$

The inverse Laplace transform will then be

$$ y(t) = \cos(t) + \dfrac{1}{\pi}h(t) - \dfrac{2}{\pi}u_{\pi}(t)h(t-\pi) + \dfrac{1}{\pi}u_{2\pi}(t)h(t-2\pi) $$
with the function $h(t)$ being the inverse of $H(s)$. So,

$$\begin{align*} H(s) &= \dfrac{1}{s\left(s^2+1\right)} \\ \\ &= \dfrac{A}{s} + \dfrac{Bs + C}{s^2 + 1} \\ \\ 1 &= A(s^2 +1) + (Bs + C)s = (A+B)s^2 + Cs + A \\ \\ A &= 1 \qquad\quad B = -1 \qquad\quad C = 0\\ \\ H(s) &= \dfrac{1}{s} - \dfrac{s}{s^2 + 1} \\ \\ h(t) &= t - \cos(t) \end{align*}$$
For $0\le t \lt\pi,\ $ the solution has the form

$$ y(t) = \cos(t) + \dfrac{1}{\pi}h(t) = \cos(t) + \frac{1}{\pi}\left(t - \cos(t)\right) $$
On the interval $\pi \le t \lt 2\pi,\ $ the solution becomes

$$\begin{align*} y(t) &= \cos(t) + \frac{1}{\pi}\left(t - \cos(t)\right) - \dfrac{2}{\pi}h(t-\pi) \\ \\ &= \dfrac{1}{\pi}\left(t + (\pi-1)\cos(t) - 2\left(t - \pi - \cos(t-\pi)\right)\right) \\ \\ &= \dfrac{1}{\pi}\left(2\pi - t + (\pi-3)\cos(t)\right) \end{align*}$$
When $t \ge 2\pi,\ $ the solution simplifies to

$$\begin{align*} y(t) &= \dfrac{1}{\pi}\left(2\pi - t + (\pi-3)\cos(t)\right) + \dfrac{1}{\pi}h(t-2\pi) \\ \\ &= \dfrac{1}{\pi}\left(2\pi - t + (\pi-3)\cos(t) + t - 2\pi - \cos(t - 2\pi)\right) \\ \\ &= \dfrac{\pi-4}{\pi}\cos(t) \\ \end{align*}$$

Solution for Exercise 6.4.1. Shows effect of ramp loading and unloading in the forcing function.

Exercise 6.4.2

Find the solution to the initial value problem for

$$y'' + y' + \frac{5}{4}y = g(t),\quad y(0) = 0,\ \ y'(0) = 0 $$
where

$$ g(t) = \left\{\begin{array}{cc} \sin(t) & 0\le t \lt \pi \\ 0 & t\ge\pi. \end{array}\right. $$

Check Your Work $$ y(t) = h(t) + u_\pi (t)h(t-\pi) $$
where $$ h(t) = -\frac{16}{17}\cos t + \frac{4}{17}\sin t + e^{-\frac{t}{2}}\left(\frac{16}{17}\cos t + \frac{4}{17}\sin t\right) $$
Plot of the solution for Example 6.4.2. Shows the function decaying, but the point where the forcing function turns off results in a smooth transition in the solution.

Video Solution

Creative Commons Logo - White


Your use of this self-initiated mediated course material is subject to our Creative Commons License .


Creative Commons Attribution-NonCommercial-ShareAlike 4.0

Creative Commons Logo - Black
Attribution
You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.

Creative Commons Logo - Black
Noncommercial
You may not use the material for commercial purposes.

Creative Commons Logo - Black
Share Alike
You are free to share, copy and redistribute the material in any medium or format. If you adapt, remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.