# Solving Differential Equations with Variation of Parameters

concept
You may have noticed that undetermined coefficients requires an awful lot of algebra to solve many problems and there are only a small number of problems it can solve since $$g(t)$$ has to be of a particular form for it to work. Well variation of parameters is a method that will work for absolutely any second order nonhomogeneous linear differential equation. Which sounds great however this comes at a few costs:
• It requires some integrals that might or might not be solvable
• It requires that we have the complementary solutions already
• It is given as a short formula
So we can always come up with a formula for the answer if we can get the complementary solutions but we might not be able to do the integral to get the answer. If we can do the integral the answer pops out without any problem solving or creative thinking necessary though, which is nice especially in exam situations. The method is very powerful and is used frequently, it might be hard to get your head around but luckily it requires only rote application of the formula which you can bring in on your cheat sheet during exams.
fact
Given a differential equation of the form: $$p(t)y'' + q(t)y' + r(t)y = g(t)$$ The particular solution is given by: $$y_p(t) = -y_1 \int \frac{y_2g(t)}{W(y_1,y_2)}dt + y_2 \int \frac{y_1g(t)}{W(y_1,y_2)}dt$$ Where $$y_1$$ and $$y_2$$ are the complementary solutions (doens't matter which is $$y_1$$ or $$y_2$$) and $$W(y_1,y_2)$$ is something called the Wronskian and given by: $$W(y_1, y_2) = \begin{vmatrix} y_1 & y_2 \\ y_1' & y_2' \end{vmatrix} = y_1y_2' - y_2y_1'$$
fact
The constants of integration can be ignored when doing the integrals for variation of parameters since they end up always being zero at the end anyway.
example

Find the particular solution to: $$2y'' + 18y = 6\tan(3t)$$

First we need the complementary solutions, $$2r^2 + 18 = 0$$ $$r^2 + 9 = 0$$ $$r = \pm 3i$$ $$y_c = \cos(3t) + \sin(3t)$$ So $$y_1 = \cos(3t)$$ and $$y_2 = \sin(3t)$$. We could have these the other way around and it wouldn't matter. Now we find $$W(y_1, y_2) = \begin{vmatrix} \cos(3t) & \sin(3t) \\ -3\sin(3t) & 3\cos(3t) \end{vmatrix} = 3\cos^2(3t) + 3\sin^2(3t) = 3$$ And now we can just use our trusty variation of parameters formula to find: $$y_p(t) = -\cos(3t) \int \frac{3\sin(3t)\tan(3t)}{3}dt + \sin(3t) \int \frac{3\cos(3t)\tan(3t)}{3}dt$$ $$= -\cos(3t) \int \frac{sin^2(3t)}{\cos(3t)} dt + \sin(3t) \int \sin(3t) dt$$ A little trig later we have: $$y_p(t) = -\frac{\cos(3t)}{3}\ln \left| \sec(3t) + \tan(3t) \right|$$
practice problems