## Monday Math 115

The Laplace Transform
Part 16: Nonhomogeneous Differential Equations

Another advantage of using Laplace transforms on differential equations is when the equation is nonhomogeneous. For example, consider the problem
$\frac{d^2y}{dt^2}+4\frac{dy}{dt}+9y(t)=H(t)f(t)$, $y(0)=y'(0)=0$,
where H(t) is the Heaviside step function, and f(t) is the square wave $f(t)=\mathrm{sgn}\left(\sin\left(\frac{t}{3}\right)\right)=\left\{\begin{array}{rcl}1&\,\text{if}&\;\sin\left(\frac{t}{3}\right)>{0}\\-1&\,\text{if}&\;\sin\left(\frac{t}{3}\right)<{0}\end{array}\right.$. Note that due to our initial conditions, and the presence of the Heaviside step function on the right-hand side, y(t)=0 for t<0.

Taking the Laplace transform of our differential equation, letting $Y(s)\equiv\mathcal{L}\left[y(t)\right](s)$,
$\begin{array}{rcl}\mathcal{L}\left[\frac{d^2y}{dt^2}+4\frac{dy}{dt}+9y\right](s)&=&\mathcal{L}\left[H(t)f(t)\right](s)\\\mathcal{L}\left[y''\right](s)+4\mathcal{L}\left[y'\right](s)+9\mathcal{L}\left[y\right](s)&=&\mathcal{L}\left[f(t)\right](s)\\\left(s^2Y-sy(0)-y'(0)\right)+4\left(sY-y(0)\right)+9Y&=&\mathcal{L}\left[f(t)\right](s)\\s^2Y+4sY+9Y&=&\mathcal{L}\left[f(t)\right](s)\\\left(s^2+4s+9\right)Y(s)&=&\mathcal{L}\left[f(t)\right](s)\end{array}$

Recall from here that we found, using the periodic function rule, that the square wave $\mathrm{sgn}(\sin{t})=\left\{\begin{array}{rcl}1&\,\text{if}&\sin{t}>{0}\\-1&\,\text{if}&\;\sin{t}<{0}\end{array}\right.$ has Laplace transform $\frac1s\tanh\left(\frac{\pi}2s\right)$, so using the scaling rule, we see that the Laplace transform of our function f(t) is $F(s)=\frac{1}{1/3}\left(\frac{1}{s}\tanh\left(\frac{\pi}{2}\frac{s}{1/3}\right)\right)=\frac{3}{s}\tanh\left(\frac{3\pi}2s\right)$.
So, to continue with our solution,
$\begin{array}{rcl}\left(s^2+4s+9\right)Y(s)&=&\mathcal{L}\left[f(t)\right](s)\\\left(s^2+4s+9\right)Y(s)&=&\frac3s\tanh\left(\frac{3\pi}2s\right)\\Y(s)&=&\frac{1}{s^2+4s+9}\frac3s\tanh\left(\frac{3\pi}2s\right)\\&=&\frac{1}{(s+2)^2+5}\frac3s\tanh\left(\frac{3\pi}2s\right)\\&=&\frac{1}{\sqrt5}\frac{\sqrt5}{(s+2)^2+(\sqrt5)^2}\frac3s\tanh\left(\frac{3\pi}2s\right)\\&=&\mathcal{L}\left[e^{-2t}\sin\left(\sqrt5t\right)\right](s)\mathcal{L}\left[H(t)f(t)\right](s)\end{array}$,
where we have used the frequency shift formula and the transform for the sine. Now, recalling the convolution rule, we see then that
$\begin{array}{rcl}y(t)&=&\left(e^{-2t}\sin\left(\sqrt5t\right)\right)*f(t)\\&=&\int_0^tf(\tau)e^{-2(t-\tau)}\sin\left(\sqrt5(t-\tau)\right)\,d\tau\\&=&\int_0^t\mathrm{sgn}\left(\sin\left(\frac{\tau}{3}\right)\right)e^{-2(t-\tau)}\sin\left(\sqrt5(t-\tau)\right)\,d\tau\end{array}$.

For those who wish to know what this convolution looks like, we continue by breaking up the region of integration piecewise via the square wave:
$\begin{array}{rcl}y(t)&=&\int_0^tf(\tau)e^{-2(t-\tau)}\sin\left(\sqrt5(t-\tau)\right)\,d\tau\\&=&\int_0^{3\pi}e^{-2(t-\tau)}\sin\left(\sqrt5(t-\tau)\right)\,d\tau\\&&\;-\int_{3\pi}^{6\pi}e^{-2(t-\tau)}\sin\left(\sqrt5(t-\tau)\right)\,d\tau\\&&\;+\cdots\\&&\;+(-1)^{\left\lfloor\frac{t}{3\pi}\right\rfloor}\int_{3\pi\left\lfloor\frac{t}{3\pi}\right\rfloor}^{t}e^{-2(t-\tau)}\sin\left(\sqrt5(t-\tau)\right)\,d\tau\\ &=&\left(\sum_{n=0}^{\left\lfloor\frac{t}{3\pi}\right\rfloor-1}(-1)^n\int_{3\pi{n}}^{3\pi(n+1)}e^{-2(t-\tau)}\sin\left(\sqrt5(t-\tau)\right)\,d\tau\right)\\&&\;+(-1)^{\left\lfloor\frac{t}{3\pi}\right\rfloor}\int_{3\pi\left\lfloor\frac{t}{3\pi}\right\rfloor}^{t}e^{-2(t-\tau)}\sin\left(\sqrt5(t-\tau)\right)\,d\tau\end{array}$
$\begin{array}{rcl}y(t)&=&\Bigg[\sum_{n=0}^{\left\lfloor\frac{t}{3\pi}\right\rfloor-1}\frac{(-1)^ne^{6n\pi-2t}}{9}\bigg(e^{6\pi}\Big(2\sin[\sqrt5(t-3(n+1)\pi)]\\&&\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;+\sqrt{5}\cos[\sqrt5(t-3(n+1)\pi)]\Big)\\&&\;\;\;\;-2\sin(\sqrt5(t-3n\pi))+\sqrt{5}\cos(\sqrt5(t-3n\pi))\bigg)\Bigg]\\&&\;+(-1)^{\left\lfloor\frac{t}{3\pi}\right\rfloor}\left[\frac{\sqrt5-e^{6\pi\left\lfloor\frac{t}{3\pi}\right\rfloor-2t}\left(2\sin\left(\sqrt5\left(t-3\pi\left\lfloor\frac{t}{3\pi}\right\rfloor\right)\right)+\sqrt{5}\cos\left(\sqrt5\left(t-3\pi\left\lfloor\frac{t}{3\pi}\right\rfloor\right)\right)\right)}{9}\right]\end{array}$
Below is a graph of this function for over two periods of f(t),

And here is a close-up for small t, showing more clearly that y(0)=y‘(0)=0.