We will solve the differential equation $$ay^{\prime \prime}+by^\prime+cy=f(t)$$ using its "impulse response".

First, consider instead the related differential equation $$ay^{\prime \prime}+by^\prime+cy=\delta(t)$$ where $\delta(t)$ is the dirac function.

We take the Laplce transform and solve for $Y(s)$, we'll assume for now that $y(0)=0$ and $y^\prime(0)=0$.

\begin{align*} ay^{\prime \prime}+by^\prime+cy&=\delta(t)\\ \downarrow \mathscr{L}\\ as^2Y(s)+bsY(s)+CY(s)&=1\\ Y(s)&=\frac{1}{as^2+bs+c}\\ \end{align*}

The inverse transform

$$\zeta(t)=\mathscr{L}^{-1}\left(\frac{1}{as^2+bs+c}\right) $$

is called the impulse response and we denote it $\zeta(t)$.

Now, return to the differential equation $$ay^{\prime \prime}+by^\prime+cy=f(t).$$ Take the Laplace transform: $$as^2Y(s)+bsY(s)+CY(s)=F(s),$$ and solve for $Y(s)$:

$$Y(s)=\frac{1}{as^2+bs+c}\cdot F(s).$$


Finally, use the convolution theorem to find $y(t)$:

\begin{align*} y(t)&=\mathscr{L}^{-1}\left(\frac{1}{as^2+bs+c}\cdot F(s)\right)\\ &=\mathscr{L}^{-1}\left(\frac{1}{as^2+bs+c}\right) \star \mathscr{L}^{-1}\left( F(s)\right)\\ &=\zeta(t) \star f(t)\\ &=\int_0^t \zeta(t-\tau)\cdot f(\tau)d\tau=\int_0^t \zeta(\tau)\cdot f(t-\tau)d\tau.\\ \end{align*}

We use the symbol $\star$ to denote convolution. The two integrals on the last line give the same result; take your pick.

Below are two examples. The first is just as above, with $y(0)=0$ and $y\prime(0)=0$. In the second example we'll illustrate how to modify (slightly) the procedure when the intial conditions are not zero.

Example 1

$$y^{\prime \prime}-5y^\prime +6y=10e^t\cos t, \phantom{space}, $$

with $y(0)=0$ and $y^\prime(0)=0$.

Step 1:

Solve $y^{\prime \prime}-5y^\prime +6y=\delta(t)$:

\begin{align*} y^{\prime \prime}-5y^\prime +6y&=\delta(t)\\ \downarrow \mathscr{L}\\ s^2Y-5sY+6Y&=1\\ Y&=\frac{1}{s^2-5s+6}=\frac{1}{(s-3)(s-2)}=\frac{1}{s-3}-\frac{1}{s-2}\\ \downarrow \mathscr{L}\\ \zeta(t)&=e^{3t}-e^{2t}\\ \end{align*}

Step 2:

$y(t)=\zeta(t) \star f(t)$

\begin{align*} y(t)&=\left(e^{3t}-e^{2t} \right) \star 10e^t\cos t\\ &= \int_0^t e^{3(t-\tau)}-e^{2(t-\tau)}\cdot e^\tau\cos \tau d\tau\\ \end{align*}

This intgral can be computed in a straighforward way using integration by parts. Or:

In [12]:
syms t zeta(t) f(t) y(t) tau
zeta(t)=exp(3*t)-exp(2*t)
f(t)=10*exp(t)*cos(t)
y(t)=int(zeta(t-tau)*f(tau), tau, 0, t)
 
zeta(t) =
 
exp(3*t) - exp(2*t)
 
 
f(t) =
 
10*exp(t)*cos(t)
 
 
y(t) =
 
4*exp(3*t) - 5*exp(2*t) + exp(t)*cos(t) - 3*exp(t)*sin(t)
 

Example 2

We'll use the same differential equation, $$y^{\prime \prime}-5y^\prime +6y=10e^t\cos t,$$ but with $y(0)=2$ and $y^\prime(0)=1$.

As before, we start by taking the Laplace transform of the modified differential equation, only more is happening this time. Solve for $Y(s)$, and take the inverse transform:

\begin{align*} y^{\prime \prime}-5y^\prime +6y&=\delta(t)\\ \downarrow \mathscr{L}\\ -y^\prime(0)-sy(0)+s^2Y-5(-y(0)+sY)+6Y&=1\\ -1-2s+s^2Y+10-5sY+6Y&=1\\ (s^2-5s+6)Y&=-8+2s\\ Y&=\frac{-8+2s}{s^2-5s+6}=\frac{4}{s-2}-\frac{2}{s-3}\\ \zeta(t)&=4e^{2t}-2e^{3t}\\ \end{align*}

Then,

\begin{align*} y(t)&=\zeta(t) \star f(t)\\ &=\zeta(t) \star 10e^t\cos t\\ \end{align*}
In [18]:
syms  t  tau 
zeta(t)=4*exp(2*t)-2*exp(3*t)
f(t)=10*exp(t)*cos(t)
y(t)=int(zeta(t-tau)*f(tau), tau, 0, t)
 
zeta(t) =
 
4*exp(2*t) - 2*exp(3*t)
 
 
f(t) =
 
10*exp(t)*cos(t)
 
 
y(t) =
 
20*exp(2*t) - 8*exp(3*t) - 12*exp(t)*cos(t) + 16*exp(t)*sin(t)
 
In [ ]: