# Solving IVPs with Laplace Transform

You've probably asked yourself why the Laplace transform is in the Differential Equations section. The answer is simple: because we can solve initial-value problems with the help of the Laplace transform.

Let's see how it is done.

Example 1. Solve ${y}''+{4}{y}={t}$, ${y}{\left({0}\right)}={0}$, ${y}'{\left({0}\right)}={0}$.

The first step is always to take the Laplace transform of both sides.

${L}{\left({y}''+{4}{y}\right)}={L}{\left({t}\right)}$,

Or

${L}{\left({y}''\right)}+{4}{L}{\left({y}\right)}=\frac{{1}}{{{s}}^{{2}}}$.

Now, since ${L}{\left({y}''\right)}={{s}}^{{2}}{Y}{\left({s}\right)}-{s}{y}{\left({0}\right)}-{y}'{\left({0}\right)}$ (see the table of Laplace transforms), we obtain that

${{s}}^{{2}}{Y}{\left({s}\right)}-{s}{y}{\left({0}\right)}-{y}'{\left({0}\right)}+{4}{Y}{\left({s}\right)}=\frac{{1}}{{{s}}^{{2}}}$, or, using the initial conditions,

${{s}}^{{2}}{Y}{\left({s}\right)}-{s}\cdot{0}-{0}+{4}{Y}{\left({s}\right)}=\frac{{1}}{{{s}}^{{2}}}$, which yields ${Y}{\left({s}\right)}=\frac{{1}}{{{{s}}^{{2}}{\left({{s}}^{{2}}+{4}\right)}}}$.

So, to find ${y}{\left({t}\right)}$, we have to find the inverse Laplace transform.

The partial fraction decomposition is $\frac{{A}}{{s}}+\frac{{B}}{{{s}}^{{2}}}+\frac{{{C}{s}+{D}}}{{{{s}}^{{2}}+{4}}}=\frac{{{A}{s}{\left({{s}}^{{2}}+{4}\right)}+{B}{\left({{s}}^{{2}}+{4}\right)}+{\left({C}{s}+{D}\right)}{{s}}^{{2}}}}{{{{s}}^{{2}}{\left({{s}}^{{2}}+{4}\right)}}}=\frac{{{\left({A}+{C}\right)}{{s}}^{{3}}+{\left({B}+{D}\right)}{{s}}^{{2}}+{4}{A}{s}+{4}{B}}}{{{{s}}^{{2}}{\left({{s}}^{{2}}+{4}\right)}}}=\frac{{1}}{{{{s}}^{{2}}{\left({{s}}^{{2}}+{4}\right)}}}$

So, the following system is obtained:

