Let us consider the following second-order linear differential equation

\begin{equation}

\label{eq:nhde}

\ddot{x}+p(t)\dot{x}+q(t)x=g(t)

\end{equation}

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

\begin{equation}

\label{eq:hde}

\ddot{x}+p(t)\dot{x}+q(t)x=0

\end{equation}

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}:

- Method of Undetermined Coefficients
- 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$$

Pingback: Non-Homogeneous Second-Order Differential Equations: Variation of Parameters | MathPhys Archive