# Higher order linear differential equations

## Variation of parameters

The previous methods (method of undetermined coefficients to find particular solution $y_p$) have two weaknesses:

• the kind of members on the right side ($g(x)$) is restricted
• the DE must have constant coefficients.

Note: regarding the first issue, in some cases of DE with non-constant coefficients, we are still able to use method of undetermined coefficients.

Assuming that we are able to find solution $y_c(x)$ of associated homogeneous DE (i.e. to find complementary function), this method is able to find particular solution $\boldsymbol{y_p}$ of linear DE with non-constant coefficients with no restrictions on the right side.

The method will be shown below for differential equation of 2nd order but can be used for higher order DE.

$$\begin{equation}a_2(x)y'' + a_1(x)y' + a_0(x)y = g(x)\end{equation} \nonumber$$

We assume that there are no troubles with finding the two linearly independent solutions $\boldsymbol{y_1(x)}$ and $\boldsymbol{y_2(x)}$ of DE. With them we form equation for $\boldsymbol{y_p(x)}$

$$\begin{eqnarray} \color{red}{y_p(x) = u_1(x)y_1(x) + u_2(x)y_2(x)}. \label{ref0} \end{eqnarray}$$

The above particular solution is expressed in terms of solutions $y_1(x)$ and $y_2(x)$. Functions $u_1(x)$ and $u_2(x)$ are unknown and have to be determined.

The derivatives of $y_p(x)$ are

$$\begin{eqnarray} y_p'(x) & = & u_1 y_1' + u_1' y_1 + u_2 y_2' + u_2' y_2 = \nonumber \\ & = & (u_1 y'_1 + u_2 y'_2) + (u'_1 y_1 + u'_2 y_2)\nonumber \\[1mm] y''_p(x) & = & (u_1 y''_1 + u_2 y''_2) + (u'_1 y'_1 + u'_2 y'_2) + (u'_1 y_1 + u'_2 y_2)' \nonumber \end{eqnarray}$$

Substituting solution $y_p(x)$ and its derivatives $y_p'(x)$ and $y_p''(x)$ into DE

$$\begin{eqnarray} a_2(u_1 y_1'' + u_2 y_2'') + a_2(u_1' y_1' + u_2' y_2') + a_2(u_1' y_1 + u_2' y_2)' &&+ && \nonumber\\ + a_1(u_1 y_1' + u_2 y_2') + a_1(u_1' y_1 + u_2' y_2) + a_0(u_1 y_1+ u_2 y_2) && &&= g(x) \nonumber \end{eqnarray}$$

This equation can be written as

$$\begin{eqnarray} u_1(\color{silver}{a_2 y_1'' + a_1 y_1' + a_0 y_1}) + u_2(\color{silver}{a_2 y_2'' + a_1 y_2' + a_0 y_2}) &&+ && \nonumber\\ + a_2(u_1' y_1' + u_2' y_2') + a_2(\color{silver}{u_1' y_1 + u_2' y_2})' + a_1(\color{silver}{u_1' y_1 + u_2' y_2}) && &&= g(x) \nonumber \end{eqnarray}$$

Since $y_1(x)$ and $y_2(x)$ are solutions of homogeneous DE, the first two parantheses equal zero. Then, if we request that

$$\begin{equation}u_1' y_1 + u_2' y_2 = 0,\end{equation} \label{ref1}$$ the remaining members have to hold equality $$\begin{equation}u_1' y_1' + u_2' y_2' = \frac{g(x)}{a_2} \end{equation} \nonumber$$

or

$$\begin{equation} u_1' y_1' + u_2' y_2' = f(x) \end{equation} \label{ref2}$$

for DE in the standard form of

$$\begin{equation}y''+P(x)y'+Q(x)y = f(x).\end{equation}$$

The pair of equations $(\ref{ref1})$ and $(\ref{ref2})$ can be solved for $u_1'$ and $u_2'$ using common algebraic methods. The other solution is by Cramer's law:

$$\begin{equation} \color{red}{u_1' = \frac{W_1}{W} = -\frac{y_2 f(x)}{W}, \hskip1em u_2' = \frac{W_2}{W} = \frac{y_1 f(x)}{W}}, \label{ref4} \end{equation}$$

where $$\begin{equation} W = \begin{vmatrix} y_1 & y_2\\ y_1' & y_2' \end{vmatrix}, \hskip1em W_1 = \begin{vmatrix} 0 & y_2\\ f(x) & y_2' \end{vmatrix}, \hskip1em W_2 = \begin{vmatrix} y_1 & 0 \\ y_1' & f(x) \end{vmatrix}. \end{equation}$$

The above determinant $W$ is Wronskian and $W_1$ and $W_2$ are derived from $W$ using Cramer's law. In our case we have two equations $(\ref{ref1})$ and $(\ref{ref2})$ and determinant with two columns for 2nd order DE. But the method can be generalized to linear $n$th order differential equations.

### Example

Solve DE $ty'' - (t+1)y' +y = t^2$ with provided solutions $y_1(t) = e^t$ and $y_2(t) = t + 1$.

The DE does not have constant coefficients. Such DE is not easily solved and we are being provided solutions of associated homogeneous DE. The particular solution $y_p(x)$ will be computed by means of method variation of parameters from $y_c(x)$.

First let us divide DE by $t$ to bring DE into standard form. Because the method expects that we work with DE in standard form of $y''+P(t)y'+Q(t)y=f(t)$.

$$\begin{eqnarray}y''+\frac{t+1}{t}y'+ \frac 1 t y &=& t \nonumber\\ y_1(t) &=& e^t \hskip1em &y_1'(t) &=& e^t \nonumber\\ y_2(t) &=& t + 1\hskip1em &y_2'(t) &=& 1 \nonumber \end{eqnarray}$$