${\left\{\begin{array}{c}{A}+{C}={0}\\{B}+{D}={0}\\{4}{A}={0}\\{4}{B}={1}\\ \end{array}\right.}$, which has the solution ${A}={0},{B}=\frac{{1}}{{4}},{C}={0},{D}=-\frac{{1}}{{4}}$.

Thus,

${y}{\left({t}\right)}={{L}}^{{-{{1}}}}{\left({Y}{\left({s}\right)}\right)}={{L}}^{{-{1}}}{\left(\frac{{1}}{{{{s}}^{{2}}{\left({{s}}^{{2}}+{4}\right)}}}\right)}={{L}}^{{-{{1}}}}{\left(\frac{{1}}{{4}}\frac{{1}}{{{{s}}^{{2}}}}-\frac{{1}}{{4}}\frac{{1}}{{{{s}}^{{2}}+{4}}}\right)}=\frac{{1}}{{4}}{{L}}^{{-{{1}}}}{\left(\frac{{1}}{{{s}}^{{2}}}\right)}-\frac{{1}}{{4}}{{L}}^{{-{{1}}}}{\left(\frac{{1}}{{{{s}}^{{2}}+{4}}}\right)}=\frac{{1}}{{4}}{t}-\frac{{1}}{{8}}{{L}}^{{-{{1}}}}{\left(\frac{{2}}{{{{s}}^{{2}}+{4}}}\right)}=\frac{{1}}{{4}}{t}-\frac{{1}}{{8}}{\sin{{\left({2}{t}\right)}}}$

That's all. For linear differential equations, it is always the case that we take the Laplace transform, algebraically find ${Y}{\left({s}\right)}$, and take the inverse transform to obtain the solution.

Also, it is easier to solve IVPs that involve a step function or a Dirac function with Laplace transforms.

Example 2. Solve ${y}''+{y}'={u}_{{1}}{\left({t}\right)}$, ${y}{\left({0}\right)}={0}$, ${y}'{\left({0}\right)}={0}$.

Take the Laplace transform

${L}{\left({y}''\right)}+{L}{\left({y}'\right)}={L}{\left({u}_{{1}}{\left({t}\right)}\right)}$,

Or

${\left({{s}}^{{2}}{Y}{\left({s}\right)}-{s}{y}{\left({0}\right)}-{y}'{\left({0}\right)}\right)}+{\left({s}{Y}{\left({s}\right)}-{y}{\left({0}\right)}\right)}=\frac{{{{e}}^{{-{{s}}}}}}{{s}}$.

Applying the initial conditions gives:

${{s}}^{{2}}{Y}{\left({s}\right)}+{s}{Y}{\left({s}\right)}=\frac{{{e}}^{{-{s}}}}{{s}}$ or ${Y}{\left({s}\right)}={{e}}^{{-{s}}}\frac{{1}}{{{{s}}^{{2}}{\left({s}+{1}\right)}}}$.

The partical fraction decomposition for $\frac{{1}}{{{{s}}^{{2}}{\left({s}+{1}\right)}}}$ is $\frac{{1}}{{{s}}^{{2}}}-\frac{{1}}{{s}}+\frac{{1}}{{{s}+{1}}}$.

So,

${y}{\left({t}\right)}={{L}}^{{-{{1}}}}{\left({{e}}^{{-{s}}}\frac{{1}}{{{s}}^{{2}}}\right)}-{{L}}^{{-{{1}}}}{\left({{e}}^{{-{s}}}\frac{{1}}{{s}}\right)}+{{L}}^{{-{{1}}}}{\left({{e}}^{{-{s}}}\frac{{1}}{{{s}+{1}}}\right)}={u}_{{1}}{\left({t}\right)}{\left({t}-{1}\right)}-{u}_{{1}}{\left({t}\right)}{1}+{u}_{{1}}{\left({t}\right)}{{e}}^{{-{\left({t}-{1}\right)}}}={u}_{{1}}{\left({t}\right)}{\left({t}-{2}+{{e}}^{{{1}-{t}}}\right)}$

Of course, we could rewrite the Heaviside function by definition and solve the differential equation on each interval separately, but this would require a greater amount of work.

Now, let's consider one more example.

Example 3. Calculate ${y}''+{y}'={t}$, ${y}{\left({2}\right)}={0}$, ${y}'{\left({2}\right)}={0}$.

Notice that the initial conditions are not at ${0}$. In order to use the Laplace transform, we need the initial conditions to be at ${0}$. For this, use the change of variable: let ${a}={t}-{2}$; then:

${y}''{\left({a}+{2}\right)}+{y}'{\left({a}+{2}\right)}={a}+{2}$, ${y}{\left({0}\right)}={0}$, ${y}'{\left({0}\right)}={0}$.

To simplify the expression, let ${y}{\left({a}+{2}\right)}={u}{\left({a}\right)}$; then, ${y}'{\left({a}+{2}\right)}={u}'{\left({a}\right)}$, and ${y}''{\left({a}+{2}\right)}={u}''{\left({a}\right)}$; so, the equation can be rewritten as:

${u}''+{u}'={a}+{2}$, ${u}{\left({0}\right)}={0}$, ${u}'{\left({0}\right)}={0}$.

Now, we can use the Laplace transform:

${L}{\left({u}''\right)}+{L}{\left({u}'\right)}={L}{\left({a}\right)}+{L}{\left({2}\right)}$

${{s}}^{{2}}{U}{\left({s}\right)}-{s}{u}{\left({0}\right)}-{u}'{\left({0}\right)}+{s}{U}{\left({s}\right)}-{u}{\left({0}\right)}=\frac{{1}}{{{s}}^{{2}}}+\frac{{2}}{{s}}$

Applying the initial conditions gives:

${U}{\left({s}\right)}=\frac{{\frac{{1}}{{{s}}^{{2}}}+\frac{{2}}{{s}}}}{{{{s}}^{{2}}+{s}}}=\frac{{{2}{s}+{1}}}{{{{s}}^{{3}}{\left({s}+{1}\right)}}}$

The partial fraction decomposition is (verify!): $\frac{{1}}{{{s}}^{{3}}}+\frac{{1}}{{{s}}^{{2}}}+\frac{{1}}{{{s}+{1}}}-\frac{{1}}{{s}}$.

So, ${u}{\left({a}\right)}={{L}}^{{-{{1}}}}{\left(\frac{{1}}{{{s}}^{{3}}}+\frac{{1}}{{{s}}^{{2}}}+\frac{{1}}{{{s}+{1}}}-\frac{{1}}{{s}}\right)}={{L}}^{{-{{1}}}}{\left(\frac{{1}}{{2}}\frac{{2}}{{{s}}^{{3}}}+\frac{{1}}{{{s}}^{{2}}}+\frac{{1}}{{{s}+{1}}}-\frac{{1}}{{s}}\right)}=\frac{{1}}{{2}}{{a}}^{{2}}+{a}+{{e}}^{{-{a}}}-{1}$.

However, we need ${y}{\left({t}\right)}$, not ${u}{\left({a}\right)}$. Recall that ${y}{\left({t}\right)}={y}{\left({a}+{2}\right)}={u}{\left({a}\right)}={u}{\left({t}-{2}\right)}$; so,

${y}{\left({t}\right)}=\frac{{1}}{{2}}{{\left({t}-{2}\right)}}^{{2}}+{t}-{2}+{{e}}^{{-{\left({t}-{2}\right)}}}-{1}=\frac{{1}}{{2}}{{t}}^{{2}}-{t}-{1}+{{e}}^{{{2}-{t}}}$.

The Laplace transform can be used to solve linear equations with non-constant coefficients. In general, it is very hard to solve them, and the Laplace transform can rarely help, however such cases do exist.