Holt.Blue
Back To Class Notes Menu
Variation of Parameters

Undetermined coefficients is great, right?

We love it!



























Except for when it's useless.

Consider an example...





























When Undetermined Coefficients Fails

Suppose we need to to solve the equation $$ y''+9y=\tan(3x) $$ Question #1: What particular solution might work here?

Since $\tan(3x)$ doesn't have derivatives and integrals that look similar to itself (like $\cos (ax),$ $\sin (ax),$ $e^{ax}$ and polynomials $a_nx^n+\cdots+a_x+a_0$), understanding what to guess for a particular solution $y_p$ becomes a great deal more complicated.

Question #2: Is there any hope?































Answer to Question #2

Yes!

Today we learn a method for finding particular solutions that relies considerably less on guesswork.

The method is called variation of parameters.

























The Big Idea

For a second-order linear equation, $$ y''+p(x)y'+q(x)y=f(x) $$ we assume that we have two linearly independent solutions $y_1$ and $y_2$ to the homogeneous equation $$ y''+p(x)y'+q(x)y=0 $$ We take the homogeneous solution $$ y=C_1y_1+C_2y_2 $$ We then allow the parameters $C_1$ and $C_2$ vary to obtain a particular solution which has the form $$ y_p=v_1(x)y_1+v_2(x)y_2 $$























Variation of Parameters

Through a lot of tedious calculation based upon the above assumptions, we may solve for $v_1'(x)$ and $v_2'(x)$ by solving the system of equations $$ \begin{cases} y_1v_1'+y_2 v_2'&=0\\ y_1'v_1'+y_2' v_2'&=f(x)\\ \end{cases} $$ In matrix form we may also write $$ \left[ \begin{array}{cc} y_1 & y_2\\ y_1' & y_2'\\ \end{array} \right] \left[ \begin{array}{c} v_1' \\ v_2' \\ \end{array} \right] = \left[ \begin{array}{c} 0 \\ f(x) \\ \end{array} \right] $$ Once we have $v_1'$ and $v_2',$ we may integrate to get $v_1$ and $v_2$ to obtain our particular solution $$ y_p=v_1y_1+v_2y_2 $$























Example

Find a particular and general solution to the equation $$ y''+9y=\tan(3x) $$

We shall use the variation of parameters technique which requires knowing the the general solution to the homogeneous equation.

Solving $y''+9y=0,$ the characteristic equation is $r^2+9=0$ so that $r=\pm 3i.$ Then $$ y_h=C_1\cos(3x)+C_2\sin(3x) $$ solves the homogeneous equation.

We now "vary parameters" and suppose a particular solution has the form $$ y_p=v_1(x)\cos(3x)+v_2(x)\sin(3x) $$ Then $v_1$ and $v_2$ must satisfy $$ \begin{cases} y_1v_1'+y_2 v_2'&=0\\ y_1'v_1'+y_2' v_2'&=f(x)\\ \end{cases} $$ or $$ \begin{cases} \cos(3x)v_1'+\sin(3x) v_2'&=0\\ -3\sin(3x)v_1'+3\cos(3x)v_2'&=\tan(3x)\\ \end{cases} $$ Multiplying the top equation by $3\tan(3x),$ we have $3\sin(3x)v_1'+3\tan(3x)\sin(3x)v_2'=0.$

