# DyingLoveGrape.

## Differential Equations: The Laplace Transform, Part 1.

### Introduction.

In practice differential equations are sometimes hard to solve. On the other hand, we have a ton of useful methods to solve algebraic equations. The Laplace transform is a nice way to take a differential equation and transform it into an algebraic equation. By solving the equation and taking the inverse of the Laplace transform we can get a solution for the differential equation we started with!

### The Laplace Transform.

It's difficult to motivate the derivation of the transform itself, so we'll just define it and talk about some of the things it does.

Definition (Laplace Transform). Given a real-valued function $f(t)$ defined for $0 \lt t \lt \infty$, the Laplace transformtion of $f$ is given by the function ${\mathcal L}(f)(s) = \int_{0}^{\infty} f(t)e^{-st}\,dt$ for $s > 0$.

This looks a bit terrifying at first glance, but it's not so bad if we cut the pieces up and talk about it. First, the left-hand side says ${\mathcal L}(f)(s)$, but maybe it should be written something like this: $[{\mathcal L}(f)](s)$. We may think about ${\mathcal L}(f)$ as a function and the points we're plugging in values of $s$. Usually $f$ is fixed and $s$ is what we plug in.

The right-hand side is a little scarier, maybe. This is saying that we should take our function $f$ and multiply it by the function $e^{-st}$ and integrate that with respect to $t$. Where do we get the $s$ in $e^{-st}$? Remember, we plug that in to the left-hand side! Let's show a few examples of this before we begin. Note that this following section isn't necessary, but there are some neat pictures.

### Example Graphs of the Laplace Transform.

Given the function $f(t) = t^{2}$ we have ${\mathcal L}(f)(s) = \int_{0}^{\infty} t^{2}e^{-st}\,dt$ and, moreover, if we plug in some values for $s$ we obtain ${\mathcal L}(f)(1) = \int_{0}^{\infty} t^{2}e^{-t}\,dt = 2,$ ${\mathcal L}(f)(1000) = \int_{0}^{\infty} t^{2}e^{-1000t}\,dt\approx\frac{1}{500000000},$

We see that ${\mathcal L}(f)$ takes in a value of $s$ and spits out some other value. This means we could graph it! Exciting. I'll graph a few values for $f = t^{2}$.

For reference, I've plotted the graph of $t^2$. The blue curve is the Laplace transform of $t^2$ from around 0.5 to 2.

Let's try two more examples before continuing onwards. Let's let $g(t) = t^{3}$. Then ${\mathcal L}(g)(s)$ looks like:

And let's let $h(t) = e^{2t}$. Then ${\mathcal L}(h)(s)$ looks like:

As you might guess at this point, the Laplacian of functions looks pretty smooth and nice, but maybe that's because we took continuous functions. Let's try a discontinuous function. The function for the piecewise we'll be using is: $f(s) = \left\{ \begin{array}{lr} 5& \mbox{ for } 0\leq s \lt 1\\ s^{5}& \mbox{ for } 1\leq s \lt 2\\ 5 + e^{5}\sin(s)& \mbox{ for } 2\leq s\\ 0 & \mbox{ otherwise. } \end{array} \right\}$ Which is shown in purple below. The much smoother blue curve is the Laplace of $f$.

The Laplace is significantly smoother and nicer than its associated piecewise function! In general, the idea of integral transforms like the Laplace transforms is to make functions "nicer" so that they become easier to work with; we see visual evidence of this here.

### Computing the Laplace transform for some common functions.

Sometimes we can solve these integrals explicitly in terms of $s$. For example, if we have the function $f(t) = e^{at}$ then we can compute the Laplace transform explicitly. \begin{align*}{\mathcal L}(f)(s) &= \int_{0}^{\infty} e^{at}e^{-st}\,dt\\&=\int_{0}^{\infty} e^{(a-s)t}\,dt\\ &=\left[ \frac{1}{a-s}e^{(a-s)t}\right]_{0}^{\infty}\\ \end{align*}

Here we need to think for a moment. Note that $(a-s)$ will eventually become negative (since $a$ is fixed and $s$ goes to infinity) so that multiplying this by $t\to\infty$ gives us $e^{-\infty} = 0$. The other term is easy to evaluate. We finally wind up with $=\frac{-1}{a-s} = \frac{1}{s-a}$ which is a delightful and simple solution. We conclude that

Fact. For $a$ a real number constant, ${\mathcal L}(e^{at})(s) = \frac{1}{s-a}.$

What else is a common function? Polynomials, of course. Let's start easy with $f(t) = t$. Note that we will be using integration by parts to simplify these integrals. For the sake of space, I won't show the steps (but you should try them out for yourself!) \begin{align*}{\mathcal L}(f)(s) &= \int_{0}^{\infty} te^{-st}\,dt\\&= \left[-\frac{1}{s^2}e^{-st}(st + 1)\right]_{0}^{\infty} \end{align*} Notice that if we plug in $t = \infty$ to this antiderivative (after applying L'hopital's rule) we obtain 0. If we plug in $t = 0$ to the antiderivative we obtain $-\frac{1}{s^{2}}$. Hence,