Now we have to form Wronskian $W$ and $W_1$, $W_2$ as the method expects:

$$\begin{eqnarray} W &=& \begin{vmatrix} y_1 & y_2\\ y_1' & y_2' \end{vmatrix} = \begin{vmatrix} e^t & t + 1\\ e^t &1 \end{vmatrix} = e^t - e^t(t+1) = -e^t\cdot t \nonumber\\ u_1'(t) &=& \frac{W_1}{W} = -\frac{y_2 f(t)}{W} = -\frac{(t+1)t}{-e^t\cdot t}=\frac{t+1}{e^t} \nonumber\\ u_1(t) &=& (-t-1)e^{-t} - e^{-t} \nonumber\\ u_2'(t) &=& \frac{W_2}{W} = \frac{y_1 f(t)}{W} = \frac{e^t \cdot t}{W} = \frac{e^t \cdot t}{-e^t \cdot t} = -1 \nonumber\\ u_2(t) &=& -t \nonumber\\ y_p(t) &=& u_1 y_1 + u_2 y_2 = [(-t-1)e^{-t} - e^{-t}]e^t + (-t)(t+1)= -t^2 -2t -2 \nonumber\\ \end{eqnarray}$$

We were given $y_c(t)$, we have found $y_p(t)$, so we can collect the general solution:

$$\underline{\underline{y(t) = c_1 e^t + c_2(t+1) -t^2 -2t -2}}\\$$

### Example

Find the general solution of $y'' + y = \tan x$, $-\frac{\pi}{2} < x < \frac{\pi}{2}$.

The DE can not be solved by the method of undetermined coefficients, because on the right side is a member with infinite number of linearly independent derivatives.

Solving associated homogeneous DE brings complementary function

$$y_c = c_1 \cos x + c_2 \sin x.$$

That means for the purpose of $y_p(x) = u_1(x)y_1(x) + u_2(x)y_2(x)$ we assign the two solution as

$$y_1 = \cos x,\\ y_2 = \sin x.$$

Using the equation $(\ref{ref4})$ is a convenient way to get $u_1$ and $u_2$:

$$\begin{eqnarray} u_1'(x) &&=&& -\frac{y_2 f(x)}{W} = - \frac{\sin x \tan x}{\cos x \cos x - \sin x(-\sin x)} = \nonumber - \frac{\sin x \tan x}{\cos^2x + \sin^2 x} = \frac{-\sin x \tan x}{1} = \\ \nonumber &&=&& - \frac{\sin^2 x}{\cos x} \nonumber \\[3mm] u_2'(x) &&=&& \frac{y_1 f(x)}{W} = \frac{\cos x \tan x}{1} = \sin x \nonumber \end{eqnarray}$$

After integrating $u_1'$ and $u_2'$:

$$u_1(x) = -\log (\sec x + \tan x) + \sin x, \hskip1em u_2(x) = -\cos x.$$

Since we have $u_1(x)$ and $u_2(x)$, we are able to build $y_p(x)$ from $(\ref{ref0})$:

$$\begin{eqnarray} y_p(x) &&=&& u_1(x)y_1(x) + u_2(x)y_2(x) \nonumber \\ y_p(x) &&=&& (-\log (\sec x + \tan x) + \sin x) \cos x + (-\cos x) \sin x \nonumber \\ y_p(x) &&=&& -\log (\sec x + \tan x) \cos x, \hskip1em -\frac{\pi}{2} < x < \frac{\pi}{2} \nonumber \end{eqnarray}$$

Combining $y_c$ with $y_p$ we obtain the general solution of DE:

$$\underline{\underline{y = c_1 \cos x + c_2 \sin x - \log (\sec x + \tan x) \cos x}}, \hskip1em -\frac{\pi}{2} < x < \frac{\pi}{2}.$$

### Example

Homogeneous differential equations $x^2y'' + xy' - y = 0$ has two solutions $y_1 = x$ and $y_2 = x^{-1}$. Find the general solution of $x^2y'' + xy' - y = x$,  $x \neq 0$.

Using the equation $(\ref{ref4})$ is a convenient way to get $u_1$ and $u_2$:

$$\begin{eqnarray} u_1' &&=&& -\frac{y_2 f(x)}{W} = - \frac{x^{-1} x/x^2}{W} = -\frac{x^{-2}}{(x (-x^{-2}) - (x^{-1}\cdot 1)} = -\frac{x^{-2}}{-2x^{-1}} = \nonumber \\ &&=&& -\frac{1}{2x} \nonumber \\[3mm] u_2' &&=&& \frac{y_1 f(x)}{W} = \frac{x \cdot x/x^2}{-2x^{-1}} = \frac{1}{-2x^{-1}} = -\frac{1}{2}x \nonumber \end{eqnarray}$$

After integrating $u_1'$ and $u_2'$:

$$u_1(x) = \frac{1}{2}\log x, \hskip1em u_2(x) = -\frac{x^2}{4}.$$

Since we have $u_1(x)$ and $u_2(x)$ we are able to build $y_p(x)$ from $(\ref{ref0})$:

$$\begin{eqnarray} y_p(x) &&=&& u_1(x)y_1(x) + u_2(x)y_2(x) \nonumber \\ y_p(x) &&=&& \frac{x}{2}\log x - \frac{x}{4} \nonumber \\ \end{eqnarray}$$

Combining $y_c$ with $y_p$ we obtain the general solution of DE:

$$\underline{\underline{y = c_1 x + c_2 x^{-1} + \frac{x}{2}\log x - \frac{x}{4}}}.$$

List of chapters