# Solving differential equations with repeating forcing function

I am looking for a way to solve differential equation using the Laplace transformation with discontinuous and periodic forcing functions. I found this example and I would like to understand the general solution for this kind of problem.

The function has the form:

$$u''(t) + \pi^2u(t) = g(t)\\ g(t) = 1, \quad t < c\\ g(t) = 0, \quad t \ge c+1$$

Further they explain: "The first three terms of the Laplace transform of the homogeneous solution for $u(t):$"

$$\frac{e^{-2s}}{{s(s^2+\pi^2)}} - \frac{e^{-s}}{{s(s^2+\pi^2)}} + \frac{1}{s(s^2+\pi^2)}$$

Hence I assume that there are more then these three terms.

I understand that each term consists of the Laplace transformed unit step function $$\frac{e^{-is}}{s}$$ at $c = 0,1,...$ and $$\frac{1}{(s^2+\pi^2)}$$ which looks at first like a sine but it's not (I think).

Long story short: how do I calculate the solution of a differential equation such as this with an theoretically infinite amount of forcing terms.

Ultimately my goal is to understand how a differential equation evolves given a continuous input.

• $\frac{1}{s^2 + \pi^2} = \frac1\pi \cdot \frac{\pi}{s^2 + \pi^2} = \frac1\pi \mathcal{L}(\sin(\pi t))(s)$
– Joel
Commented Jul 16, 2015 at 15:04

Since $u(t)$ is reserved in our equation, we can let $v(t)$ be the unit step function. Since $g$ is only allowed to take different values in region $[c,c+1]$, we can view the right hand side of the equation as $$g(t) = (v(t-c)-v(t-(c+1))g_0(t) + v(c-t).$$ Given any function, $g_0(t)$, this will satisfy your boundary conditions.

If you would like to solve this problem using Laplace transforms, then we can simply take the Laplace transform of both sides of the equation. This gives:

$$s^2U(s) - su(0) - u'(0) + \pi^2 U(s)$$ $$= e^{-cs}\mathcal{L}(g_0(t+c)) - e^{-(c+1)s}\mathcal{L}(g_0(t+(c+1))) + \frac{1}{s} - \frac{e^{-sc}}{s}.$$

Note that $\mathcal{L}(v(c-t))(s) = \int_0^\infty e^{-st}v(c-t) dt = \int_0^c e^{-st} dt$. Thus when $g_0(t) \equiv 0$, we have $$U(s) = \frac{su(0)}{s^2+\pi^2} + \frac{u'(0)}{s^2+\pi^2} + \frac{1}{s(s^2+\pi^2)} - \frac{e^{-sc}}{s(s^2+\pi^2)} .$$

Indeed the first two terms correspond to cosine and sine respectively, we should expect them to appear since the general solution to $u''(t) + \pi^2 u(t) =0$ is $u(t) = A \cos(\pi t) + B \sin(\pi t)$. The third and fourth terms can be broken up as $$\frac{1}{\pi^2}\left( \frac1s - \frac{s}{s^2+\pi^2} \right)-e^{-cs} \left( \frac1{\pi^2} \frac{1}{s} - \frac{1}{\pi^2} \frac{s}{s^2 + \pi^2} \right)$$

This is the Laplace transform of $$\pi^{-2}\left(v(t) - \cos(\pi t) - v(t-c)( 1 - \cos(\pi t)\right)).$$

For nonzero $g_0(t)$, the solution depends on the ability to invert the Laplace transform after division by $s^2+\pi^2$. If $g_0(t)$ is $\sin(at)$, $\cos(at)$ or $e^{at}$, then you can use partial fraction decompositions to determine the solution, $u(t)$, through the Laplace transform.

Apologies for the numerous edits. Catching errors and typos, and refining my thoughts on the problem.