# Higher order linear differential equations

## Undetermined coefficients—Superposition approach

The method deals with the task of finding particular solution $\boldsymbol{y_p(x)}$ once we have complementary function $y_c(x)$. General restrictions and type of DE which are being solved are covered in a overview of Undetermined coefficients method. We have to examine right side $g(x)$ of DE and compare its members against members within $y_c(x)$:

1. No member in $\boldsymbol{g(x)}$ is the same as a member of $\boldsymbol{y_c(x)}$.
The particular solution then involves all members of $g(x)$ and its derivatives.
2. $\boldsymbol{g(x)}$ contains a function which is $\boldsymbol{x^k}$ times a member within $\boldsymbol{y_c(x)}$.
In such case particular solution $y_p(x)$ has to be based also on that member but multiplied by $x^{k+r}$, where value of $r$ (typically 1 or 2) has to be decided during solution.

Finally the arbitrary constants for the above members (forming $y_p(x)$) have to be found and that will be explained rather on examples.

### Example

Find the general solution of $y''+4y'+4y = 4x^2 + 6 e^x$

Short observation tells us it is linear DE with constant coefficients so it will be simple task to find $y_c(x)$ by means of auxiliary equation. It is also seen that there are members on the right side so it is nonhomogeneous DE and we have to find $y_p$ using method of undeterminated coefficients.

Let us construct auxiliary equation to find $y_c(x)$:

\begin{align} & m^2 + 4m + 4 = 0 \nonumber\\ & (m+2)(m+2) = 0 \implies m = \{-2, -2\} \nonumber\\ & \underline{y_c(x) = c_1 e^{-2x} + c_2 x e^{-2x}} \nonumber \end{align}

Note: no member observed within $g(x)$ appears in complementary function. Therefore the solution of $y_p(x)$ is simple and straight-forward. Particular solution $y_p(x)$ will consist of $x^2$, $e^x$ and its derivatives ($x$, $1$):

$$y_p(x) = \color{blue}{A x^2 + B e^x + Cx + D}$$

We have to find proper A, B, C, D to complete particular solution. The coefficients will be obvious when we use the particular solution $y_p(x)$ within DE (we know that $y_p(x)$ is a solution of DE so there is nothing wrong with that). Let us prepare its derivatives and let us feed them into DE then.

$$\begin{eqnarray} y_p'(x) &= &\color{green}{2 Ax + B e^x + C} \nonumber\\ y_p''(x)& =& \color{red}{2A + B e^x}\nonumber\\ \end{eqnarray}$$

Now substitute $y_p(x)$, $y_p'(x)$ and $y_p''(x)$ into DE

$$\begin{eqnarray} \color{red}{y''}&+& 4\color{green}{y'}&+&4\color{blue}{y} &=& 4x^2 + 6 e^x \nonumber \\ \color{red}{(2A + B e^x)} &+& 4 \color{green}{(2Ax + B e^x + C)} &+& 4 \color{blue}{(Ax^2 + B e^x + C x +D)} &=& 4x^2 + 6e^x \nonumber \end{eqnarray}$$

Now let us collect the same members of $y_p(x)$ together to find out values of constants:

\begin{align} &x^2\color{blue}{(4A)} + e^x\color{red}{(B+4B+4B)} + x(8A + 4C) + 1 (2A+4C+4D) = \color{blue}{4}x^2 + \color{red}{6}e^x \nonumber\\ &\left. \begin{aligned} &\color{blue}{4A = 4} \nonumber \\ &\color{red}{9B = 6} \nonumber \\ &8A + 4C = 0 \nonumber \\ &2A + 4C +4D = 0 \nonumber \\ \end{aligned} \right\} \hskip1em \implies \begin{aligned}&A=1\\ &B = 2/3\\ &C=-2\\ &D = 3/2\end{aligned} \end{align}

General solution $y(x) = y_c(x) + y_p(x)$:

$$\underline{\underline{y(x) = c_1 e^{-2x} + c_2 e ^{-2x} x + x^2 - 2x + \frac 3 2 + \frac 2 3 e^x}}.$$

### Example

Solve DE $y''+3y'+2y = \sin x$.

\begin{align} & m^2 + 3m + 2 = 0 \hskip1em \implies m = \{-1, -2\} \nonumber \\ & \underline{y_c(x) = c_1e^{-x} + c_2 e^{-2x}} \nonumber \end{align}

Particular solution $y_p(x)$ contains $\sin x$ and its derivatives:

$$y_p(x) = A \sin x + B \cos x$$

Now the task is to find $A$ and $B$ which satisfy DE:

$$y_p'(x) = A \cos x - B \sin x \\ y_p''(x) = -A \sin x - B \cos x$$

Let us substitute $y_p$, $y_p'$ and $y_p''$ into DE:

$$(-A \sin x - B \cos x) + 3 (A \cos x - B \sin x) + 2 (A \sin x + B \cos x) = \sin x$$

Now we collect all $\cos x$ and all $\sin x$ together to determine $A$ and $B$:

