# Variation of parameters #voparam >[Professors definition/derivations during lecture](prof-variation-of-parameters.html) <- I found this to be too big brain for me. Here is a simplified definition: ## Variation of parameters is a method to solve: ## $$ay''+by'+cy=f(t)$$ First, find the homogenous solution: $y_{h}=c_{1}y_{1}(t)+c_{2}y_{2}(t)$ Now we need the particular solution, let $y_{p}$ be in the following form: $y_{p}(t)=v_{1}(t)y_{1}(t)+v_{2}(t)y_{2}(t)$ <- btw $y_{1}$ and $y_{2}$ are often called a fundamental pair. They are obtained from your homogenous solution. Impose the following: 1) $v_{1}'y_{1}+v_{2}'y_{2}=0$ Compute the derivatives and simplify: $y'_{p}=v_{1}y_{1}'+v_{2}y_{2}'$ $y_{p}''=v_{1}'y_{1}'+v_{1}y_{1}''+v_{2}'y_{2}'+v_{2}y_{2}''$ Now we plug those into the second order equation and simplify: 2) $v_{1}'y_{1}'+v_{2}'y_{2}'=\frac{f(t)}{a}$ We now have a system of two equations (1 and 2). Now we can solve for $v_{1}$ and $v_{2}$: Using Cramer's rule, we can solve for the system of equations and obtain the solutions: $v_{1}'=-\frac{{f(t)y_{2}(t)}}{aW[y_{1},y_{2}]}$; $v_{2}'=\frac{{f(t)y_{1}(t)}}{aW[y_{1},y_{2}]}$ <- integrate both sizes to get $v_{1}$ and $v_{2}$. When integrating, you don't need to add a generic constant. also, $W[y_1,y_{2}]$ is the WroĊ„skian, and it equals to: $\det \begin{pmatrix}y_{1}&y_{2}\\ y_{1}' &y_{2}'\end{pmatrix}=y_{1}y_{2}'-y_{2}y_{1}'$ Finally, the general solution is: $$y(t)=y_{h}+y_{p}\qquad \text{where}\qquad y_{p}(t)=v_{1}(t)y_{1}(t)+v_{2}(t)y_{2}(t)$$ ## What you need to remember So, what do you need to commit to memory? I believe memorizing these three is a good tradeoff between memory allocated and speed for when you're solving a #voparam problem: 1) $y_{p}(t)=v_{1}(t)y_{1}(t)+v_{2}(t)y_{2}(t)$ 2) $v_{1}'=-\frac{{f(t)y_{2}(t)}}{aW[y_{1},y_{2}]}$ 3) $v_{2}'=\frac{{f(t)y_{1}(t)}}{aW[y_{1},y_{2}]}$ Alternatively, you could memorize the system of equations and solve for $v_{1}'$ and $v_{2}'$. Ie: 1) $y_{p}(t)=v_{1}(t)y_{1}(t)+v_{2}(t)y_{2}(t)$ 2) $v_{1}'y_{1}+v_{2}'y_{2}=0$ 3) $v_{1}'y_{1}'+v_{2}'y_{2}'=\frac{f(t)}{a}$ This is what the prof likes. I love you Dr. Minev, but this I personally disagree with. I think I'll stick with the formulas. --- #ex #second_order #IVP #voparam #mouc $y''+4y=2\tan(2t)-e^t \qquad y(0)=0 \qquad y'(0)=\frac{4}{5}$ Can we use undetermined coefficients? Yes and no. We can use it on the $e^t$ term. However, guessing and checking $y_{p}$ for the $2\tan(2t)$ term might take a really, really long time. First, find general solution to homogenous counterpart: $y''+4y=0$ -> $r^2+4=0$ -> $r_{1,2}=\pm 2i$ $y_{h}(t)=c_{1}\cos(2t)+c_{2}\sin(2t)$ Done. Easy peasy. For $-e^t$ lets use method of undetermined coefficients: $y''+4y=-e^t$ $y_{p_{1}}(t)=Ae^{t}$ $5Ae^t=-e^t$ $A=-\frac{1}{5}$ $y_{p_{1}}(t)=-\frac{1}{5}e^t$ Now for $2\tan(2t)$, we cannot realistically use method of undetermined coefficients. Let's use variation of parameters instead: $y''+4y=2\tan(2t)$ $y_{p_{2}}(t)=v_{1}(t)y_{1}(t)+v_{2}(t)y_{2}(t)$ where $y_{1}=\cos(2t)$, $y_{2}=\sin(2t)$ recall: $v_{1}'=-\frac{f(t)y_{2}}{aW[y_{1},y_{2}]}$ $v_{2}'=\frac{f(t)y_{1}}{aW[y_{1},y_{2}]}$ plugging in: $v_{1}'=-\frac{2\tan(2t)\sin(2t)}{(1)(\cos2t(2)\cos2t-\sin2t(-2)\sin2t}=-\frac{2\tan(2t)\sin(2t)}{2\cos^22t+2\sin^22t}=-\tan(2t)\sin(2t)$ $v_{2}'=\frac{2\tan(2t)\cos(2t)}{2}=\sin(2t)$ <- isn't it nice how we can reuse our computation for the denominator? :D Now we integrate. $v_{2}=-\frac{1}{2}\cos(2t)$ <- Don't add a constant of integration, we want one solution only. $v_{1}=-\int \frac{\sin^2(2t)}{\cos(2t)} \, dt$ $v_{1}=-\int \frac{{1-\cos^2(2t)}}{\cos(2t)} \, dt$ $v_1=-\int sec(2t) \, dt+\int \cos(2t) \, dt$ $v_{1}(t)=-\frac{1}{2}\ln\mid sec(2t)+\tan(2t)\mid+\frac{1}{2}\sin(2t)$ $y_{p_{2}}(t)=v_{1}(t)\cos(2t)+v_{2}(t)\sin(2t)$ > ^Now you can start to see how guessing $y_{p_{2}}$ would take a really, really long time. $y(t)=y_{h}(t)+y_{p_{1}}(t)+y_{p_{2}}(t)$ =$c_{1}\cos(2t)+c_{2}\sin(2t)+v_{1}(t)\cos(2t)+v_{2}(t)\sin(2t)-\frac{1}{5}e^t$ is the general answer. IVP solution: $y(0)=0=c_{1}-y_{p}(0)=c_{1}-\frac{1}{5} \implies c_{1}=\frac{1}{5}$ $y'(0)=\frac{4}{5}=2c_{2}+v_{1}'(0)+2v_{2}(0)-\frac{1}{5} \implies c_{2}=1$ $$y(t)=\frac{1}{5}\cos(2t)+\sin(2t)-\frac{1}{5}e^t+v_{1}(t)\cos(2t)+v_{2}(t)\sin(2t)$$ #end of lecture 9 #start of lecture 10 #ex #second_order #voparam #mouc $$y''-2y'+y=e^t\ln(t)+2\cos(t)$$ Find homogenous solution first: $r^2-2r+1=0$ $r_{1,2}=1$ (repeated root) $y_{h}(t)=c_{1}e^t+c_{2}te^t$ 2) $y_{p}(t)=?$ $y''-2y'+y=2\cos (t)$ let's use method of undetermined coefficients: $y_{p_{1}}=A\cos(t)+B\sin(t)$ is our guess $y_{p_{1}}'=-A\sin t+B\cos t$ $y_{p_{1}}''=-A\cos t-B\sin t$ $-A\cos t-B\sin t+2A\sin t-2B\cos t+A\cos t+B\sin t=2\cos t$ $-2B\cos t+2A\sin(t)=2\cos t(t)$ $\implies A=0,\ B=-1$ $y_{p_{1}}=-\sin(t)$ $y''-2y'+y=e^t\ln(t)$ cant use undetermined coefficients, use variation of parameters $y_{p}''(t)=v_{1}y_{1}+v_{2}y_{2}$ $=v_{1}e^t+v_{2}te^t$ Compute $v_{1}$ and $v_{2}$. This time let's do it using the linear system for practice: eq1) $e^tv_{1}'+te^tv_{2}'=0$ eq2) $e^tv_{1}'+(te^t+e^t){v_{2}'}=e^t{\ln t}$ subtract eq1 from eq2: $v_{2}'=\ln(t)$ $v_{2}(t)=\int \ln(t) \, dt$ integrate by parts $=t\ln(t)-\int t\frac{1}{t} \, dt$ $=t\ln(t)-t$ no constant of integration. compute $v_{1}$ now: $v_{1}'=-tv_{2}'$ $=-t\ln t$ integrate to get $v_1$: $v_{1}=-\int t\ln t \, dt$ integrate by parts (btw integration by parts will be the most important integration technique in this course): $v_{1}=-\frac{1}{2}(t^2\ln t)-\int t^2\frac{1}{t} \, dt$ $=-\frac{1}{2}\left( t^2\ln t-\frac{t^2}{2} \right)=-\frac{1}{2}t^2\ln t+\frac{1}{4}t^2$ $y_{p}''(t)=(\frac{1}{2}t^2\ln t+\frac{1}{4}t^2)e^t+(t\ln t-t)te^t$ $y_{p}(t)=-\sin(t)+\frac{1}{2}t^2\ln(t)e^t-\frac{3}{4}t^2e^t$ general solution is produced by adding the homogenous eq with $y_{p}(t)$ general solution: $$y(t)=c_{1}e^t+c_{2}te^t-\sin(t)+\frac{1}{2}t^2\ln(t)e^t-\frac{3}{4}t^2e^t$$ We are done.