# 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''+4y=t`, `y(0)=0`, `y'(0)=0`.

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

`L(y''+4y)=L(t)`,

Or

`L(y'')+4L(y)=1/s^2`.

Now, since `L(y'')=s^2Y(s)-sy(0)-y'(0)` (see table of Laplace transforms), we obtain that

`s^2Y(s)-sy(0)-y'(0)+4Y(s)=1/s^2`, or, using the initial conditions,

`s^2Y(s)-s*0-0+4Y(s)=1/s^2`, which yields `Y(s)=1/(s^2(s^2+4))`.

So, to find `y(t)`, we have to find the inverse Laplace transform.

The partial fraction decomposition is `A/s+B/s^2+(Cs+D)/(s^2+4)=(As(s^2+4)+B(s^2+4)+(Cs+D)s^2)/(s^2(s^2+4))=((A+C)s^3+(B+D)s^2+4As+4B)/(s^2(s^2+4))=1/(s^2(s^2+4))`

So, the following system is obtained:

`{(A+C=0),(B+D=0), (4A=0),(4B=1):}`, which has the solution `A=0, B=1/4, C=0, D=-1/4`.

Thus,

`y(t)=L^-1(Y(s))=L^(-1)(1/(s^2(s^2+4)))=L^-1(1/4 1/(s^2)-1/4 1/(s^2+4))=1/4 L^-1(1/s^2)-1/4 L^-1(1/(s^2+4))=1/4 t -1/8 L^-1(2/(s^2+4))=1/4t-1/8 sin(2t)`

That's all. For linear differential equations, it is always the case that we take the Laplace transform, algebraically find `Y(s)`, 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(t)`, `y(0)=0`, `y'(0)=0`.

Take the Laplace transform

`L(y'')+L(y')=L(u_1(t))`,

Or

`(s^2Y(s)-sy(0)-y'(0))+(sY(s)-y(0))=(e^-s)/s`.

Applying the initial conditions gives:

`s^2Y(s)+sY(s)=e^(-s)/s` or `Y(s)=e^(-s) 1/(s^2(s+1))`.

The partical fraction decomposition for `1/(s^2(s+1))` is `1/s^2-1/s+1/(s+1)`.

So,

`y(t)=L^-1(e^(-s) 1/s^2)-L^-1(e^(-s) 1/s)+L^-1(e^(-s) 1/(s+1))=u_1(t)(t-1)-u_1(t)1+u_1(t)e^(-(t-1))=u_1(t)(t-2+e^(1-t))`

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(2)=0`, `y'(2)=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''(a+2)+y'(a+2)=a+2`, y(0)=0, y'(0)=0

To simplify the expression, let `y(a+2)=u(a)`; then, `y'(a+2)=u'(a)`, and `y''(a+2)=u''(a)`; so, the equation can be rewritten as:

`u''+u'=a+2`, `u(0)=0`, `u'(0)=0`.

Now, we can use the Laplace transform:

`L(u'')+L(u')=L(a)+L(2)`

`s^2U(s)-su(0)-u'(0)+sU(s)-u(0)=1/s^2+2/s`

Applying the initial conditions gives:

`U(s)=(1/s^2+2/s)/(s^2+s)=(2s+1)/(s^3(s+1))`

The partial fraction decomposition is (verify!): `1/s^3+1/s^2+1/(s+1)-1/s`.

So, `u(a)=L^-1(1/s^3+1/s^2+1/(s+1)-1/s)=L^-1(1/2 2/s^3+1/s^2+1/(s+1)-1/s)=1/2a^2+a+e^(-a)-1`.

However, we need `y(t)`, not `u(a)`. Recall that `y(t)=y(a+2)=u(a)=u(t-2)`; so,

`y(t)=1/2 (t-2)^2+t-2+e^(-(t-2))-1=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.