\sin x (-A -3B + 2A) + \cos x (-B +3A+2B) = \sin x \hskip1em \implies \\ \implies \left\{\begin{aligned} (-3B + A) &=1\\ (3A + B) &=0 \end{aligned} \right. \implies \begin{aligned} A &= 1/10\\ B &= -3/10 \end{aligned}

The general solution is

$$\underline{\underline{y_c(x) = c_1e^{-x} + c_2 e^{-2x} + \frac{1}{10} \sin x - \frac{3}{10} \cos x}}$$

### Example

Solve DE $y''-3y'+2y = 2x^2 + 3\color{red}{e^{2x}}$.

$$y_c(x) = c_1e^x + \color{red}{c_2e^{2x}}$$

Particular solution $y_p(x)$ has to involve all members from $g(x)$ and its derivatives. The issue is that member $e^{2x}$ is already included within $y_c(x)$ and has arbitrary constant. Therefore we have to involve also $\boldsymbol{x e^{2x}}$. If we do not include that member, $De^{2x}$ will cancel each other within the left hand side, because it is known to be one of the solutions of associated homogeneous DE. Then it would be not possible to express $D$. So now we have the case 2 from lesson ($e^{2x} = x^0 e^{2x}$).

$$y_p(x) = Ax^2 + Bx + C + D e^{2x} + E x e^{2x}$$

Simetimes the first order still does not lead to solution and higher orders might be required ($x^2$, ...).

$$\begin{eqnarray} y_p(x) &=& Ax^2 + Bx + C \color{silver}{+ D e^{2x}} + E x e^{2x} \nonumber \\ y_p'(x) &=& 2Ax + B + E e^{2x} + 2 E x e^{2x} \nonumber\\ y_p''(x) &=& 2A + 2E e^{2x} + 2 E e^{2x} + 4Ex e ^{2x}= \nonumber\\ &=& 2A +( 2E +2E)e^{2x} + 4Ex e ^{2x} \nonumber \end{eqnarray}$$

After substituting $y_p$, $y_p'$ and $y_p''$ into DE:

$$\begin{eqnarray} 2A + 4E e^{2x} + 4Exe^{2x} &-&& \nonumber \\ - 3(2Ax+B+Ee^{2x} + 2Ex e^{2x}) &+&& \nonumber \\ + 2 (Ax^2 + Bx+C+Exe^{2x})& &=& 2x^2+3e^{2x} \nonumber \end{eqnarray}$$

Now we collect all members of the same kind together:

\begin{eqnarray} e^{2x}(4E - 3E) &+&& \nonumber\\ + xe^{2x}(4E-6E +2E) &+&& \nonumber\\ + 2Ax^2 &+&& \nonumber\\ + x(-6A + 2B) &+&& \nonumber\\ + 1(2A - 3B +2C)& &=& 2x^2 + 3e^{2x} \nonumber \end{eqnarray} \implies \left\} \begin{aligned} 2A&=2 \nonumber\\ E&=3\nonumber\\ -6A+2B &= 0\nonumber\\ 2A-3B+2C&=0\nonumber \end{aligned}\right. \implies \left. \begin{aligned} A&=1 \nonumber\\ B&=3 \nonumber\\ C&=7/2 \nonumber\\ E&=3 \nonumber \end{aligned}\right.

The general solution is

$$\underline{\underline{y_c(x) = c_1e^{x} + c_2 e^{2x} + x^2 + 3x + \frac 7 2 + 3x e^{2x}}}$$

### Example

Solve $y'' + 3y' + 2y = 12 \color{red}{e^x}$.

\begin{align} &m^2 + 3m + 2 = 0 \implies m = \{-1, -2\} \nonumber\\ &\underline{y_c = c_1 e^{-x} + c_2 e ^{-2x}} \nonumber\\ & y_p = A \color{red}{e^x} \nonumber\\ & y_p' = A \color{red}{e^x} \nonumber\\ & y_p'' = A \color{red}{e^x} \nonumber\\ &Ae^x + 3 A e^x + 2Ae^x = 12 e^x \nonumber\\ &e^x(6A) = 12e^x \nonumber\\ &6A = 12 \implies A = 2 \nonumber\\ &\underline{y_p = 2e^x} \nonumber\\ &\underline{\underline{y = y_c+y_p = c_1 e^{-x} + c_2 e ^{-2x} + 2 e^x}} \end{align}

### Example

Solve $y'' + y' = x + \sin 2x$.

$$m^2 + m = 0 \implies m =\{0, -1\}\\ y_c = c_1 e^{-x} + c_2 e^0\\ \underline{y_c = c_1 e^{-x} + \color{red}{c_2}}\\$$

The constant member ($B$) has to be avoided within $y_p$ because it is used by $y_c$ with arbitrary constant. If we use members with $A$, $C$ and $D$, we are not able to cover $x$ on the right side (there will be no member $x$ on the left side once we substitute $y_p$ into DE). That is the reason, why member $Ex^2$ has been introduced as well.

Member $x$ from ($g(x)$) is $x^k$ times member $1$ from $y_c$. We have to include also $x^2$ into particular solution (see case 2 from the lesson).

