Calculus &
Linear Algebra II

Chapter 6

6 Variation of parameters

By the end of this section, you should be able to answer the following questions:

  • Under what conditions does the method work?
  • What functions need to be determined first before using the method?
  • How do you use the variation of parameters method to solve a non-homogeneous linear second order ODE?



6 Variation of parameters

The method of undetermined coeffcients is very easy to apply, but only works for constant coeffcients with certain $r(x).$ For other cases, the variation of parameters works well. The process is the following:






6 Variation of parameters

The method of undetermined coeffcients is very easy to apply, but only works for constant coeffcients with certain $r(x).$ For other cases, the variation of parameters works well. The process is the following:

  • Solve $y'' + p(x)y' + q(x)y = 0$, obtain a fundamental set of solutions $y_1$, $y_2$ and calculate the Wronskian, $W(y_1, y_2)(x) \equiv W.$
  • Set $y_P = u(x)y_1(x)+v(x)y_2(x)$ and substitute into the ODE. We also impose the condition $u'y_1 + v'y_2 = 0.$ We have the freedom to impose this extra arbitrary condition because we have two functions ($u$ and $v$) and only one equation they need to satisfy arising from the ODE.
  • We obtain \[ u(x) = - \int \frac{y_2r}{W}~dx, \qquad v(x) = \int \frac{y_1 r}{W}~dx. \]

6 Variation of parameters
  • Solve $y'' + p(x)y' + q(x)y = 0$, obtain a fundamental set of solutions $y_1$, $y_2$ and calculate the Wronskian, $W(y_1, y_2)(x) \equiv W.$
  • Set $y_P = u(x)y_1(x)+v(x)y_2(x)$ and substitute into the ODE. We also impose the condition $u'y_1 + v'y_2 = 0.$ We have the freedom to impose this extra arbitrary condition because we have two functions ($u$ and $v$) and only one equation they need to satisfy arising from the ODE.
  • We obtain \[ u(x) = - \int \frac{y_2r}{W}~dx, \qquad v(x) = \int \frac{y_1 r}{W}~dx. \]

This approach is a variant of the method of Reduction of Order, which prescribes that we take a solution, say $y_1$ of the associated homogeneous equation and seek a particular solution of the form $y_p = U(x)y_1.$


6.1 Derive the formulae for $u(x)$ and $v(x)$ in the variation of parameters

Consider the non-homogeneous ODE $$y'' + p(x) y' + q(x) y = r(x).\qquad(1)$$ Suppose that we have solved $y'' + p(x) y' + q(x) y = 0.$ That is, we have $y_1,$ $y_2$ such that $y_H = A y_1 + B y_2.$ We are looking for \[ y_p = u(x) y_1 + v(x) y_2. \qquad (2) \]

We determine $u$ and $v$ so that (2) is a particular solution of the non-homogeneous ODE (1).




6.1 Derive the formulae for $u(x)$ and $v(x)$ in the variation of parameters

$$\text{Non-homogeneous ODE: }\;y'' + p(x) y' + q(x) y = r(x).\qquad(1)$$ \[ \text{We are looking for: }\;y_p = u(x) y_1 + v(x) y_2. \qquad (2) \]

We determine $u$ and $v$ so that (2) is a particular solution of the non-homogeneous ODE (1). First, differentiating (2) we obtain

$y_p' = u'y_1 + u y_1'+ v'y_2+vy_2'.$

Now set   $u'y_1 + v' y_2 = 0$    ($\star$)

Then  $y_p' = u y_1'+ vy_2' + 0$  $\Ra \;y_p'' = u' y_1' + u y_1'' + v' y_2' + v y_2''.$





6.1 Derive the formulae for $u(x)$ and $v(x)$ in the variation of parameters

$u'y_1 + v' y_2 = 0$    ($\star$)

