# The Laplace Transform: The Inverse Transforms

Let $\mathcal{L}^{-1}\{f(s)\}$ denote a function whose Laplace transform is $f(s)$ i.e. if $\mathcal{L}\{F(t)\}=f(s)$ then $F(t)=\mathcal{L}^{-1}\{f(s)\}$. For example,
$$\mathcal{L}^{-1}\left\{\frac{1}{s-k}\right\}=e^{kt},\ \mathcal{L}^{-1}\left\{\frac{k}{s^2+k^2}\right\}=\sin kt$$
$F(t)$ is called the inverse transform of $f(s)$. There is a question that must be addressed. Is the inverse transform of $f(s)$ unique? The answer is not really. For example, we know that $F_1(t)=e^{kt}$ is an inverse transform of $\frac{1}{s-k}$. Define
F_2(t)=\left\{\begin{aligned} e^{kt},\ &0<t<2,\ t>2\\ 1,\ &t=2 \end{aligned}\right.
The transform of $F_2(t)$ is
\begin{align*}
\mathcal{L}\{F_2(t)\}&=\int_0^\infty e^{-st}F_2(t)dt\\
&=\int_0^2 e^{-st}e^{kt}dt+\int_2^\infty e^{-st}e^{kt}dt\\
&=\frac{1}{s-k}
\end{align*}
So are we in trouble then? Not really. We introduce the following theorem without proof.

Theorem. If two functions $F_1(t)$ and $F_2(t)$ have the same Laplace transform, then $F_2(t)=F_1(t)+N(t)$ where $N(t)$ satisfies
$$\int_0^T N(t)dt=0$$
for every positive $T$.

Such a function $N(t)$ is called a null function. In the above example,
N(t)=\left\{\begin{aligned} 1-e^{2k},\ &=t=2\\ 0,\ &t\ne 2 \end{aligned}\right.
In view of this theorem the inverse transform is essentially unique because a null function is not important in the applications. For this reason this theorem is called the uniqueness of the inverse transform.

Due to the linearity of $\mathcal{L}$, we have
\begin{align*}
\mathcal{L}\{AF(t)+BG(t)\}&=A\mathcal{L}\{F(t)\}+B\mathcal{L}\{G(t)\}\\
&=Af(s)+Bg(s)
\end{align*}
Now
\begin{align*}
\mathcal{L}^{-1}\{Af(s)+Bg(s)\}&=AF(t)+BG(t)\\
&=A\mathcal{L}^{-1}\{f(s)\}+B\mathcal{L}^{-1}\{g(s)\}
\end{align*}
so $\mathcal{L}^{-1}$ is also linear.

Suppose that the Laplace transform of $F(t)$ converges when $s>k$.
$$f(s)=\int_0^\infty e^{-st}F(t)dt\ (s>k)$$
Substitute $s-a$ for $s$. Then
\begin{align*}
f(s-a)&=\int_0^\infty e^{-(s-a)t}F(t)dt\\
&=\int_0^\infty e^{-st}e^{at}F(t)dt\\
&=\mathcal{L}\{e^{at}F(t)\}
\end{align*}
Therefore

\mathcal{L}\{e^{at}F(t)\}=f(s-a),\ s>a+k

Example.
$$\mathcal{L}\{e^{at}t^n\}=\frac{n!}{(s-a)^{n+1}},\ s>a$$

Example.
$$\mathcal{L}\{e^{-at}\cos kt\}=\frac{s+a}{(s+a)^2+k^2},\ s>-a$$

Partial fractions often play a useful role in finding $\mathcal{L}^{-1}$ as seen in the following examples.

Example. Find $\mathcal{L}^{-1}\left\{\frac{s+1}{s^2+2s}\right\}$

Solution. $s^2+2s=s(s+1)$ so let
$$\frac{s+1}{s^2+2s}=\frac{A}{s}+\frac{B}{s+2}$$
Then we have
\begin{align*}
s+1&=A(s+2)+Bs\\
&=(A+B)s+2A
\end{align*}
This means $A+B=1$ and $2A=1$ i.e. $A=B=\frac{1}{2}$. Hence
\begin{align*}
\mathcal{L}^{-1}\left\{\frac{s+1}{s^2+2s}\right\}&=\frac{1}{2}\mathcal{L}^{-1}\left\{\frac{1}{2}\right\}+\frac{1}{2}\mathcal{L}^{-1}\left\{\frac{1}{s+2}\right\}\\
&=\frac{1}{2}+\frac{1}{2}e^{-2t}
\end{align*}

Example. Find $\mathcal{L}^{-1}\left\{\frac{a^2}{s(s+a)^2}\right\}$ ($a\ne 0$).

Solution. Let
$$\frac{a^2}{s(s+a)^2}=\frac{A}{s}+\frac{B}{s+a}+\frac{C}{(s+a)^2}$$
Then we have
$$a^2=A(s+a)^2+Bs(s+a)+Cs$$
For $s=0$, $a^2=Aa^2$ i.e. $A=1$. For $s=-a$, $a^2=-Ca$ i.e. $C=-a$. For $s=a$, $a^2=3a^2+2a^2B$ which is reduced to $-2a^2=2a^2B$ i.e. $B=-1$. Hence
\begin{align*}
\mathcal{L}^{-1}\left\{\frac{a^2}{s(s+a)^2}\right\}&=\mathcal{L}^{-1}\left\{\frac{1}{2}\right\}-\mathcal{L}^{-1}\left\{\frac{1}{s+a}\right\}-a\mathcal{L}^{-1}\left\{\frac{1}{(s+a)^2}\right\}\\
&=1-e^{-at}-ate^{-at}
\end{align*}

Example. Find $\mathcal{L}^{-1}\left\{\frac{s}{(s^2+a^2)(s^2+b^2}\right\}$ ($a^2\ne b^2$).

$$\frac{s}{(s^2+a^2)(s^2+b^2)}=\frac{As+B}{s^2+a^2}+\frac{Cs+D}{s^2+b^2}$$
However one can write
\begin{align*}
\frac{s}{(s^2+a^2)(s^2+b^2)}&=\frac{s}{a^2-b^2}\left[\frac{s^2+a^2-(s^2+b^2)}{(s^2+a^2)(s^2+b^2)}\right]\\
&=\frac{1}{b^2-a^2}\left[\frac{s}{s^2+a^2}-\frac{s}{s^2+b^2}\right]
\end{align*}
Hence
$$\mathcal{L}^{-1}\left\{\frac{s}{(s^2+a^2)(s^2+b^2)}\right\}=\frac{1}{b^2-a^2}(\cos at-\cos bt)$$

Example. Find $F(t)$ is $f(s)=\frac{5s+3}{(s-1)(s^2+2s+5)}$.

Solution. Let
$$\frac{5s+3}{(s-1)(s^2+2s+5)}=\frac{A}{s-1}+\frac{Bs+C}{s^2+2s+5}$$
Then we obtain $A=1$, $B=-1$ and $C=2$.
\begin{align*}
f(s)&=\frac{1}{s-1}-\frac{s-2}{s^2+2s+5}\\
&=\frac{1}{s-1}-\frac{s-2}{(s+1)^2+4}\\
&=\frac{1}{s-1}-\frac{s+1-3}{(s+1)^2+2^2}\\
&=\frac{1}{s-1}-\frac{s+1}{(s+1)^2+2^2}+\frac{3}{2}\frac{2}{(s+1)^2+2^2}
\end{align*}
Hence
$$F(t)=e^t-e^{-t}\cos 2t+\frac{3}{2}e^{-t}\sin 2t$$

# The Laplace Transform: Transforms of Derivatives

\begin{align*}
\mathcal{L}\{F'(t)\}&=\int_0^\infty e^{-st}F'(t)dt\\
&=e^{-st}F(t)\vert_0^\infty+s\int_0^\infty e^{-st}F(t)dt
\end{align*}
In order to ensure that $\mathcal{L}\{F'(t)\}$ exists, other than requiring that $F'(t)$ is piecewise continuous in every finite interval $[0,T]$ we also need to require that $F(t)$ be of order $e^{\alpha t}$, in terms of the big O notation we write $F(t)=O(e^{\alpha t})$ as $t\to\infty$, meaning $\frac{F(t)}{e^{\alpha t}}$ is bounded for large $t$ i.e. there exists $M>0$ such that $e^{-\alpha t}|F(t)|<M$ for large $t$. With this assumption,
$$|e^{-st}F(t)|<Me^{-(s-\alpha)t}\to 0$$
as $t\to\infty$ provided $s>\alpha$. Consequently, we have

\label{eq:laplace6}
\mathcal{L}\{F'(t)\}=s\mathcal{L}\{F(t)\}-F'(0)

Using \eqref{eq:laplace6}
\begin{align*}
\mathcal{L}\{F^{\prime\prime}(t)\}&=s\mathcal{L}\{F'(t)\}-F'(0)\\
&=s(s\mathcal{L}\{F(t)\}-F'(0))-F'(0)\\
&=s^2\mathcal{L}\{F(t)\}-sF(0)-F'(0)
\end{align*}
Continuing we obtain

\label{eq:laplace7}
\mathcal{L}\{F^{(n)}(t)\}=s^n\mathcal{L}\{F(t)\}-s^{n-1}F(0)-s^{n-2}F'(0)-s^{n-3}F^{\prime\prime}(0)-\cdots -F^{(n-1)}(0)

Some of the transforms we found here can be obtained using \eqref{eq:laplace7} as seen in the next couple of examples below.

Example. Let $F(t)=t$. Then $F'(t)=1$ so \eqref{eq:laplace6} results in $\mathcal{L}\{1\}=s\mathcal{L}\{s\}$ and thereby
$$\mathcal{L}\{t\}=\frac{1}{s^2}$$

Example. Let $F(t)=\sin kt$. Then $F'(t)=k\cos kt$ and $F^{\prime\prime}(t)=-k^2\sin kt$. So using \eqref{eq:laplace7} for $n=2$
$$\mathcal{L}\{F^{\prime\prime}(t)\}=s^2\mathcal{L}\{F(t)\}-sF(0)-F'(0)$$
we have
$$-k^2\mathcal{L}\{\sin kt\}=s^2\mathcal{L}\{\sin kt\}-k$$
that is,
$$\mathcal{L}\{\sin kt\}=\frac{k}{s^2+k^2}$$

Example. Using \eqref{eq:laplace7} we can also prove the formula

\label{eq:laplace8}
\mathcal{L}\{t^n\}=\frac{n!}{s^{n+1}}

where $n$ is a nonnegative integer. Recall that the formula \eqref{eq:laplace8} appeared here. Let $F(t)=t^n$. Then
\begin{align*}
F(0)&=F'(0)=\cdots=F^{(n-1)}(0)=0\\
F^{(n)}(t)&=n!\\
F^{(n+1)}(t)&=0
\end{align*}
So
$$\mathcal{L}\{F^{(n+1)}(t)\}=s^{n+1}\mathcal{L}\{F(t)\}-s^nF(0)-s^{n-1}F'(0)-\cdots – F^{(n)}(0)$$
reduces to
$$0=s^{n+1}\mathcal{L}\{t^n\}-n!$$
that is,
$$\mathcal{L}\{t^n\}=\frac{n!}{s^{n+1}}$$

Example. For $k>-1$ real,
$$\mathcal{L}\{t^k\}=\int_0^\infty e^{-st}t^kdt$$
with $s>0$. Using the subsitution $x=st$ $\mathcal{L}\{t^k\}$ can be written as

\label{eq:laplace9}
\begin{aligned}
\mathcal{L}\{t^k\}&=\frac{1}{s^{k+1}}\int_0^\infty e^{-x}x^kdx\\
&=\frac{\Gamma(k+1)}{s^{k+1}}
\end{aligned}

\label{eq:gamma}
\Gamma(k+1)=\int_0^\infty e^{-x}x^kdx

is called the Gamma function or factorial function with the argument $k+1$. (There are different ways to define the Gamma function. This definition is due to Euler. For other definitions and for more details please see the reference [1] below.) $\Gamma (k+1)$ is also denoted by $k!$. In fact if $k=n$ is a positive integer,
$$k!=n!=n(n-1)(n-2)\cdots 3\cdot 2\cdot 1$$
When $k=-\frac{1}{2}$ using the substitution $u=\sqrt{x}$ we see that $\Gamma\left(\frac{1}{2}\right)$ is just the Gaussian integral
$$\Gamma\left(\frac{1}{2}\right)=2\int_0^\infty e^{-u^2}du=\sqrt{\pi}$$

References:

[1] Mathematical Methods for Physicists, George Arfken, Third Edition, Academic Press, 1985

# The Laplace Transform: Introduction

The Laplace transform is an integral transform that allows us to solve a linear differential equation by converting it to algebraic expressions such as rational functions.

The Laplace transform $\mathcal{L}\{F(t)\}$ of a function $F(t)$ is defined by

\label{eq:laplace}
\mathcal{L}\{F(t)\}=\int_0^\infty e^{-st}F(t)dt

Since the improper integral in \eqref{eq:laplace} is a function of $s$, we also write $\mathcal{L}\{F(t)\}=f(s)$.

Example. Let $F(t)=1$, $t>0$.
$$\mathcal{L}\{F(t)\}=\int_0^\infty e^{-st}dt=\frac{1}{2}$$
provided $s>0$.

Example. Let $F(t)=e^{kt}$, $t>0$ and $k$ a constant.
\begin{align*}
\mathcal{L}\{F(t)\}&=\int_0^\infty e^{-st}e^{kt}dt\\
&=\int_0^\infty e^{-(s-k)}tdt\\
&=\frac{1}{s-k}
\end{align*}
provided $s>k$.

Example.
\begin{align*}
\mathcal{L}\{t\}&=\int_0^\infty te^{-st}dt\\
&=\frac{1}{s^2}
\end{align*}
for $s>0$.

Example. Again by the definition of the Laplace transform one obtains
\begin{align*}
\mathcal{L}\{t^2\}&=\frac{2!}{s^3}\\
\mathcal{L}\{t^3\}&=\frac{3!}{s^4}
\end{align*}
by simply calculating the required improper integrals. There appears to be a pattern and one may expect the formula
$$\mathcal{L}\{t^n\}=\frac{n!}{s^{n+1}}$$
This is indeed true and we will prove this later.

Example. By the definition of the Laplace transform one obtains
\begin{align}
\label{eq:laplace2}
\mathcal{L}\{\sin kt\}&=\frac{k}{s^2+k^2}\\
\label{eq:laplace3}
\mathcal{L}\{\cos kt\}&=\frac{s}{s^2+k^2}
\end{align}

The Laplace transform is linear, namely
\begin{align*}
\mathcal{L}\{F(t)+G(t)\}&=\mathcal{L}\{F(t)\}+\mathcal{L}\{G(t)\}\\
\mathcal{L}\{cF(t)\}&=c\mathcal{L}\{F(t)\}
\end{align*}

Example. $\sinh kt=\frac{e^{kt}-e^{-kt}}{2}$ so by the linearity of the Laplace transform
\begin{align*}
\mathcal{L}\{\sinh kt\}&=\frac{1}{2}(\mathcal{L}\{e^{kt}\}-\mathcal{L}\{e^{-kt}\}\\
&=\frac{1}{2}\left(\frac{1}{s-k}-\frac{1}{s+k}\right)\\
&=\frac{k}{s^2-k^2}
\end{align*}
Hence we have

\label{eq:laplace4}
\mathcal{L}\{\sinh kt\}=\frac{k}{s^2-k^2}

Similarly we also obtain

\label{eq:laplace5}
\mathcal{L}\{\cosh kt\}=\frac{s}{s^2+k^2}

# Non-Homogeneous Second-Order Differential Equations: The Method of Variation of Parameters

Depending on $g(t)$ often it is difficult to come up with a suitable trial solution of a given non-homogeneous equation in the method of undetermined coefficient discussed here. In this note, we discuss an alternative method called the method of variation of parameters. First assume that we know the general solution
$$x_{\mathrm{hom}}(t)=c_1x_1(t)+c_2x_2(t)$$
of the homogeneous equation $$\ddot{x}+p(t)\dot{x}+q(t)x=0$$ Let

\label{eq:vp}
x(t)=u_1(t)x_1(t)+u_2(t)x_2(t)

be a solution of the non-homogeneous equation $$\ddot{x}+p(t)\dot{x}+q(t)x=g(t)$$ Differentiating \eqref{eq:vp}
$$\dot{x}(t)=\dot{u}_1x_1+u_1\dot{x}_1+\dot{u}_2x_2+u_2\dot{x}_2$$
Require that

\label{eq:vp2}
\dot{u}_1x_1+\dot{u}_2x_2=0

so that we have

\label{eq:vp3}
\dot{x}(t)=u_1\dot{x}_1+u_2\dot{x}_2

Differentiating \eqref{eq:vp3}

\label{eq:vp4}
\ddot{x}(t)=\dot{u}_1\dot{x}_1+u_1\ddot{x}_1+\dot{u}_2\dot{x}_2+u_2\ddot{x}_2

Substituting $\ddot{x}$, $\dot{x}$, $x$ in the non-homogeneous equation with the corresponding expressions in \eqref{eq:vp}, \eqref{eq:vp3} and \eqref{eq:vp4}, respectively results in the equation

\label{eq:vp5}
\dot{u}_1\dot{x}_1+\dot{u}_2\dot{x}_2=g(t)

Let
$$W(x_1,x_2)(t):=\begin{vmatrix} x_1(t) & x_2(t)\\ \dot{x}_1(t) & \dot{x}_2(t) \end{vmatrix}=x_1(t)\dot{x}_2(t)-x_2(t)\dot{x}_1(t)$$
$W(x_1,x_2)(t)$ is called the Wronskian of $x_1(t)$ and $x_2(t)$. If $x_1(t)$ and $x_2(t)$ are linearly dependent, so are the columns of $W(x_1,x_2)(t)$ hence $W(x_1,x_2)(t)=0$ for all $t$. This means that If $W(x_1,x_2)(t)\ne 0$ for some $t$, $x_1(t)$ and $x_2(t)$ are linearly independent. Also we have the following theorem holds.

Theorem. Let $x_1(t)$ and $x_2(t)$ be solutions of a homogeneous second-order linear differential equation. If $x_1(t)$ and $x_2(t)$ are linearly independent, then $W(x_1,x_2)(t)\ne 0$ for all $t$.

Since $x_1(t)$ and $x_2(t)$ are linearly independent, $W(x_1,x_2)\ne 0$ for all $t$ so by Cramer’s rule the solution of the system of linear equations \eqref{eq:vp2}, \eqref{eq:vp5} in $\dot{u}_1$ and $\dot{u}_2$ is given by

\begin{aligned}
\dot{u}_1(t)&=\frac{\begin{vmatrix}
0 & x_2\\
g(t) & \dot{x}_2
\end{vmatrix}
}{W(x_1,x_2)(t)}=-\frac{g(t)x_2(t)}{W(x_1,x_2)(t)}\\
\dot{u}_2(t)&=\frac{\begin{vmatrix}
x_1 & 0\\
\dot{x}_1 & g(t)
\end{vmatrix}
}{W(x_1,x_2)(t)}=\frac{g(t)x_1}{W(x_1,x_2)(t)}
\end{aligned}\label{eq:vp6}

Integrating \eqref{eq:vp6}, $u_1(t)$ and $u_2(t)$ are determined to be

\label{eq:vp7}
\begin{aligned}
u_1(t)&=-\int\frac{x_2(t)g(t)}{W(x_1,x_2)(t)}dt+c_1\\
u_2(t)&=\int\frac{x_1(t)g(t)}{W(x_1,x_2)(t)}dt+c_2
\end{aligned}

where $c_1$ and $c_2$ are constant.
Therefore

\label{eq:vp8}
\begin{aligned}
x(t)=c_1x_1(t)+&c_2x_2(t)+\left\{-x_1(t)\int\frac{x_2(t)g(t)}{W(x_1,x_2)(t)}dt+\right.\\
&\left.x_2(t)\int\frac{x_1(t)g(t)}{W(x_1,x_2)(t)}dt\right\}
\end{aligned}

is indeed the general solution of the non-homegeneous equation for

\label{eq:vp9}
X(t)=-x_1(t)\int\frac{x_2(t)g(t)}{W(x_1,x_2)(t)}dt+x_2(t)\int\frac{x_1(t)g(t)}{W(x_1,x_2)(t)}dt

being a particular solution of the non-homogeneous equation.

Example. Solve the non-homogeneous equation $\ddot{x}-3\dot{x}-4x=2\sin t$.

Solution. Recall that $x_1(t)=e^{-t}$, $x_2(t)=e^{4t}$. The Wronskian is
$$W(x_1,x_2)(t)=\begin{vmatrix} e^{-t} & e^{4t}\\ -e^{-t} & 4e^{4t} \end{vmatrix}=5e^{3t}$$
\begin{align*}
\int\frac{x_2(t)g(t)}{W(x_1,x_2)(t)}dt&=\int\frac{e^{4t}(2\sin t)}{5e^{3t}}dt\\
&=-\frac{1}{5}e^t\cos t+\frac{1}{5}e^t\sin t
\end{align*}
and
\begin{align*}
\int\frac{x_1(t)g(t)}{W(x_1,x_2)(t)}dt&=\int\frac{e^{-t}(2\sin t)}{5e^{3t}}dt\\
&=-\frac{2}{85}e^{-4t}\cos t-\frac{8}{85}e^{-4t}\sin t
\end{align*}
The general solution is
\begin{align*}
x(t)&=c_1e^{-t}+c_2e^{4t}\\
&-e^{-t}\left(-\frac{1}{5}e^t\cos t+\frac{1}{5}e^t\sin t\right)+e^{4t}\left(-\frac{2}{85}e^{-4t}\cos t-\frac{8}{85}e^{-4t}\sin t\right)\\
&=c_1e^{-t}+c_2e^{4t}+\frac{3}{17}\cos t-\frac{5}{17}\sin t.
\end{align*}

Example. Solve the non-homogeneous $\ddot{x}+4x=8\tan t$, $-\frac{\pi}{2}<t<\frac{\pi}{2}$

Solution. $x_1(t)=\cos(2t)$, $x_2(t)=\sin(2t)$. The Wronskian is
$$W(x_1,x_2)(t)=\begin{vmatrix} \cos(2t) & \sin(2t)\\ -2\sin(2t) & 2\cos(2t) \end{vmatrix}=2$$
\begin{align*}
\int\frac{x_2(t)g(t)}{W(x_1,x_2)(t)}dt&=\int\frac{\sin(2t)(8\tan t)}{2}dt\\
&=4t-2\sin(2t)
\end{align*}
and
\begin{align*}
\int\frac{x_1(t)g(t)}{W(x_1,x_2)(t)}dt&=\int\frac{\cos(2t)(8\tan t)}{2}dt\\
&=-2\cos(2t)+4\ln(\cos t)
\end{align*}
Thus the general solution is
$$x(t)=c_1\cos(2t)+c_2\sin(2t)-4t\cos(2t)+4\sin(2t)\ln(\cos t)$$

# Non-Homogeneous Second-Order Differential Equations: The Method of Undetermined Coefficients

Let us consider the following second-order linear differential equation

\label{eq:nhde}
\ddot{x}+p(t)\dot{x}+q(t)x=g(t)

Let $X_1(t)$ and $X_2(t)$ be two solution of \eqref{eq:nhde}. Then $X_1(t)-X_2(t)$ is a solution of the homogeneous equation

\label{eq:hde}
\ddot{x}+p(t)\dot{x}+q(t)x=0

Thus $X_1(t)-X_2(t)=c_1x_!(t)+c_2x_2(t)$ where $x_1(t)$ and $x_2(t)$ are a fundamental set of solutions of \eqref{eq:hde}. This implies that the general solution of \eqref{eq:nhde} is given by
$$x(t)=c_1x_1(t)+c_2x_2(t)+X(t)$$
where $X(t)$ is a solution of \eqref{eq:nhde}. That is, solving the non-homogeneous equation \eqref{eq:nhde} boils down to finding a solution of \eqref{eq:nhde}. There are two methods of finding a solution of \eqref{eq:nhde}:

1.  Method of Undetermined Coefficients
2. Variation of Parameters

The Method of Undetermined Coefficients

This method finds a solution by guessing a particular solution with undetermined coefficients.

Example. Solve the non-homogeneous equation $\ddot{x}-3\dot{x}-4x=3e^{2t}$.

Solution. Let $X(t)=Ae^{2t}$ be a solution of the non-homogeneous equation. Then $\dot{X}=2Ae^{2t}$ and $\ddot{X}=4Ae^{2t}$. By substitution we obtain $\ddot{X}-3\dot{X}-4X=-6Ae^{2t}$ and so $A=-\frac{1}{2}$. Hence the general solution of the non-homogeneous equation is
$$x(t)=c_1e^{-t}+c_2e^{4t}-\frac{1}{2}e^{2t}$$

Example. Solve the non-homogeneous equation $\ddot{x}-3\dot{x}-4x=2\sin t$.

Solution. Let $X(t)=A\sin t$. Then $\dot{X}(t)=A\cos t$ and $\ddot{X}=-A\sin t$. By substitution we obtain $\ddot{X}-3\dot{X}-4X=-5A\sin t -3A\cos t$. This has to be the same as $2\sin t$ which leads to the equation $(5A+2)\sin t+3A\cos t$. Since $\sin t$ and $\cos t$ are linearly independent, $5A+2=0$ and $3A=0$, a contradiction! This time we assume that $X(t)=A\sin t+B\cos t$. Then $\dot{X}(t)=A\cos t-B\sin t$, $\ddot{X}(t)=-A\sin t-B\cos t$ and
$$\ddot{X}-3\dot{X}-4X=(-5A+3B)\sin t+(-3A-5B)\cos t$$
Comparing this with $2\sin t$ we get the system of linear equations
\left\{\begin{aligned}-5A+3B&=2\\ -3A-5B&=0 \end{aligned}\right.
of which solution is $A=-\frac{5}{17}$ and $B=\frac{3}{17}$. Therefore, the general solution is
$$x(t)=c_1e^{-t}+c_2e^{4t}-\frac{5}{17}\sin t+\frac{3}{17}\cos t$$

Example. Solve the non-homogeneous equation $\ddot{x}-3\dot{x}-4x=4t^2-1$.

Solution. Let $X(t)=At^2+Bt+C$ be a solution of the non-homogeneous equation. Then $A=-1$, $B=\frac{3}{2}$ and $C=-\frac{11}{8}$. Hence the general solution is
$$x(t)=c_1e^{-t}+c_2e^{4t}-t^2+\frac{3}{2}t-\frac{11}{8}$$

Example. Solve the non-homogeneous equation $\ddot{x}-3\dot{x}-4x=-8e^t\sin 2t$.

Solution.
\begin{align*}
\dot{X}(t)&=(-2A+B)e^t\sin 2t+(A+2B)e^t\cos 2t\\
\ddot{X}(t)&=(-3A+4B)e^t\cos 2t+(-4A-3B)e^t\sin 2t
\end{align*}
and
$$\ddot{X}-3\dot{X}-4X=(-10A-2B)e^t\cos 2t+(2A-10B)e^t\cos 2t$$
Comparing this with $-8e^t\cos 2t$ we get the system of linear equations
\left\{\begin{aligned} -10A-2B&=-8\\ 2A-10B&=0 \end{aligned}\right.
of which solution is $A=\frac{10}{13}$ and $B=\frac{1}{13}$.
Hence the general solution is
$$x(t)=c_1e^{-t}+c_2e^{4t}+\frac{10}{13}e^t\cos 2t+\frac{2}{13}e^t\sin t$$