$$\begin{eqnarray} y_p &=& Ax & + \color{red}{B} & + C \sin 2x &+ D \cos 2x &\color{blue}{+ Ex^2} \nonumber\\ y_p' &=& A & & + 2C \cos 2x &- 2D \sin 2x &\color{blue}{+ 2Ex} \nonumber\\ y_p'' &=& & & - 4C \sin 2x &- 4D \cos 2x &\color{blue}{+ 2E} \nonumber \end{eqnarray}$$

Substitute $y_p'$ and $y_p''$ into DE:

$$\begin{eqnarray} (-4C\sin 2x - 4D \cos 2x +2E)&+ & \nonumber\\ +(A + 2C \cos 2x -2D \sin 2x +2Ex)& &=& x + \sin 2x \nonumber\\ x(2E) + 1(A+2E) + \cos 2x (-4D+2C) + \sin 2x (-4C-2D)&& =& x + \sin 2x \end{eqnarray}$$

After solving $2E=1 \implies E = 1/2$ and so on, the solution is written as

$$\underline{\underline{y=c_1 e^{-x} + c_2 + \frac 1 2 x^2 -x -\frac 1 5 \sin 2x - \frac 1 {10} \cos 2x}}.$$

### Example

Solve $y'' -3y'+2y = x e^{-x}$.

Solving associated homogeneous DE gives

$$y_c = c_1 e^x+c_2 e^{2x}.$$

Building the particular solution from members of $g(x)$ and its derivativess:

$$\begin{eqnarray} y_p &=& \color{green}{Axe^{-x} + B e^{-x}} \nonumber\\ y'_p &=& A(1\cdot e^{-x} - xe^{-x}) - Be^{-x} = \nonumber\\ &=& Ae^{-x} - Axe^{-x} - B e^{-x} = \nonumber\\ &=& \color{blue}{e^{-x}(A-B) xe^{-x}(-A)} \nonumber\\ y_p'' &=& -Ae^{-x} - A(1\cdot e^{-x} -xe^{-x}) + Be^{-x} = \nonumber\\ &=& -Ae^{-x} - Ae^{-x} + A x e^{-x} + B e^{-x} = \nonumber\\ &=& \color{red}{e^{-x}(-2A+B) +xe^{-x}(A)}\nonumber \end{eqnarray}$$

Solving constant $A$ and $B$ for such values which satisfies DE:

$$\begin{eqnarray} \color{red}{e^{-x}(-2A + B) + xe^{-x}(A)}- &&\nonumber \\ -3(\color{blue}{e^{-x}(A-B) + xe^{-x}(-A)}) +&& \nonumber \\ +2(\color{green}{e^{-x}(B) + xe^{-x}(A)})& =& xe^{-x} \nonumber \\ \nonumber \\ e^{-x}(-2A+B-3A+3B+2B) + xe^{-x}(A+3A+2A) &=& xe^{-x} \nonumber \\ e^{-x}(-5A + 6B) + xe^{-x}(6A) &= &xe^{-x} \nonumber\\ \nonumber \\ -5A + 6B &= &0 \nonumber\\ 6A &=& 1 \nonumber \end{eqnarray}$$

After solving $A$ and $B$ we get the solution

$$\underline{\underline{y = c_1e^x + c_2e^{2x} + \frac 1 6 xe^{-x} + \frac 5 {36}e^{-x}}}$$

### Example

Solve $y'' +y' = x^2 + 2x$.

Solving associated homogeneous DE gives solution

$$y_c=\color{red}{c_1} + c_2e^{-x}.$$

Let us prepare $y_p$, $y_p'$ and $y_p''$:

$$\begin{eqnarray} y_p &=& Ax^2 + Bx + \color{red}{C} + \color{blue}{Dx^3} \nonumber \\ y_p' &=& 2Ax + B + \color{blue}{3Dx^2} \nonumber \\ y_p'' &=& 2A + \color{blue}{6Dx} \nonumber \\ \end{eqnarray}$$

Let us discuss those 3 above lines. The member $C$ is already in $y_c$ with arbitrary constant $c_1$, so it makes no sense to find value of $B$. If we feed $y_p'$ and $y_p''$ into DE, we will observe that we can not pair member $x^2$ from the left to the right side. So we have to use also member $x^3$. Members $x$, $x^2$ are $x^k$ times member of $y_c$.

\begin{eqnarray} (2A+6Dx) + (2Ax+B+3Dx^2) &=& x^2 + 2x \nonumber \\ 1(2A+B) + x(6D+2A) + x^2(3D) &=& x^2 + 2x \nonumber \\ \end{eqnarray} \nonumber \\ \left. \begin{aligned} 2A+B &= 0 \nonumber \\ 6D+2A &= 2 \nonumber \\ 3D &= 1 \end{aligned} \right\} \implies \begin{aligned} A &= 0 \nonumber \\ B &= 0 \nonumber \\ D &= 1/3 \nonumber \\ \end{aligned}

And general solution is

$$\underline{\underline{y = c_1 + c_2e^{-x} + \frac 1 3 x^3}}.$$

List of chapters