Fact. ${\mathcal L}(t)(s) = \frac{1}{s^2}.$

In a frightfully similar way, we can evaluate the Laplace transform of functions like $f(t) = t^{n}$ for any natural number $n$. These problems often require a lot of integration by parts (similar to above), so I will simply quote the result.

Fact. For an integer $n\geq 0$, ${\mathcal L}(t^n)(s) = \frac{n!}{s^{n+1}}.$

Notice this also gives us the Laplace transform of a constant (when we plug in $n=0$ and note that $0! =1$). Neat.

For now, this is all we need, but there are a number of charts which, given some $f$, will give you ${\mathcal L}(f)(s)$.

### Properties of the Laplace transform.

There's a few properties that make the Laplace transform worth studying. First is linearity: if we have two numbers $a,b$ and two funtions $f(t),g(t)$, then we have

Fact. For constants $a,b$ and functions $f(t), g(t)$ we have ${\mathcal L}(af(t) + bg(t)) = a{\mathcal L}(f(t)) + b{\mathcal L}{g(t)}.$

In other words: we can factor out constants, and Laplace transform of a sum is the sum of Laplace transforms. Let's quickly show this.

Proof of Linearity. As above, we consider \begin{align*}&{\mathcal L}(af(t) + bg(t))\\ &= \int_{0}^{\infty}(af(t) + bg(t))e^{-st}\,dt\\ &= \int_{0}^{\infty}af(t)e^{-st} + bg(t)e^{-st}\,dt\\ &= \int_{0}^{\infty}af(t)e^{-st}\,dt + \int_{0}^{\infty}bg(t)e^{-st}\,dt\\ &= a\int_{0}^{\infty}f(t)e^{-st}\,dt + b\int_{0}^{\infty}g(t)e^{-st}\,dt\\ &= a{\mathcal L}(f)(s) + b{\mathcal L}(g)(s). \end{align*}

That's pretty nice. Using this property, we can now use the Laplace transform on general polynomials! For example, consider $f(t) = a_{0} + a_{1}t + a_{2}t^{2} + \dots + a_{m}t^{m}$. Then we have that \begin{align*} {\mathcal L}(f)(s) &= \frac{a_{0}}{s} + \frac{a_{1}}{s^2} + \frac{2a_{2}}{s^{3}} +\cdots\\ &\phantom{= a_{0}} +\frac{a_{m-1}(m-1)!}{s^{m}} +\frac{a_{m}m!}{s^{m+1}}\end{align*} and that's all kinds of exciting.

Since we eventually want to be able to do differential equations with Laplace transforms, it might be nice to see what happens to ${\mathcal L}(f')(s)$ if we know ${\mathcal L}(f)(s)$ (note, for this, we will be assuming that $f$ is a "nice" function that don't get too big too fast, but, for now, one doesn't need to worry so much about that). Let's look: \begin{align*}{\mathcal L}(f')(s) &= \int_{0}^{\infty} f'(t)e^{-st}\,dt\\ &= \left[f(t)e^{-st}\right]_{0}^{\infty} + s\int_{0}^{\infty} f(t)e^{-st}\\ &= (0 - f(0)) + s{\mathcal L}(f)(s)\end{align*}

We've used integration by parts above. Notice that when I evaluated this, on the left-side of the secnd-to-last equality I needed to look at $f(t)e^{-st} = \frac{f(t)}{e^{st}}$ as $t\to\infty$. I needed this to be 0, so I needed that $f(t)$ grows slower than $e^{st}$. An $f$ like this is said to be of exponential type.

By repeated integration by parts, we can do this as many times as we'd like. We'll record this as a fact here,

Fact. For a differentiable (exponential type) function $f$ we have that the $n$-th derivative, $f^{(n)}$, has the following property: \begin{align*} {\mathcal L}(f^{(n)})(s) &= s^{n}{\mathcal L}(f)(s) - s^{n-1}f(0) \\ & - s^{n-2}f'(0) \cdots - f^{(n-1)}(0)\end{align*}

Now that we know this, we can try to transform an entire differential equation! At this point, this might seem completely pointless (why bother transforming it...?) but this will be one of those things where the motivation comes from seeing what Laplace transforms can do.

### Transforming Differential Equations.

Let's start with an example. Let's say we have the differential equation $f'(t) + f(t) = 0$ with $f(0) = 2$. Not super-difficult, not super-exciting, but let's see what happens when we apply the Laplace transform to both sides of this equation. Note that ${\mathcal L}(0)(s) = 0$ (try to derive this from the definition). ${\mathcal L}(f' + f)(s) = {\mathcal L}(0)(s)$ ${\mathcal L}(f')(s) + {\mathcal L}(f)(s) = 0$ $s{\mathcal L}(f)(s) - f(0) + {\mathcal L}(f)(s) = 0$ $(s+1){\mathcal L}(f)(s) - f(0) = 0$ $(s+1){\mathcal L}(f)(s) - 2 = 0$ ${\mathcal L}(f)(s) = \frac{2}{s+1}$ Here's the "ah-ha" moment: we know what kinds of functions $f$ will give us things which look like $\frac{2}{s+1}$ when we take the Laplace transform of them! Remember from one of the facts above that ${\mathcal L}(e^{at})(s) = \frac{1}{s-a}$. Hence, if we look at $e^{-t}$ then we get ${\mathcal L}(e^{-t})(s) = \frac{1}{s-(-1))} = \frac{1}{s+1}$. This is pretty close, but we're missing a 2. This is easy to fix: we simply let $f(t) = 2e^{-t}$. Then our Laplace transform of $f$ will give us exactly $\frac{2}{s+1}$ which is what we want above. Therefore, this is the $f$ that will solve the Laplace transform equation above and, therefore, this is the $f$ that will solve our differential equation.

What we've just done, without explicitly saying so, is take the Laplace transform of the equation, solve it, and then take the "inverse" Laplace transform (the last step where we noticed the $e^{at}$ thing) to get our solution in terms of $f$. This is the general process for solving differential equations using Laplace transforms.

I could derive a whole load of "inverse" Laplace transformations, but there are usually tables giving you this data. Indeed, here is one such table from Fullerton. Once you've taken the Laplace transform of your equation, solve it for ${\mathcal L}(f)(s)$; then, look up what you get in the right side of the table (it might be the case you need to factor out a constant or add a few together, etc): the left side of the table corresponding to your value is the $f$ which solves your differential equation.

### Examples of solving differential equations using Laplace transforms.

Let's do some examples.

Example 1. Let's look at the differential equation $f(x) - 2f'(x) = 0$ with initial condition $f(0) = 1$. We note ${\mathcal L}(f - 2f')(s) = 0$ ${\mathcal L}(f)(s) - 2{\mathcal L}(f')(s) = 0$ ${\mathcal L}(f)(s) - 2(s{\mathcal L}(f)(s) - 1) = 0$ $(1-2s){\mathcal L}(f)(s) = -2$ ${\mathcal L}(f)(s) = -2\left(\frac{1}{1-2s}\right)$ Here we need to be a bit clever. We don't have anything that looks like $\frac{1}{1-2s}$. But we do have things which look like $\frac{1}{s - a}$. Here's the trick: factor out a $-2$ from the denominator of our solution to get $\frac{1}{-2}\frac{1}{-\frac{1}{2} + s}$. This allows us to conclude: ${\mathcal L}(f)(s) = \frac{-2}{-2}\frac{1}{s - \frac{1}{2}} = \frac{1}{s-\frac{1}{2}}$ And looking at the table gives us that our function should be $f(x) = e^{\frac{1}{2}x}$.

Does this solve our differential equation? Note $f'(x) = \frac{1}{2}e^{\frac{1}{2}x}$ so $f(x) - 2f'(x) = e^{\frac{1}{2}x} - 2(\frac{1}{2}e^{\frac{1}{2}x}) = 0$ and, moreover, $f(0) = e^{0} = 1$. This is exactly what we wanted!

Example 2. Let's try a slightly harder example. Let's solve $f''(x) + f(x) = 0$ with $f(0) = 1$ and $f'(0) = 1$. As above, ${\mathcal L}(f''+ f)(s) = 0$ ${\mathcal L}(f'')(s) + {\mathcal L}(f)(s) = 0$ $s^{2}{\mathcal L}(f)(s) - sf(0) - f'(0) + {\mathcal L}(f)(s) = 0$ $(s^2 + 1){\mathcal L}(f)(s) - s - 1 = 0$ ${\mathcal L}(f)(s) = \frac{s + 1}{s^{2} + 1} = \frac{s}{s^2 + 1} + \frac{1}{s^{2} + 1}$ Note that the first term on the right-hand side has Laplace inverse equal to $\cos(t)$ and the right-hand side has Laplace inverse equal to $\sin(t)$. Hence, $f(x) = \cos(x) + \sin(x)$. Does this work? Check that it does.

Example 3. Let's modify the previous example a bit. Let's solve $f''(x) + f(x) = x$ with $f(0) = 1$ and $f'(0) = 1$. Note now that we need to take the Laplace transform of $x$, which is just $\frac{1}{s^{2}}$. As before, ${\mathcal L}(f''+ f)(s) = \frac{1}{s^{2}}$ ${\mathcal L}(f'')(s) + {\mathcal L}(f)(s) = \frac{1}{s^{2}}$ $(s^{2} + 1){\mathcal L}(f)(s) = \frac{1}{s^{2}} +s + 1 = \frac{1 + s^3 + s^{2}}{s^{2}}$ ${\mathcal L}(f)(s) = \frac{1 + s^{3} + s^{2}}{s^{2}(s^{2} + 1)}$ Welp, this doesn't look like anything on our chart, so we've got to be clever. One thing we note is that there are two distinct factors in the denominator, so maybe partial fractions will be useful here. Indeed, it is! Using partial fractions we find: ${\mathcal L}(f)(s) = \frac{s}{s^2 + 1} + \frac{1}{s^2}$ which, when we look at our chart, invert to give us that $f(x) = \cos(x) + x$. Does this work? Check it.

### Next time...?

There's some more advanced things we can do with ${\mathcal L}(f)(s)$ — in the next post, we'll explore these and solve some more difficult differential equations.