Adding this equation to the second equation in the above system gives $$ 3\cos(3x)v_2'+3\tan(3x)\sin(3x)v_2'=\tan(3x) $$ so that $$ \begin{array}{lll} \displaystyle v_2'&\displaystyle=\frac{\tan(3x)}{3\cos(3x)+3\tan(3x)\sin(3x)} &\mbox{}\\ \displaystyle &\displaystyle=\frac{\tan(3x)}{3\cos(3x)+3\tan(3x)\sin(3x)}\color{magenta}{\frac{\cos(3x)}{\cos(3x)}} &\mbox{}\\ \displaystyle &\displaystyle=\frac{\sin(3x)}{3\cos^2(3x)+3\sin^2(3x)}&\mbox{}\\ \displaystyle &\displaystyle=\frac{1}{3}\sin(3x)&\mbox{}\\ \end{array} $$ Then from the first equation of the system $$ \begin{array}{lll} &\displaystyle \cos(3x)v_1'+\sin(3x) v_2'=0&\mbox{}\\ \implies &\displaystyle \cos(3x)v_1'+\sin(3x)\left(\frac{1}{3}\sin(3x)\right)=0&\mbox{}\\ \implies &\displaystyle \cos(3x)v_1'+\frac{1}{3}\sin^2(3x)=0&\mbox{}\\ \implies &\displaystyle v_1'=-\frac{1}{3}\frac{\sin^2(3x)}{\cos(3x)}&\mbox{}\\ \end{array} $$ The solution to the system is $$ v_1'=\frac{1}{3}\frac{\sin^2(3x)}{\cos(3x)} \,\,\,\,\mbox{and}\,\,\,\, v_2'=\frac{1}{3}\sin(3x) $$ We then have $$ \begin{array}{lll} \displaystyle v_1&\displaystyle=\int -\frac{1}{3}\frac{\sin^2(3x)}{\cos(3x)} \, dx &\mbox{}\\ \displaystyle &\displaystyle=-\frac{1}{3}\int \frac{1-\cos^2(3x)}{\cos(3x)} \, dx &\mbox{}\\ \displaystyle &\displaystyle=-\frac{1}{3}\int \sec(3x)-\cos(3x) \, dx &\mbox{}\\ \displaystyle &\displaystyle=-\frac{1}{3}\left(\frac{1}{3}\ln|\sec(3x)+\tan(3x)|-\frac{1}{3}\sin(3x)\right) &\mbox{}\\ \displaystyle &\displaystyle=-\frac{1}{9}\ln|\sec(3x)+\tan(3x)|+\frac{1}{9}\sin(3x) &\mbox{}\\ \end{array} $$ and $$ \begin{array}{lll} \displaystyle v_2&\displaystyle= \int \frac{1}{3}\sin(3x) \, dx &\mbox{}\\ \displaystyle &\displaystyle= -\frac{1}{9}\cos(3x)&\mbox{}\\ \end{array} $$ So, our particular solution is $$ \begin{array}{ll} y_p&= \displaystyle v_1(x)\cos(3x)+v_2(x)\sin(3x)\\ &= \displaystyle \left(-\frac{1}{9}\ln|\sec(3x)+\tan(3x)|+\frac{1}{9}\sin(3x)\right)\cos(3x)-\frac{1}{9}\cos(3x)\sin(3x)\\ &= \displaystyle -\frac{1}{9}\cos(3x)\ln|\sec(3x)+\tan(3x)|+\frac{1}{9}\sin(3x)\cos(3x)-\frac{1}{9}\cos(3x)\sin(3x)\\ &= \displaystyle -\frac{1}{9}\cos(3x)\ln|\sec(3x)+\tan(3x)|\\ \end{array} $$ The general solution to the equation is then $$ y=y_h+y_p=C_1\cos(3x)+C_2\sin(3x)-\frac{1}{9}\cos(3x)\ln|\sec(3x)+\tan(3x)| $$



























Variation of Parameters Formula

