# Solve Differential Equations Using Laplace Transform

Examples of how to use Laplace transform to solve ordinary differential equations (ODE) are presented. One of the main advantages in using Laplace transform to solve differential equations is that the Laplace transform converts a differential equation into an algebraic equation.
Heavy calculations involving decomposition into partial fractions are presented in the appendix at the bottom of the page.

Example 1
Use Laplace transform to solve the differential equation $- 2 y' + y = 0$ with the initial conditions $y(0) = 1$ and $y$ is a function of time $t$.
Solution to Example1
Let $Y(s)$ be the Laplace transform of $y(t)$
Take the Laplace transform of both sides of the given differential equation: $\mathscr{L}\{ y(t) \} = Y(s)$
$\mathscr{L}\{ -2 y' + y\} = \mathscr{L}\{0 \}$
Use linearity property of Laplace transform to rewrite the equation as
$- 2 \mathscr{L}\{ y'\} + \mathscr{L}\{ y\} = \mathscr{L}\{0 \}$
Use derivative property to rewrite the term $\mathscr{L}\{ y'\} = (s Y(s) - y(0))$.
$- 2 ( s Y(s) - y(0)) + Y(s) = 0$
Expand the above as
$- 2 s Y(s) + 2 y(0) + Y(s) = 0$
Substitute $y(0)$ by its given numerical value
$- 2 s Y(s) + 2 + Y(s) = 0$
Solve the above for $Y(s)$
$Y(s) (1 - 2 s) = -2$
$Y(s) = \dfrac{2}{2 s - 1}$
$Y(s) = \dfrac{1}{ s - 1/2}$
We now use formula (3) in the table of formulas of Laplace transform to find the inverse Laplace transform of $Y(s)$ obtained above as
$\displaystyle y(t) = e^{\frac{1}{2} t }$
Note: Check solution
let's check that the solution obtained $y(t) = e^{\frac{1}{2} t }$ satisfies the given differential equation
$- 2 y' + y = - 2 ( (1/2) e^{\frac{1}{2} t } ) + e^{\frac{1}{2} t }$
Simplify the above
$- e^{\frac{1}{2} t } + e^{\frac{1}{2} t } = 0$ ; differential equation satisfied.
$y(0) = e^{\frac{1}{2} 0 } = e^0 = 1$ ; initial value also satisfied.

Example 2
Use Laplace transform to solve the differential equation $y'' - 2 y' -3 y = 0$ with the initial conditions $y(0) = 2$ and $y'(0) = - 1$ and $y$ is a function of time $t$.
Solution to Example 2
Let $Y(s)$ be the Laplace transform of $y(t)$
Take the Laplace transform of both sides of the given differential equation
$\mathscr{L}\{ y'' - 2 y' -3 y \} = \mathscr{L}\{0 \}$
Use linearity property of Laplace transform to rewrite the equation as
$\mathscr{L}\{ y"\} - 2 \mathscr{L}\{ y'\} - 3 \mathscr{L}\{ y \} = \mathscr{L}\{0 \}$
Use first and second derivative properties to rewrite the terms $\mathscr{L}\{ y"\}$ and $\mathscr{L}\{ y'\}$ and simplify the right side.
$s^2 Y(s) - s y(0) - y'(0) - 2 (sY(s) - y(0)) - 3 Y(s) = 0$
Substitute $y(0)$ and $y'(0)$ by their numerical values and expand
$s^2 Y(s) - 2 s + 1 - 2 s Y(s) + 4 - 3Y(s) = 0$
Group like terms and keep terms with $Y(s)$ on the left
$s^2 Y(s) - 2 s Y(s) - 3 Y(s) = 2 s - 5$
Factor $Y(s)$ out
$Y(s) (s^2 - 2 s - 3 ) = 2 s - 5$
Solve the above for $Y(s)$
$Y(s) = \dfrac{2s - 5}{s^2 - 2 s - 3}$
Expand the right side into partial fractions (see details in Appendix A at the bottom of the page)
$Y(s) = \dfrac{7}{4\left(s+1\right)}+\dfrac{1}{4\left(s-3\right)}$
We now use formula (3) in the table of formulas of Laplace transform to find the inverse Laplace transform of $Y(s)$ which is given by
$\displaystyle y(t) = \dfrac{7}{4} e^{- t } + \dfrac{1}{4} e^{3 t }$
You may check that the solution obtained satisfies the differential equation and the initial values given.

Example 3
Use Laplace transform to solve the differential equation $y'' + 2 y' + 2 y = 0$ with the initial conditions $y(0) = -1$ and $y'(0) = 2$ and $y$ is a function of time $t$.
Solution to Example 3
Let $Y(s)$ be the Laplace transform of $y(t)$
Take the Laplace transform of both sides of the given differential equation
$\mathscr{L}\{ y'' + 2 y' + 2 y \} = \mathscr{L}\{0 \}$
Use linearity property of Laplace transform to rewrite the equation as
$\mathscr{L}\{ y"\} + 2 \mathscr{L}\{ y'\} + 2 \mathscr{L}\{ y \} = \mathscr{L}\{0 \}$
Use first and second derivative properties to rewrite the terms $\mathscr{L}\{ y"\}$ and $\mathscr{L}\{ y'\}$ and simplify the right side.
$s^2 Y(s) - s y(0) - y'(0) + 2 (sY(s) - y(0)) + 2 Y(s) = 0$
Substitute $y(0)$ and $y'(0)$ by their numerical values and expand
$s^2 Y(s) + s - 2 + 2 s Y(s) + 2 + 2 Y(s) = 0$
Group like terms and keep terms with $Y(s)$ on the left side of the equation
$s^2 Y(s) + 2 s Y(s) + 2 Y(s) = - s$
Factor $Y(s)$ out
$Y(s) (s^2 + 2 s + 2 ) = - s$
Solve the above for $Y(s)$
$Y(s) = \dfrac{-s}{s^2 + 2 s + 2}$
Factor denominator over the complex numbers by first solving the equation
$s^2 + 2 s + 2 = 0$
which gives two complex solutions
$S_1 = -1 + j$ and $s_2 = -1 - j$
Factor
$Y(s) = \dfrac{-s}{(s - s_1)(s - s_2)}$
Expand the right side of the above into partial fractions (see Appendix B at the bottom of the page)
$\dfrac{-s}{(s - s_1)(s - s_2)} = \dfrac{A}{s-s_1} + \dfrac{B}{s-s_2}$
with
$A = \dfrac{-s_1}{s_1-s_2} = \dfrac{-(-1 + j)}{2 j} = -\dfrac{1}{2} - \dfrac{1}{2} j$
and
$B = \dfrac{-s_2}{s_2-s_1} = \dfrac{-(-1 - j)}{-2 j} = - \dfrac{1}{2} + \dfrac{1}{2} j$
Use formulas in the table of formulas to find the inverse Laplace transform of $Y(s) = \dfrac{A}{s-s_1} + \dfrac{B}{s-s_2}$ which is given by
$y(t) = A e^{s_1 t} + B e^{s_2 t}$
Let us write $A$ and $B$ in exponential form
$A = -\dfrac{1}{2} - \dfrac{1}{2} j = \frac{\sqrt 2}{2} e^{ \frac{-3\pi}{4} j}$
$B = -\dfrac{1}{2} + \dfrac{1}{2} j = \frac{\sqrt 2}{2} e^{ \frac{3\pi}{4} j}$
Substitute $s_1$, $s_2$, $A$ and $B$ by their values and rewrite $y(t)$ as
$y(t) = (\frac{\sqrt 2}{2} e^{ \frac{-3\pi}{4} j}) e^{(-1 + j) t} + (\frac{\sqrt 2}{2} e^{ \frac{3\pi}{4} j}) e^{(-1 - j) t}$
Factor $\dfrac{\sqrt 2}{2} e^{-t}$ out and group exponents
$y(t) = \dfrac{\sqrt 2}{2} e^{-t} \left[ e^{j t - \frac{3\pi}{4} j } + e^{-j t + \frac{3\pi}{4} j } \right]$
Use Euler formula ( $e^jx = \cos x + j \sin x$ ) to simplify the terms inside the brackets
$y(t) = \dfrac{\sqrt 2}{2} e^{-t} \left[ \cos(t - \frac{3\pi}{4}) + j\sin(t - \frac{3\pi}{4}) + \cos(-t + \frac{3\pi}{4}) + j\sin(- t + \frac{3\pi}{4}) \right]$
which simplifies to
$y(t) = \sqrt 2 e^{-t} \cos(t - \frac{3\pi}{4})$
You may check that the solution obtained satisfies the differential equation and the initial values given.

Example 4
Use Laplace transform to solve the differential equation $y'' - y' - 2 y = \sin(3t)$ with the initial conditions $y(0) = 1$ and $y'(0) = -1$.
Solution to Example 4
Let $Y(s)$ be the Laplace transform of $y(t)$
Take the Laplace transform of both sides of the given differential equation
$\mathscr{L}\{ y'' - y' - 2 y \} = \mathscr{L}\{ \sin(3t) \}$
Use linearity property of Laplace transform to expand the left side and use table to evaluate the right side.
$\mathscr{L}\{ y"\} - \mathscr{L}\{ y'\} - 2 \mathscr{L}\{ y \} = \dfrac{3}{s^2+3^2}$
Use first and second derivative properties to rewrite the terms $\mathscr{L}\{ y"\}$ and $\mathscr{L}\{ y'\}$ and simplify the right side.
$s^2 Y(s) - s y(0) - y'(0) - (sY(s) - y(0)) + 2 Y(s) = \dfrac{3}{s^2+3^2}$
Substitute $y(0)$ and $y'(0)$ by their numerical values and expand
$s^2 Y(s) - s + 1 - s Y(s) + 1 - 2 Y(s) = \dfrac{3}{s^2+3^2}$
Group like terms and keep terms with $Y(s)$ on the left side of the equation
$s^2 Y(s) - s Y(s) - 2 Y(s) = \dfrac{3}{s^2+3^2} + s - 2$
Factor $Y(s)$ out on the left side
$Y(s) (s^2 - s - 2 ) = \dfrac{3}{s^2+3^2} + s - 2$
Solve the above for $Y(s)$
$Y(s) = \dfrac{3}{(s^2+3^2)(s^2 - s - 2)} + \dfrac{s-2}{s^2 - s - 2}$
Factor the term $s^2 - s - 2$ in the denominator
$Y(s) = \dfrac{3}{(s^2+3^2)(s-2)(s+1)} + \dfrac{s-2}{(s-2)(s+1)}$
which may be expanded in partial fractions as (see Appendix C at the bottom of the page for details).
$Y(s) = \dfrac{3s}{130(s^2+3^2)} - \dfrac{33}{130(s^2+3^2)} + \dfrac{9}{10(s+1)} + \dfrac{1}{13(s-2)}$
We now use formulas in the table of formulas of Laplace tranform to find the inverse Laplace transform of $Y(s)$ which is given by
$y(t) = \dfrac{3}{130} \cos(3x) - \dfrac{11}{130} \sin(3x) + \dfrac{9}{10} e^{-x} +\dfrac{1}{13} e^{2x}$

## Appendix A

Partial fractions decomposition of example 2
Factor denominator
$\dfrac{2s - 5}{s^2 - 2 s - 3} = \dfrac{2s - 5}{(s-3)(s+1)}$
Expand into partial fractions
$\dfrac{2s - 5}{s^2 - 2 s - 3} = \dfrac{A}{s+1} + \dfrac{B}{s-3}$
Multiply all terms of the above by $(s-3)(s+1)$ and simplify
$2s - 5 = A(s-3) + B(s+1)$      (1)
Set $s = 3$ in equation (1)
2(3) - 5 = A(3 -3) + B(3+1)
Simplify and solve for $B$
$B = 1/4$
Set $s = - 1$ in equation (1) $2(-1) - 5 = A(-1-3) + B(-1+1)$
Simplify and solve for $A$
$A = \dfrac{7}{4}$

## Appendix B

Partial fractions decomposition of example 3
Partial fractions decomposition of $\dfrac{-s}{(s - s_1)(s - s_2)}$
$\dfrac{-s}{(s - s_1)(s - s_2)} = \dfrac{A}{s-s_1} + \dfrac{B}{s-s_2}$
Multiply all terms of the above by $(s - s_1)(s - s_2)$ and simplify
$- s = A (s-s_2) + B(s - s_1)$       (1)
Evaluate the above at $s=s_1$
$- s_1 = A (s_1-s_2) + B(s_1 - s_1)$
Simplify
$-s_1 = A (s_1-s_2)$
Solve for $A$
$A = \dfrac{-s_1}{s_1-s_2} = \dfrac{-(-1 + j)}{2 j} = -\dfrac{1}{2} - \dfrac{1}{2} j$
Evaluate both sides of eq equation (1) at $S = s_2$ and find $B$ in a similar way as finding $A$ above
$B = \dfrac{-s_2}{s_2-s_1} = \dfrac{-(-1 - j)}{-2 j} = - \dfrac{1}{2} + \dfrac{1}{2} j$

## Appendix C

Expand in partial fractions from example 4
$\dfrac{3}{(s^2+3^2)(s^2 - s - 2)} + \dfrac{s-2}{s^2 - s - 2}$
Factor denominators
$\dfrac{3}{(s^2+3^2)(s-2)(s+1)} + \dfrac{s-2}{(s-2)(s+1)}$
Simplify the term on the right
$\dfrac{3}{(s^2+3^2)(s-2)(s+1)} + \dfrac{1}{s+1}$
Express into partial fractions
$\dfrac{3}{(s^2+3^2)(s-2)(s+1)} + \dfrac{1}{s+1} = \dfrac{As + B}{s^2+3^2} + \dfrac{C}{s+1} + \dfrac{D}{s-2}$
Multiply all terms of the above by the denominator $(s^2+3^2)(s-2)(s+1)$ and simplify
$3 + (s^2+3^2)(s-2) = (As + B)(s-2)(s+1) + C (s^2+3^2)(s-2) + D (s^2+3^2)(s+1)$     (1)
Select values of $s$ that simplify calculations for the coefficients $A, B, C$ and $D$
Set $s = 2$ on both sides of equation (1)
$3 + (2^2+3^2)(2-2) = (2 A + B)(2-2)(s+1) + C (2^2+3^2)(2-2) + D (2^2+3^2)(2+1)$
Simplify
$3 = 39 D$
Solve for $D$
$D = \dfrac{1}{13}$
Set $s = -1$ on both sides of equation (1)
$3 + ((-1)^2+3^2)(-1-2) = (-A + B)(-1-2)(-1+1) + C ((-1)^2+3^2)(-1-2) + D ((-1)^2+3^2)(-1+1)$
Simplify
$3 - 30 = - 30 C$
Solve for $C$
$C = \dfrac{9}{10}$
Set $s = 0$ on both sides of equation (1)
$3 +(0^2+3^2)(0-2) = (0 + B)(0-2)(0+1) + C (0^2+3^2)(0-2) + D (0^2+3^2)(0+1)$
Simplify
$3 - 18 = -2 B - 19 C + 9D$
Substitute $C$ and $D$ by their numerical values obtained above and solve for B to obtain
$B = -\dfrac{33}{130}$
Set $s = 1$ on both sides of equation (1)
$3 + (1^2+3^2)(1-2) = (A + B)(1-2)(1+1) + C (1^2+3^2)(1-2) + D (1^2+3^2)(1+1)$
Substitute $B, C$ and $D$ by their numerical values obtained above and solve for A to obtain
$A = \dfrac{3}{130}$
Hence
$\dfrac{3}{(s^2+3^2)(s^2 - s - 2)} + \dfrac{s-2}{s^2 - s - 2}$

$\quad \quad = \dfrac{As}{s^2+3^2} + \dfrac{B}{s^2+3^2} + \dfrac{C}{s+1} + \dfrac{D}{s-2}$

$\quad \quad = \dfrac{ 3s}{130(s^2+3^2)} - \dfrac{33}{130(s^2+3^2)} + \dfrac{9}{10(s+1)} + \dfrac{1}{13(s-2)}$

More Formulas and Properties of Laplace Transform are included.

## More References and Links

Laplace Transforms Computations Examples with Solutions.
Formulas and Properties of Laplace Transform
Engineering Mathematics with Examples and Solutions