\[ \begin{eqnarray} y_p &=& u y_1 + v y_2,\\ y_p' &=& uy_1' + vy_2',\\ y_p'' &=& u' y_1' + u y_1'' + v' y_2' + v y_2''. \end{eqnarray} \]







6.1 Derive the formulae for $u(x)$ and $v(x)$ in the variation of parameters

$u'y_1 + v' y_2 = 0$    ($\star$)

\[ \begin{eqnarray} y_p &=& u y_1 + v y_2,\\ y_p' &=& uy_1' + vy_2',\\ y_p'' &=& u' y_1' + u y_1'' + v' y_2' + v y_2''. \end{eqnarray} \]

Thus, substituting these values into the non-homogenous:

$y'' + p(x) y' + q(x) y \qquad $

$\ds =\left( u' y_1' + u y_1'' + v' y_2' + v y_2'' \right)+ p(x)\left(uy_1' +vy_2'\right) + q(x)\left(uy_1 +vy_2\right)$

$= u \left(y_1'' +p y_1'+qy_1\right)+ v \left(y_2'' +p y_2'+qy_2\right) + u'y_1'+ v'y_2'$

$= u'y_1'+ v'y_2'$ $=r(x)\quad (\star\star) \qquad\qquad \qquad \qquad \qquad \;\; $



6.1 Derive the formulae for $u(x)$ and $v(x)$ in the variation of parameters

$u'y_1 + v' y_2 = 0$    ($\star$)

$\quad\;\;\, u'y_1'+ v'y_2' = r(x)$     ($\star\star$)

Here we have a linear system of two algebraic equations for $u'$ & $v'$: \[ \left\{ \begin{eqnarray*} u'y_1 + v' y_2 &=& 0\\ u'y_1' + v' y_2' &=& r(x) \end{eqnarray*} \right. \]

Written in matrix form:

\[ \begin{eqnarray*} \left( \begin{matrix} y_1 & y_2 \\ y_1' & y_2' \end{matrix}\right) \left( \begin{matrix} u' \\ v' \end{matrix}\right) &=& \left( \begin{matrix} 0 \\ r(x) \end{matrix}\right). \end{eqnarray*} \]



6.1 Derive the formulae for $u(x)$ and $v(x)$ in the variation of parameters

\[ \begin{eqnarray*} \left( \begin{matrix} y_1 & y_2 \\ y_1' & y_2' \end{matrix}\right) \left( \begin{matrix} u' \\ v' \end{matrix}\right) &=& \left( \begin{matrix} 0 \\ r(x) \end{matrix}\right). \end{eqnarray*} \]

So if $W = \det \left( \begin{matrix} y_1 & y_2 \\ y_1' & y_2' \end{matrix}\right) \neq 0,$ then

$\ds \left( \begin{matrix} u' \\ v' \end{matrix}\right) $ $= \ds \left( \begin{matrix} y_1 & y_2 \\ y_1' & y_2' \end{matrix}\right)^{-1} \left( \begin{matrix} 0\\ r(x) \end{matrix}\right) \qquad \qquad \qquad \qquad \qquad$

$= \ds \frac{1}{W} \left( \begin{matrix} y_2' & -y_2 \\ -y_1' & y_1 \end{matrix}\right) \left( \begin{matrix} 0\\ r(x) \end{matrix}\right)$ $= \ds \frac{1}{W} \left( \begin{matrix} -y_2 r(x)\\ y_1 r(x) \end{matrix}\right)$



6.1 Derive the formulae for $u(x)$ and $v(x)$ in the variation of parameters

\[ \begin{eqnarray*} \left( \begin{matrix} y_1 & y_2 \\ y_1' & y_2' \end{matrix}\right) \left( \begin{matrix} u' \\ v' \end{matrix}\right) &=& \left( \begin{matrix} 0 \\ r(x) \end{matrix}\right). \end{eqnarray*} \]

So if $W = \det \left( \begin{matrix} y_1 & y_2 \\ y_1' & y_2' \end{matrix}\right) \neq 0,$ then

$\ds \left( \begin{matrix} u' \\ v' \end{matrix}\right) $ $= \ds \frac{1}{W} \left( \begin{matrix} -y_2 r(x)\\ y_1 r(x) \end{matrix}\right)$

$\Ra\, u' = \ds \frac{-y_2r(x)}{W}\;\;$ and $\;\;\ds v'= \frac{y_1r(x)}{W} \qquad$

$\Ra\, u = \ds - \int \frac{y_2r(x)}{W}dx\;\;$ and $\;\;\ds v= \int \frac{y_1r(x)}{W}dx .$ $\; \blacksquare$



6.2 Example: $y''- 4y' + 5y = 2e^{2x}/\sin x$

We are looking for the general solution: $y = y_H + y_p.$

For $y_H$: We have that $y_H''- 4y_H' + 5y_H=0$ implies $$\lambda^2 -4\lambda + 5 = 0.$$

$\Ra \lambda = 2 \pm i.$ Thus $y_H = A e^{2x}\cos x + B e^{2x}\sin x.$

Now for $y_p$: We have that $\ds \det \left( \begin{matrix} y_1 & y_2 \\ y_1' & y_2' \end{matrix}\right) $ $=e^{4x}$ $\neq 0.$

So we can use variation of parameters to obtain

$y_p = u y_1 + vy_2.$



6.2 Example: $y''- 4y' + 5y = 2e^{2x}/\sin x$

$ y_p = u y_1 + vy_2. $

$\qquad u = - \ds \int \frac{y_2 r}{W}dx$ $ =-\ds \int \frac{e^{2x} \sin x \left(\frac{2e^{2x}}{\sin x}\right)}{e^{4x}}dx $

$\qquad \quad =\ds - \int 2dx $ $=-2x.$

$\qquad v = \ds \int \frac{y_1 r}{W}dx$ $ =\ds \int \frac{e^{2x} \cos x \left(\frac{2e^{2x}}{\sin x}\right)}{e^{4x}}dx $

$\qquad \quad=\ds 2\int \frac{\cos x}{\sin x}dx $ $=\ds 2 \ln \abs{\sin x}. $



6.2 Example: $y''- 4y' + 5y = 2e^{2x}/\sin x$

Thus $u =-2x\;\text{ and} \;v =\ds 2 \ln \abs{\sin x}.$ Then

$y_p$ $ = u y_1 + vy_2\qquad \qquad\qquad\qquad \qquad$

$=-2x e^{2x}\cos x + 2\ln \abs{\sin x}e^{2x} \sin x.$

Therefore

$y = $ $y_H $ $+$ $y_p $

$\quad=$ $A e^{2x}\cos x + B e^{2x}\sin x $

$\qquad \qquad -\,2x e^{2x}\cos x + 2\ln \abs{\sin x}e^{2x} \sin x.$



6.2 Example: $y''- 4y' + 5y = 2e^{2x}/\sin x$

6.3 Repeat the previous example using reduction of order

We start by setting $y_p= U(x) e^{2x}\sin x$.

Note: We could have also used $y_p= V(x) e^{2x}\cos x.$

$y_p' = U' e^{2x }\sin x + 2U e^{2x} \sin x + U e^{2x}\cos x.$
$y_p'' = e^{2 x} \big(\sin x U'' + 2 U' (2 \sin x + \cos x) + U (3 \sin x + 4 \cos x)\big).$

After substituting into the non-homogeneous ODE and simplifying we obtain

$ y'' - 4y' + 5y = $ $U'' e^{2x} \sin x + 2 U' e^{2x}\cos x $ $\ds \,= \frac{2e^{2x}}{\sin x}.$



6.3 Repeat the previous example using reduction of order

$U'' \sin x + 2 U'\cos x \ds = \frac{2}{\sin x}\;$ $ \Ra\; U'' \sin^2 x + 2 U'\cos x \sin x \ds = 2.$

Now we set $V = U'$ $\,\Ra V' \sin^2 x + 2 V \cos x \sin x = 2. $

$\Ra \left(V \sin^2 x\right)'=2$ $\,\Ra V \sin^2 x=2 x.$

$\Ra U' = \ds \frac{2x}{\sin^2 x}\,$ $\,\Ra U = \ds \int \frac{2x}{\sin^2 x}dx$ $\ds =- 2x\frac{\cos x}{\sin x} + 2 \ln \abs{\sin x}.$

So $y_p = U(x) e^{2x} \sin x $ $=-2x e^{2x} \cos x + 2 \ln \abs{\sin x} e^{2x} \sin x.$

This is the same value $y_p$ as before in Example 6.2.



6.4 Summary of ODE techniques and types of equations you should know

  • First order, directly integrable.
  • First order, separable.
  • First order, linear, integrating factor.
  • First order existence and uniqueness criteria.
  • First order, exact.
  • Second order homogeneous, linear, constant coeffcients.
  • Second order non-homogeneous, constant coeffcients, method of undetermined coeffcients for certain cases.
  • Second order non-homogeneous, variation of parameters.
  • Reduction of order.


Credits