Variation of Parameter

Exercise 2.5
1. Solve the following differential equation using variation of parameter.

(a) $\ y^{\prime\prime} + 2y^{\prime} + y = \frac{e^{-x}}{x}$
(b) $\ y^{\prime\prime} + 4y = \tan{2x}$
(c) $\ y^{\prime\prime} - 4y^{\prime} + 4y = \frac{e^{2x}}{x}$
(d) $\ y^{\prime\prime} - 3y^{\prime} + 2y = \frac{1}{1+e^{-x}}$
(e) $\ y^{\prime\prime\prime} + y^{\prime} = \tan{x}$

2.
Show that using variation of parameter the general solution of $y^{\prime\prime} + y = f(x)$ is given by

$\displaystyle y = c_{1}\cos{x} + c_{2}\sin{x} + \int_{a}^{x}f(t)\sin{(x-t)}dt $

Answer
1. (a) Given auxiliary equation $y^{\prime\prime} + 2y^{\prime} + y = 0$. The characteristic equation is $m^2 + 2m + 1 = (m + 1)^2 = 0$ and characteristic roots are $m = -1, -1$. Thus the complementary function is

$\displaystyle y_{c} = (c_{1} + c_{2}x)e^{-x} $

We next find the particular solution using the variation of parameter. Set

$\displaystyle y_{p} = u_{1}e^{-x} + u_{2}xe^{-x} $

Then we have

$\displaystyle \left\{\begin{array}{ll}
u_{1}^{\prime}e^{-x} + u_{2}^{\prime}xe^...
...x}) + u_{2}^{\prime}(e^{-x} - xe^{-x}) & = \frac{e^{-x}}{x}
\end{array}\right. $