Using Cramer's Rule, we can solve $$ \left[ \begin{array}{cc} y_1 & y_2\\ y_1' & y_2'\\ \end{array} \right] \left[ \begin{array}{c} v_1' \\ v_2' \\ \end{array} \right] = \left[ \begin{array}{c} 0 \\ f(x) \\ \end{array} \right] $$ for $v_1'$ and $v_2'$ straightaway as $$ v_1'=\frac{\left|\begin{array}{cc} 0 & y_2 \\f(x) & y_2'\\ \end{array}\right|}{\left|\begin{array}{cc} y_1&y_2\\y_1'&y_2'\\ \end{array}\right|} =-\frac{y_2f(x)}{W[y_1,y_2]} =-\frac{y_2f(x)}{y_1y_2'-y_2y_1'} \\\\ v_2'=\frac{\left|\begin{array}{cc} y_1 & 0 \\y_1' & f(x)\\ \end{array}\right|}{\left|\begin{array}{cc} y_1&y_2\\y_1'&y_2'\\ \end{array}\right|} =\frac{y_1f(x)}{W[y_1,y_2]} =\frac{y_1f(x)}{y_1y_2'-y_2y_1'} $$























Variation of Parameters Formula

Thus, from the above, we have the following formulas. $$ v_1=-\int \frac{y_2f(x)}{W[y_1,y_2]}\, dx=-\int \frac{y_2f(x)}{y_1y_2'-y_2y_1'}\, dx \\\\ v_2=\int \frac{y_1f(x)}{W[y_1,y_2]} \, dx=\int \frac{y_1f(x)}{y_1y_2'-y_2y_1'}\, dx $$























Example

Use the above formulas to obtain $v_1$ and $v_2$ in the particular solution $y_p$ for the equation $$ y''+9y=\tan(3x) $$

Since $y_1=\cos(3x)$ and $y_2=\sin(3x),$ we have $y_1'=-3\sin(3x)$ and $y_2'=3\cos(3x).$

Then $$ \begin{array}{lll} W[y_1,y_2]&=\left|\begin{array}{cc} y_1&y_2\\y_1'&y_2'\\ \end{array}\right|\\ &=y_1y_2'-y_2y_1'\\ &=\cos(3x)(3\cos(3x))-(\sin(3x))(-3\sin(3x))\\ &=3\cos^2(3x)+3\sin^2(3x)\\ &=3\\ \end{array} $$ so that $$ \begin{array}{lll} \displaystyle v_1&\displaystyle=-\int \frac{y_2f(x)}{W[y_1,y_2]}\, dx &\mbox{}\\ \displaystyle &\displaystyle=-\int \frac{\sin(3x)\tan(3x)}{3}\, dx &\mbox{}\\ \displaystyle &\displaystyle=-\frac{1}{3}\int \frac{\sin^2(3x)}{\cos(3x)}\, dx &\mbox{}\\ \displaystyle &\displaystyle=-\frac{1}{3}\int \frac{1-\cos^2(3x)}{\cos(3x)} \, dx &\mbox{}\\ \displaystyle &\displaystyle=-\frac{1}{3}\int \sec(3x)-\cos(3x) \, dx &\mbox{}\\ \displaystyle &\displaystyle=-\frac{1}{3}\left(\frac{1}{3}\ln|\sec(3x)+\tan(3x)|-\frac{1}{3}\sin(3x)\right) &\mbox{}\\ \displaystyle &\displaystyle=-\frac{1}{9}\ln|\sec(3x)+\tan(3x)|+\frac{1}{9}\sin(3x) &\mbox{}\\ \end{array} $$ and $$ \begin{array}{lll} \displaystyle v_2&\displaystyle=\int \frac{y_1f(x)}{W[y_1,y_2]} \, dx &\mbox{}\\ \displaystyle &\displaystyle=\int \frac{\cos(3x)\tan(3x)}{3} \, dx &\mbox{}\\ \displaystyle &\displaystyle=\frac{1}{3}\int \sin(3x) \, dx &\mbox{}\\ \displaystyle &\displaystyle=-\frac{1}{9}\cos(3x) &\mbox{}\\ \end{array} $$



























Bonus Example with Variable-Coefficients

Given that $\displaystyle y_1=\frac{1}{x-1}$ and $\displaystyle y_2=\frac{1}{x+1}$ are solutions to the corresponding homogeneous equation to $$ (x^2-1)y''+4xy'+2y=-\frac{2}{x+1} $$ find a particular and general solution to the full equation.

We shall use the variation of parameters formula to to this situation.

We first put the equation in standard form. $$ y''+\frac{4x}{x^2-1}y'+\frac{2}{x^2-1}y=-\frac{2}{(x+1)(x^2-1)} $$ Then for this situation $$ f(x)=-\frac{2}{(x+1)(x^2-1)}=-\frac{2}{(x+1)^2(x-1)} $$ Now, $\displaystyle y_1'=-\frac{1}{(x-1)^{2}}$ and $\displaystyle y_2'=-\frac{1}{(x+1)^{2}}.$

The Wronskian is then $$ \begin{array}{ll} W[y_1,y_2]&=\displaystyle\left|\begin{array}{cc} y_1&y_2\\y_1'&y_2'\\ \end{array}\right|\\ &=\displaystyle\left|\begin{array}{cc} (x-1)^{-1}&(x+1)^{-1}\\-(x-1)^{-2}&-(x+1)^{-2}\\ \end{array}\right|\\ &=\displaystyle -(x-1)^{-1}(x+1)^{-2}+(x+1)^{-1}(x-1)^{-2}\\ &=\displaystyle -\frac{1}{x-1}\frac{1}{(x+1)^{2}}+\frac{1}{(x+1)}\frac{1}{(x-1)^{2}}\\ &=\displaystyle -\frac{x-1}{(x-1)^2(x+1)^{2}}+\frac{x+1}{(x+1)^2(x-1)^{2}}\\ &=\displaystyle \frac{2}{(x+1)^2(x-1)^{2}}\\ \end{array} $$ We then have $$ \begin{array}{lll} \displaystyle v_1&\displaystyle=-\int \frac{y_2f(x)}{W[y_1,y_2]}\, dx &\mbox{}\\ \displaystyle &\displaystyle=-\int \frac{1}{x+1}\left(-\frac{2}{(x+1)^2(x-1)}\right)\frac{(x+1)^2(x-1)^{2}}{2} \, dx &\mbox{}\\ \displaystyle &\displaystyle=\int \frac{x-1}{x+1} \, dx &\mbox{}\\ \displaystyle &\displaystyle=\int \frac{u-2}{u} \, du &\mbox{$u=x+1$ and $du=dx$}\\ \displaystyle &\displaystyle=\int 1-\frac{2}{u} \, du &\mbox{}\\ \displaystyle &\displaystyle=u-2\ln |u| &\mbox{}\\ \displaystyle &\displaystyle=x+1-2\ln |x+1| &\mbox{}\\ \end{array} $$ For simplicity, we may take $v_1=x-2\ln|x+1|.$

For $v_2,$ $$ \begin{array}{lll} \displaystyle v_2&\displaystyle=\int \frac{y_1f(x)}{W[y_1,y_2]}\, dx &\mbox{}\\ \displaystyle &\displaystyle=\int \frac{1}{x-1}\left(-\frac{2}{(x+1)^2(x-1)}\right)\frac{(x+1)^2(x-1)^{2}}{2} \, dx &\mbox{}\\ \displaystyle &\displaystyle=\int -1 \, dx &\mbox{}\\ \displaystyle &\displaystyle=-x &\mbox{}\\ \end{array} $$ The particular solution is then $$ \begin{array}{lll} \displaystyle y_p&\displaystyle=v_1y_1+v_2y_2 &\mbox{}\\ \displaystyle &\displaystyle= \left(x-2\ln|x+1|\right)\frac{1}{x-1} +(-x)\frac{1}{x+1} &\mbox{}\\ \displaystyle &\displaystyle= \frac{x-2\ln|x+1|}{x-1} -\frac{x}{x+1} &\mbox{}\\ \end{array} $$ The general solution is $$ y=y_h+y_p=\frac{C_1}{x-1}+\frac{C_2}{x+1}+\frac{x-2\ln|x+1|}{x-1} -\frac{x}{x+1} $$