The following exercise is about solving a second order non homogenous differential equation using Laplace transform. We have:

\left\{\begin{array}{l} y''+y=f(t), \\ y(0)=y'(0)=0 \end{array}\right.

The right hand side f is a function given by:

f(t)=\left\{\begin{array}{ll} 0.5t, & 0\leq t<6 \\ 3, & t\geq6 \end{array}\right.

Find the solution y(t). You can check the correponding lesson here!


Solution of a second order non homogenous differential equation

1. Simplify f(t) expression using the heaviside step function

The graph of the function f is given below:

Exercise 1 solve second order differential non homogenous equation using Laplace transform
Right-hand side function of a second-order differential equation

We may rewrite it using the unit-step function as follows:

\displaystyle f(t)=\frac{t}{2}+\left(3-\frac{t}{2}\right)u(t-6)

So, the differential equation in the initial-value problem becomes:

\displaystyle y''+y=\frac{t}{2}+\left(3-\frac{t}{2}\right)u(t-6)

2. Apply Laplace transform to get Y(s)

From Laplace transform linearity, we get

\begin{aligned} & \mathscr{L}\{y''+y\}=\mathscr{L}\left\{\frac{t}{2}+\left(3-\frac{t}{2}\right)u(t-6)\right\} \\ & \mathscr{L}\{y''\}+\mathscr{L}\{y\}=\frac{1}{2}\mathscr{L}\{t\}+\mathscr{L}\left\{\left(3-\frac{t}{2}\right)u(t-6)\right\} \end{aligned}

And from Laplace transform time shift property, we have

\mathscr{L}\{g(t)u(t-a)\}=e^{-as}\mathscr{L}\{g(s+a)\}

so for

\displaystyle g(t)=3-\frac{t}{2}

we have

\displaystyle g(t+6)=3-\frac{t+6}{2}=3-\frac{t}{2}+\frac{6}{2}=-\frac{t}{2}

Hence:

\displaystyle \mathscr{L}\{g(t+6)\}=-\frac{1}{2}\mathscr{L}\{t\}=-\frac{1}{2s^{2}}

Thus

\begin{aligned} \mathscr{L}\left\{\left(3-\frac{t}{2}\right)u(t-6)\right\} & = \mathscr{L}\{g(t)u(t-6)\} \\ & = e^{-6s}\mathscr{L}\{g(t+6)\} \\ & = -e^{-6s}\frac{1}{2s^{2}} \end{aligned}

And since (Laplace transform of derivatives lesson):

\mathscr{L}\{y''\}=s^{2}Y(s)-sy(0)-y(0)=s^{2}Y(s)

then the algebric equation in Y(s) will be

s^{2}Y(s)+Y(s)=\frac{1}{2s^{2}}-\frac{e^{-6s}}{2s^{2}}

which becomes

\begin{aligned} & (s^{2}+1)Y(s)=\frac{1}{2}\left(\frac{1}{s^{2}}-\frac{e^{-6s}}{s^{2}}\right) \\ & Y(s)=\frac{1}{2}\left(\frac{1}{s^{2}}-\frac{e^{-6s}}{s^{2}}\right)\cdot\frac{1}{s^{2}+1} \\ & Y(s)=\frac{1}{2}\left(\frac{1}{s^{2}(s^{2}+1)}-\frac{e^{-6s}}{s^{2}(s^{2}+1)}\right) \end{aligned}

3. Apply inverse Laplace transform to get y(t)

Therefore, the solution of the initial-value problem is such that:

\displaystyle y(t)=\frac{1}{2}\cdot\left(\mathscr{L}^{-1}\left\{\frac{1}{s^{2}(s^{2}+1)}\right\}-\mathscr{L}^{-1}\left\{\frac{1}{s^{2}(s^{2}+1)}e^{-6s}\right\}\right)

Let

\displaystyle H(s)=\frac{1}{s^{2}(s^{2}+1)}

we get

\displaystyle y(t)=\frac{1}{2}\cdot(\mathscr{L}^{-1}\{H(s)\}-\mathscr{L}^{-1}\{H(s)e^{-6s}\})

To find \mathscr{L}^{-1}\{H(s)\}, we have, at first, to decompose it into partial fractions as follows:

\begin{aligned} \frac{1}{s^{2}(s^{2}+1)} & = \frac{A}{s}+\frac{B}{s^{2}}+\frac{Cs+D}{s^{2}+1} \\ & = \frac{As(s^{2}+1)+B(s^{2}+1)+(Cs+D)s^{2}}{s^{2}(s^{2}+1)} \\ & = \frac{As^{3}+As+Bs^{2}+B+Cs^{3}+Ds^{2}}{s^{2}(s^{2}+1)} \\ & = \frac{(A+C)s^{3}+(B+D)s^{2}+As+B}{s^{2}(s^{2}+1)} \end{aligned}

from which we build the linear system below

\left\{\begin{array}{l} A+C=0 \\ B+D=0 \\ A=0 \\ B=1 \end{array}\right.

It is clear A=C=0 and as D=-B then D=-1. Hence

\displaystyle \frac{1}{s^{2}(s^{2}+1)}=\frac{1}{s^{2}}-\frac{1}{s^{2}+1}

Thus

\begin{aligned} h(t)=\mathscr{L}^{-1}\{H(s)\} & = \mathscr{L}^{-1}\left\{\frac{1}{s^{2}}\right\}-\mathscr{L}^{-1}\left\{\frac{1}{s^{2}+1}\right\} \\ & = t-\sin(t) \end{aligned}

It follows from:

\mathscr{L}^{-1}\{e^{at}F(s)\}=f(t-a)u(t-a)

that, for a=6,

\begin{aligned} & \mathscr{L}^{-1}\{H(s)e^{-6s}\}=h(t-6)u(t-6) \\ \Rightarrow & \mathscr{L}^{-1}\{H(s)e^{-6s}\}=(t-6-\sin(t-6))u(t-6) \end{aligned}

Therefore

y(t)=\frac{1}{2}(t-\sin(t)-(t-6-\sin(t-6))u(t-6))

That’s all!

We reached the end of this illustrative example about solving second-order differential equations with a right-hand side using the Laplace transform. If you would like to practice, check this example with a sinusoid right-hand side.