Solve this using Cramer's rule. Then we have
$\displaystyle u_{1}^{\prime}$ $\displaystyle =$ $\displaystyle \frac{\left\vert\begin{array}{cc}
0 & xe^{-x}\\
\frac{e^{-x}}{x}...
...-x} & e^{-x} - xe^{-x}
\end{array}\right\vert } = \frac{-e^{-2x}}{e^{-2x}} = -1$  
$\displaystyle u_{2}^{\prime}$ $\displaystyle =$ $\displaystyle \frac{\left\vert\begin{array}{cc}
e^{-x} & 0\\
-e^{-x} & \frac{e...
...{x}
\end{array}\right\vert }{e^{-2x}} = \frac{e^{-2x}/x}{e^{-2x}} = \frac{1}{x}$  

Thus,

$\displaystyle u_{1} = -x, \ u_{2} = \log{\vert x\vert} \ $   (ignore constant)$\displaystyle $

Thus,

$\displaystyle y_{p} = -xe^{-x} - x\log{\vert x\vert}e^{-x}. $

Note that $xe^{-x}$ is already used in $y_c$. So, we omit from $y_p$. Then the general solution is

$\displaystyle y = y_{c} + y_{p} = (c_{1} + c_{2}x)e^{-x} - x\log{\vert x\vert}e^{-x} $

(b) Given auxiliary equation $y^{\prime\prime} + 4y = 0$. Then the characteristic equation is $m^2 + 4 = 0$ and the characteristic roots are $m = \pm 2i $. Then the complementary function is given by

$\displaystyle y_{c} = c_{1}\cos{2x} + c_{2}\sin{2x} $

Next we find the particular solution using the variation of parameter. Let

$\displaystyle y_{p} = u_{1}\cos{2x} + u_{2}\sin{2x} $

Then we have

$\displaystyle \left\{\begin{array}{ll}
u_{1}^{\prime}\cos{2x} + u_{2}^{\prime}\...
...prime}(-2\sin{2x}) + u_{2}^{\prime}(2\cos{2x}) & = \tan{2x}
\end{array}\right. $

Now solve these equations using Cramer's rule.
$\displaystyle u_{1}^{\prime}$ $\displaystyle =$ $\displaystyle \frac{\left\vert\begin{array}{cc}
0 & \sin{2x}\\
\tan{2x} & 2\co...
...tan{2x}\sin{2x}}{2(\cos^{2}{2x} + \sin^{2}{2x})} = - \frac{\tan{2x}\sin{2x}}{2}$  
$\displaystyle u_{2}^{\prime}$ $\displaystyle =$ $\displaystyle \frac{\left\vert\begin{array}{cc}
\cos{2x} & 0\\
-2\sin{2x} & \tan{2x}
\end{array}\right\vert }{2} = \frac{\sin{2x}}{2}$  

Now find $u_{1},u_{2}$.
$\displaystyle u_{1}$ $\displaystyle =$ $\displaystyle -\frac{1}{2}\int \frac{\sin^{2}{2x}}{\cos{2x}} = \frac{1}{2}\int \frac{\cos^{2}{2x} - 1}{\cos{2x}} dx$  
  $\displaystyle =$ $\displaystyle \frac{1}{2}\int (\cos{2x} - \sec{2x})dx$  
  $\displaystyle =$ $\displaystyle -\frac{1}{4}(\sin{2x} + \log{\vert\sec{2x} + \tan{2x}\vert})$  
$\displaystyle u_{2}$ $\displaystyle =$ $\displaystyle \int \frac{\sin{2x}}{2}dx = - \frac{\cos{2x}}{4}$  

Thus,

$\displaystyle y_{p} = -\frac{1}{4}\cos{2x}( \sin{2x} + \log{\vert\sec{2x} + \tan{2x}\vert}) - \frac{1}{4}\cos{2x} \sin{2x} . $

Therefore, the general solution is
$\displaystyle y = y_{c} + y_{p}$ $\displaystyle =$ $\displaystyle c_{1}\cos{2x} + c_{2}\sin{2x}$  
  $\displaystyle -$ $\displaystyle \frac{1}{4}\cos{2x} \log{\vert\sec{2x} + \tan{2x}\vert} - \frac{1}{2}\sin{2x}\cos{2x}$  

(c) Given auxiliary equation $y^{\prime\prime} - 4y^{\prime} + 4y = 0$. The characteristic equation is $m^2 - 4m + 4 = (m -2)^2 = 0$ and the characteristic roots are $m = 2, 2$. Thus, the complementary solution is give by

$\displaystyle y_{c} = (c_{1} + c_{2}x)e^{2x} $

Next we find the particular solution. Using the variation of parameter, we set

$\displaystyle y_{p} = u_{1}e^{2x} + u_{2}xe^{2x} $

Then we have

$\displaystyle \left\{\begin{array}{ll}
u_{1}^{\prime}e^{2x} + u_{2}^{\prime}xe^...
...}) + u_{2}^{\prime}(e^{2x} + 2xe^{2x}) & = \frac{e^{2x}}{x}
\end{array}\right. $

