# Mathematics - Differential equation exercises for the Laplace method Hello it's a me again drifter1! Today we continue with Differential equations to get into some exercises/examples of the Laplace method. In my previous post I covered the theory behind it, and I suggest you to read it before this post.

So, without further do, let's get started!

## Differential Equation Examples

The examples that follow can also be solved using other methods, but I will use the Laplace method so that you get more familiar with it and so that you can use the previous known methods to check if the result is right!

Example 1 [y' + y = sinx,    if y(0) = 1]:

The given Differential equation is a 1st-order linear ODE.

This can be solved very fast using y = gY (as we discussed in previous posts)

Let's solve it using the Laplace method tho.

First we find the Laplace transformation for each side of the equation:

L(y' + y) = L(sinx) => [linearity property and sinx from the transformation list]

L(y') + L(y) = 1/(s^2 + 1) => [We know that L(y') = sY - y(0)]

sY - y(0) + Y = 1/(s^2+1) => [y(0) = 1]

sY - 1 + Y = 1/(s^2+1) =>

Y(s + 1) = 1/(s^2 + 1) + 1 =>

Y(s + 1) = (s^2 + 2) / (s^2 + 1) =>

Y = (s^2 + 2) / [(s + 1)*(s^2 + 1)]

We now have to find the inverse of that Y to get our y.

To do this we have to use the method of integrating rational functions where we write it as sum of simple quotients.

So,

Y = (s^2 + 2) / [(s + 1)*(s^2 + 1)] = [A / (s + 1)] + [(Bs + C)/(s^2 + 1)] =>

Y = [A*(s^2 + 1) + (Bs + C)*(s+1)]/[(s+1)*(s^2 + 1)] =>

Let's put some values for the upper numerator's.

s = -1 => 2A = 3 => A = 3/2

s = 0 => A + C = 2 => C = 2 - 3/2 => C = 1/2

s = 1 => 2A + 2(B + C) = 3 => 3 + 2B + 1 = 3 => B = -1/2

And so:

Y = ( 3/2)/(s+1) + (-s/2 + 1/2)/(s^2 + 1) =>

y = L^-1(Y) =>

y = L^-1[( 3/2)/(s+1)] + L^-1[(-s/2 + 1/2)/(s^2 + 1)] => [we try to make known forms]

y = 3/2*L^-1[1/(s+1)] -(1/2)*L^-1[s/(s^2 + 1)]  + (1/2)*L^-1[1/(s^2 + 1)] => [bingo]

y = (3/2)*e^(-x) -(1/2)*cosx + (1/2)*sinx

Example 2 [y" + 4y = 0,    if y(0) = 2 and y'(0) = 2]:

A simple constant coefficient 2nd-order ODE that is homogeneous.

Even though it's muuuuuuch faster to solve with the already known method for such cases, we will solve it using the Laplace method.

Let's find the Laplace tranformation for each side:

L(y" + 4y) = L(0) =>

L(y") + 4*L(y) = 0 => [we replace L(y") and L(y) with their counterparts]

s^2*Y - s*y(0) - y'(0) + 4Y = 0 => [set y(0) and y'(0) to their values]

s^2*Y - 2s - 2 + 4Y = 0 =>

(s^2 + 4)Y = 2s + 2 =>

Y = (2s + 2) / (s^2 + 4)

We now again have to find y using the inverse Laplace tranformation.

y = L^-1(Y) =>

y = L^-1[(2s + 2) / (s^2 + 4)] => [let's create the forms]

y = 2*L^-1[s/(s^2 + 4)] + 2*L^-1[1/(s^2 + 4)] => [bingo]

y = 2*sin(2x) + 2*cos(2x)

Example 3 [y" - y' - 2y = 4x^2,    if y(0) = 1 and y'(0) = 4]:

Again a simple constant coefficient 2nd-order linear ODE.

Let's find the Laplace tranformation for each side:

L(y" - y' - 2y) = L(4x^2) =>

L(y") - L(y') - 2*L(y) = 4*L(x^2) => [apply tranformation]

s^2*Y - s*y(0) - y'(0) - (s*Y - y(0)) - 2Y = 4*(2/s^3) => [replace y(0) and y'(0)]

s^2*Y - s - 4 - (s*Y - 1) - 2Y = 8/s^3 => [Y as common factor on the left]

Y*(s^2 - s - 2) = 8/s^3 + s + 3 => [make quotient sum on the right to one quotient]

Y*(s^2 - s - 2) = (8 + s^4 + 3s^3) / s^3 =>

Y = (8 + s^4 + 3s^3) / s^3*(s^2 - s - 2) =>

Y =  8 / s^3*(s^2 - s - 2) + s^4/s^3*(s^2 - s - 2) + 3s^3 / s^3*(s^2 - s - 2) =>

Y = 8 / s^3*(s^2 - s - 2) + s /(s^2 - s - 2) + 3/(s^2 - s - 2) => [s^2 - s - 2 = (s+1)(s-2)]

Y = 8 / s^3*(s + 1)(s - 2) + s /(s + 1)(s - 2) + 3/(s+1)(s-2)

We now have to find y, but to do this we have to use the rational integration method where we split a factor into factors.

For the 3rd we do:

3/(s+1)(s-2) = A/(s + 1) + B/(s - 2)  = [A(s - 2) + B(s + 1)] / (s + 1)(s - 2) =>

3/(s+1)(s-2) = (A+B)s - 2A + B =>

So, we solve the system:

0 = A + B => A = -B

3 = -2A + B => 3 = 3B => B = 1

And so: A = -1

Which means that:

3/(s+1)(s-2) = -[1/(s + 1)] + [1/(s - 2)]

this gives us: -e^(-x) + e^(2x)

For the 2nd we do:

s /(s + 1)(s - 2) = A/(s + 1) + B/(s - 2) = [A(s - 2) + B(s + 1)] / (s + 1)(s - 2) =>

s /(s + 1)(s - 2) = (A+B)s - 2A + B =>

So, we have the system:

s = (A+B) s => A + B = 1

0 = -2A + B => B = 2A

3A = 1 => A = 1/3

B = 2A = 2*(1/3) => B = 2/3

And so:  s /(s + 1)(s - 2) = 1/3[1/(s + 1)] + 2/3[1/(s - 2)]

This gives us: 1/3*e^(-x) + 2/3*e^(2x)

We can do similar for the 1st one and then find the corresponding inverse tranformations...

After that we have found y...

I will skip this, cause it will take some time!

Example 4 [y" + 16y = 2sin(4x),    if y(0) = -1/2 and y'(0) = 0]:

Again a constant coefficients 2nd-order linear ODE.

Let's find the laplace transformations of each side:

L(y" + 16y) = L[2sin(4x)] =>

L(y") + 16*L(y) = 2*L[sin(4x)] => [apply tranformations]

s^2*Y - s*y(0) - y'(0) + 16*Y = 2*4/(s^2 + 16) => [replace the y's and get Y as common factor]

Y*(s^2 + 16) = 8/(s^2 + 16) - s/2 =>

Y*(s^2 + 16) = (2*8 - (s^2+16)*s) / 2*(s^2 + 16) =>

Y*(s^2 + 16) = (16 - s^3 - 16s) / 2*(s^2 + 16) =>

Y = (-s^3 - 16s + 16) / 2*(s^2 + 16)^2

Very complex one that we will try to substitute into factors again.

Y = (As + B) /( s^2 + 16) + (Cs + D) /( s^2 + 16)^2 =>

Y = [(As + B)*(s^2 + 16) + Cs + D] /( s^2 + 16)^2 =>

Y = (As^3 + Bs^2 + 16As + 16B + Cs + D)/( s^2 + 16)^2 =>

Y = (As^3 + Bs^2 + (16A + C)s + 16B + D)/( s^2 + 16)^2 =>

We have to solve the system of the numerator coefficients:

-1 = A => A = -1

0 = B => B = 0

-16 = 16A + C => C = 0

16 = 16B + D => D = 16

And so:

Y = -s/(s^2 + 16) + 16/(s^2 + 16) ^2 =>

y = L^-1(Y) =>

y = L^-1[-s/(s^2 + 16)] + L^-1[16/(s^2 + 16) ^2] => [cos(ax) and sin(ax) - acos(ax) forms]

y= -(1/2)*cos(4x) + (1/16)*(sin(4x) - 4x*cos(4x))

Example 5 [y''' + y' = e^x,    if y(0) = y'(0) = y"(0) = 0 ]:

This time it's a more difficult case.

I will not solve it but leave it as an example for you and just give you some in-between answers.

By finding the Laplace tranformations again we end up with:

Y = 1 / [s*(s-1)*(s^2+1)]

We analyze it in factors and get:

Y = -1/s + (1/2)/(s - 1) + (s/2 - 1/2)/(s^2 + 1)

By splitting the last one and applying inverse we get:

y = -1 +1/2*e^x + 1/2*cosx - 1/2*sinx

## Differential System Example

Let's also solve a differential system so that you have a better understanding!

Example 1:

y" + z + y = 0

y' + z' = 0

If y(0) = y'(0) = 0 and z(0) = 1

We find the Laplace tranformations for each equation:

L(y") + L(z) + L(y) = 0

L(y') + L(z') = 0

=> [apply tranformations]

s^2*Y - s*y(0) - y'(0) + Z + Y = 0

sY - y(0) + sZ + z(0) = 0

=> [replace y's and z's]

s^2*Y  + Z + Y = 0

sY + sZ - 1 = 0

=> [make a better form]

(s^2 + 1)Y + Z = 0

sY + sZ = 1

=> [divide the second with s]

(s^2 + 1)Y + Z = 0

Y + Z = 1/s

=> [substract the two equations two get rid of Z]

(s^2 + 1)Y + Z - Y - Z = -1/s =>

(s^2 + 1 - 1)*Y = -1/s =>

Y = -1/s^3 => y = -1/2 * x^2

From Y + Z = 1/s we have:

Z = 1/s + 1/s^3 => z = 1 + 1/2*x^2

Example 2:

z" + y' = cosx

y" - z = sinx

If z(0) = z'(0) = -1, y(0) = 1 and y'(0) = 0

I will not solve this one, but give you some in-between answers and the solutions so that you can try it by yourself.

We start by finding the Laplace tranformations and multiplying the firstone by s. We then subtract the equations and get Z, by getting rid of Y.

That way:

Z = -(s^3 + 1)/(s^2 + 1)*(s^2 - s + 1) => z = -cosx - sinx

Y = s / (s^2 + 1) => y = cosx

### Previous posts of the series:

Introduction -> Definition and Applications

First-order part(1) ->  Separable, homogeneous and exact 1st-order ODE's

First-order part(2) -> Linear, Bernoulli and Riccati first-order ODE's

First-order exercises -> Exercises for all the 1st-order ODE types

Second-order linear with const coeffs -> Constant coefficient linear 2nd-order ODE's

Special second-order forms -> Linear Euler ODE, Wronsky and Lagrange (Canonical) methods

Second-order exercises -> Exercises for 2nd-order ODE's

Laplace method -> Laplace method for solving ODE's and systems of ODE's

And this is actually it for today and I hope that you enjoyed it!
Next time in Mathematics we will get into how we solve Differential equations using Linear Algebra, and after that we can start getting into Mathematical Analysis again!

Bye!

H2
H3
H4
3 columns
2 columns
1 column