Solve this equation using Cramer's rule. Then
$\displaystyle u_{1}^{\prime}$ $\displaystyle =$ $\displaystyle \frac{\left\vert\begin{array}{cc}
0 & xe^{2x}\\
\frac{e^{2x}}{x}...
...x} & e^{2x} + 2xe^{2x}
\end{array}\right\vert } = - \frac{e^{4x}}{e^{4x}} = - 1$  
$\displaystyle u_{2}^{\prime}$ $\displaystyle =$ $\displaystyle \frac{\left\vert\begin{array}{cc}
e^{2x} & 0\\
2e^{2x} & \frac{e...
...{2x} + 2xe^{2x}
\end{array}\right\vert} = \frac{e^{4x}/x}{e^{4x}} = \frac{1}{x}$  

Thus, we have $u_{1} = -x, u_{2} = \log{\vert x\vert}$ and

$\displaystyle y_{p} = - xe^{2x} + xe^{2x}\log{\vert x\vert}. $

Note that $- xe^{2x}$ is already used in the complementary function. So, the general solution is

$\displaystyle y = y_{c} + y_{p} = (c_{1} + c_{2}x)e^{2x} + xe^{2x}\log{\vert x\vert} $

(d) Given auxiliary equation $y^{\prime\prime} - 3y^{\prime} + 2y = 0$, we ahve the characteristic equation which is $m^2 - 3m + 2 = (m -1)(m-2) = 0$. Then the characteristic roots are $m = 1, \ 2 $. Thus the complementary function is give by

$\displaystyle y_{c} = c_{1}e^{x} + c_{2}e^{2x} $

We next find the particular solution. By the variation of parameter, we set

$\displaystyle y_{p} = u_{1}e^{x} + u_{2}e^{2x} $

Then we have

$\displaystyle \left\{\begin{array}{ll}
u_{1}^{\prime}e^{x} + u_{2}^{\prime}e^{2...
...}(e^{x}) + u_{2}^{\prime}(2e^{2x}) & = \frac{1}{1 + e^{-x}}
\end{array}\right. $

Solve this equatios by Cramer's rule. Then
$\displaystyle u_{1}^{\prime}$ $\displaystyle =$ $\displaystyle \frac{\left\vert\begin{array}{cc}
0 & e^{2x}\\
\frac{1}{1 + e^{-...
...ght\vert } = - \frac{e^{2x}/(1 + e^{-x})}{e^{3x}} = - \frac{e^{-x}}{1 + e^{-x}}$  
$\displaystyle u_{2}^{\prime}$ $\displaystyle =$ $\displaystyle \frac{\left\vert\begin{array}{cc}
e^{x} & 0\\
e^{x} & \frac{1}{1...
...y}\right\vert} = \frac{e^{x}/(1 + e^{-x})}{e^{3x}} = \frac{e^{-2x}}{1 + e^{-x}}$  

We find $u_{1},u_{2}$. Then

$\displaystyle u_{1} = -\int \frac{e^{-x}}{1 + e^{-x}} dx = \log{(1 + e^{-x})} $


$\displaystyle u_{2}$ $\displaystyle =$ $\displaystyle \int \frac{e^{-2x}}{1 + e^{-x}} dx = \int (e^{-x} - \frac{e^{-x}}{1 + e^{-x}})dx$  
  $\displaystyle =$ $\displaystyle - e^{-x} + \log{(1 + e^{-x})}$  

Thus

$\displaystyle y_{p} = e^{x} \log{(1 + e^{-x})} + e^{2x}(- e^{-x} + \log{(1 + e^{-x}})). $

Therefore, the general solution is

$\displaystyle y = y_{c} + y_{p} = c_{1}e^{x} + c_{2}e^{2x} + (e^{x} + e^{2x})\log{(1 + e^{-x})} $

(e) The auxiliary equation is $y^{\prime\prime\prime} + y^{\prime} = 0$. Then the characteristic equation is $m^3 + m = m(m^2 + 1) = 0$ and characteristic roots are $m = 0, \pm i$. Thus, the complementary function is given by

$\displaystyle y_{c} = c_{1} + c_{2}\cos{x} + c_{3}\sin{x} $

We next find the particular solution. Using the variation of parameter, we set

$\displaystyle y_{p} = u_{1} + u_{2}\cos{x} + u_{3}\sin{x} $

Then we have

$\displaystyle \left\{\begin{array}{ll}
u_{1}^{\prime} + u_{2}^{\prime}\cos{x} +...
...}^{\prime}(-\cos{x}) + u_{3}^{\prime}(-\sin{x}) & = \tan{x}
\end{array}\right. $

Solve these equations using Cramer's rule. Then
$\displaystyle u_{1}^{\prime}$ $\displaystyle =$ $\displaystyle \frac{\left\vert\begin{array}{ccc}
0 & \cos{x} & \sin{x}\\
0 & -...
...in{x} & \cos{x}\\
0 & - \cos{x} & - \sin{x}
\end{array}\right\vert } = \tan{x}$  
$\displaystyle u_{2}^{\prime}$ $\displaystyle =$ $\displaystyle \frac{\left\vert\begin{array}{ccc}
1 & 0 & \sin{x}\\
0 & 0 & \co...
...& - \cos{x} & - \sin{x}
\end{array}\right\vert } = - \tan{x}\cos{x} = - \sin{x}$  
$\displaystyle u_{3}^{\prime}$ $\displaystyle =$ $\displaystyle \frac{\left\vert\begin{array}{ccc}
1 & \cos{x} & 0\\
0 & - \sin{...
...cos{x}\\
0 & - \cos{x} & - \sin{x}
\end{array}\right\vert } = - \sin{x}\tan{x}$  

From this, we find $u_{1} , u_{2}, u_{3}$. Then

$\displaystyle u_{1} = \int \tan{x} dx = \int \frac{\sin{x}}{\cos{x}}dx = - \log{\vert\cos{x}\vert} = \log{\vert\sec{x}\vert} $

$\displaystyle u_{2} = - \int \sin{x}dx = \cos{x} $


$\displaystyle u_{3}$ $\displaystyle =$ $\displaystyle - \int \sin{x}\tan{x}dx = - \int \frac{\sin^{2}{x}}{\cos{x}} dx = \int \frac{\cos^{2}{x} - 1}{\cos{x}}dx$  
  $\displaystyle =$ $\displaystyle \int (\cos{x} - \sec{x})dx = \sin{x} - \log{\vert\sec{x} + \tan{x}\vert}$  

Thus,
$\displaystyle y_{p}$ $\displaystyle =$ $\displaystyle \log{\vert\sec{x}\vert} + \cos^{2}{x} + \sin{x}(\sin{x} - \log{\vert\sec{x} + \tan{x}\vert})$  
  $\displaystyle =$ $\displaystyle \log{\vert\sec{x}\vert} - \sin{x} \log{\vert\sec{x} + \tan{x}\vert} + 1$  

Therefore, the general solution is given by

$\displaystyle y = y_{c} + y_{p} = c_{1} + c_{2}\cos{x} + c_{3}\sin{x} + \log{\vert\sec{x}\vert} - \sin{x} \log{\vert\sec{x} + \tan{x}\vert} $

2. The auxiliary equation is $y^{\prime\prime} + y = 0$. Then the characterisitc equation is $m^2 + 1 = 0$ and characteristic roots are $m = \pm i$. Thus the complementary function is given by

$\displaystyle y_{c} = c_{1}\cos{x} + c_{2}\sin{x} $

We next find the particular solution. Using the variation of parameter, we set

$\displaystyle y_{p} = u_{1}\cos{x} + u_{2}\sin{x} $

Then we have

$\displaystyle \left\{\begin{array}{ll}
u_{1}^{\prime}\cos{x} + u_{2}^{\prime}\s...
...u_{1}^{\prime}(-\sin{x}) + u_{2}^{\prime}(\cos{x}) & = f(x)
\end{array}\right. $

Solve this using Cramer's rule. Then
$\displaystyle u_{1}^{\prime}$ $\displaystyle =$ $\displaystyle \frac{\left\vert\begin{array}{cc}
0 & \sin{x}\\
f(x) & \cos{x}
\...
...os{x} & \sin{x}\\
- \sin{x} & \cos{x}
\end{array}\right\vert } = - f(x)\sin{x}$  
$\displaystyle u_{2}^{\prime}$ $\displaystyle =$ $\displaystyle \frac{\left\vert\begin{array}{cc}
\cos{x} & 0\\
- \sin{x} & f(x)...
...\cos{x} & \sin{x}\\
- \sin{x} & \cos{x}
\end{array}\right\vert } = f(x)\cos{x}$  

Then we find $u_{1},u_{2}$.

$\displaystyle u_{1} = - \int f(x)\sin{x} dx = - \int_{a}^{x}f(t)\sin{t}dt $

$\displaystyle u_{2} = \int f(x)\cos{x}dx = \int_{a}^{x}f(t)\cos(t)dt $

Thus,
$\displaystyle y_{p}$ $\displaystyle =$ $\displaystyle - \int_{a}^{x}f(t)\sin{t}dt \cos{x} + \int_{a}^{x}f(t)\cos(t)dt \sin{x}$  
  $\displaystyle =$ $\displaystyle - \int_{a}^{x}f(t)\sin{t} \cos{x} dt + \int_{a}^{x}f(t)\cos(t) \sin{x} dt$  
  $\displaystyle =$ $\displaystyle \int_{a}^{x} f(t)(\sin{x}\cos{t} - \cos{x}\sin{t})dt = \int_{a}^{x} f(t)(\sin{x}\cos{t} - \cos{x}\sin{t})dt$  
  $\displaystyle =$ $\displaystyle \int_{a}^{x} f(t)\sin{(x - t)}dt$  

Therefore, the general solution is given by

$\displaystyle y = y_{c} + y_{p} = c_{1}\cos{x} + c_{2}\sin{x} + \int_{a}^{x} f(t)\sin{(x - t)}dt $