The method of the last section works only when the function $f(t)$ in $\ds a\ddot y+b\dot y+cy=f(t)$ has a particularly nice form, namely, when the derivatives of $f$ look much like $f$ itself. In other cases we can try variation of parameters as we did in the first order case.
Since as before $a\not=0$, we can always divide by $a$ to make the coefficient of $\ds\ddot y$ equal to 1. Thus, to simplify the discussion, we assume $a=1$. We know that the differential equation $\ds \ddot y+b\dot y+cy=0$ has a general solution $\ds Ay_1+By_2$. As before, we guess a particular solution to $\ds \ddot y+b\dot y+cy=f(t)$; this time we use the guess $\ds y=u(t)y_1+v(t)y_2$. Compute the derivatives: $$\eqalign{ \dot y&=\dot uy_1+u\dot y_1+\dot vy_2+v\dot y_2\cr \ddot y&=\ddot uy_1+\dot u\dot y_1+\dot u\dot y_1+u\ddot y_1+\ddot vy_2+\dot v\dot y_2+\dot v\dot y_2+v\ddot y_2.\cr} $$ Now substituting: $$\eqalign{ \ddot y+b\dot y+cy&= \ddot uy_1+\dot u\dot y_1+\dot u\dot y_1+u\ddot y_1+\ddot vy_2+\dot v\dot y_2+\dot v\dot y_2+v\ddot y_2\cr &\qquad + b\dot uy_1+bu\dot y_1+b\dot vy_2+bv\dot y_2+cuy_1+cvy_2\cr &=(u\ddot y_1+bu\dot y_1+cuy_1)+(v\ddot y_2+bv\dot y_2+cvy_2)\cr &\qquad + b(\dot uy_1+\dot vy_2) + (\ddot uy_1+\dot u\dot y_1+\ddot vy_2+\dot v\dot y_2)+ (\dot u\dot y_1+\dot v\dot y_2)\cr &=0+0+ b(\dot uy_1+\dot vy_2) + (\ddot uy_1+\dot u\dot y_1+\ddot vy_2+\dot v\dot y_2)+ (\dot u\dot y_1+\dot v\dot y_2).\cr } $$ The first two terms in parentheses are zero because $y_1$ and $y_2$ are solutions to the associated homogeneous equation. Now we engage in some wishful thinking. If $\ds \dot uy_1+\dot vy_2=0$ then also $\ds \ddot uy_1+\dot u\dot y_1+\ddot vy_2+\dot v\dot y_2=0$, by taking derivatives of both sides. This reduces the entire expression to $\ds \dot u\dot y_1+\dot v\dot y_2$. We want this to be $f(t)$, that is, we need $\ds \dot u\dot y_1+\dot v\dot y_2=f(t)$. So we would very much like these equations to be true: $$\eqalign{ \dot uy_1+\dot vy_2&=0\cr \dot u\dot y_1+\dot v\dot y_2&=f(t).\cr} $$ This is a system of two equations in the two unknowns $\ds\dot u$ and $\ds\dot v$, so we can solve as usual to get $\ds\dot u=g(t)$ and $\ds\dot v=h(t)$. Then we can find $u$ and $v$ by computing antiderivatives. This is of course the sticking point in the whole plan, since the antiderivatives may be impossible to find. Nevertheless, this sometimes works out and is worth a try.
Example 17.7.1 Consider the equation $\ds\ddot y-5\dot y+6y=\sin t$. We can solve this by the method of undetermined coefficients, but we will use variation of parameters. The solution to the homogeneous equation is $\ds Ae^{2t}+Be^{3t}$, so the simultaneous equations to be solved are $$\eqalign{ \dot ue^{2t}+\dot ve^{3t}&=0\cr 2\dot ue^{2t}+3\dot ve^{3t}&=\sin t.\cr} $$ If we multiply the first equation by 2 and subtract it from the second equation we get $$\eqalign{ \dot ve^{3t}&=\sin t\cr \dot v&=e^{-3t}\sin t\cr v&=-{1\over 10}(3\sin t+\cos t)e^{-3t},\cr} $$ using integration by parts. Then from the first equation: $$\eqalign{ \dot u&=-e^{-2t}\dot ve^{3t}=-e^{-2t}e^{-3t}\sin(t)e^{3t}=-e^{-2t}\sin t\cr u&={1\over 5}(2\sin t+\cos t)e^{-2t}.\cr} $$ Now the particular solution we seek is $$\eqalign{ ue^{2t}+ve^{3t}&={1\over 5}(2\sin t+\cos t)e^{-2t}e^{2t} -{1\over 10}(3\sin t+\cos t)e^{-3t}e^{3t}\cr &={1\over 5}(2\sin t+\cos t)-{1\over 10}(3\sin t+\cos t)\cr &={1\over 10}(\sin t+\cos t),\cr} $$ and the solution to the differential equation is $\ds Ae^{2t}+Be^{3t}+(\sin t+\cos t)/10$. For comparison (and practice) you might want to solve this using the method of undetermined coefficients. $\square$
Example 17.7.2 The differential equation $\ds\ddot y-5\dot y+6y=e^t\sin t$ can be solved using the method of undetermined coefficients, though we have not seen any examples of such a solution. Again, we will solve it by variation of parameters. The equations to be solved are $$\eqalign{ \dot ue^{2t}+\dot ve^{3t}&=0\cr 2\dot ue^{2t}+3\dot ve^{3t}&=e^t\sin t.\cr} $$ If we multiply the first equation by 2 and subtract it from the second equation we get $$\eqalign{ \dot ve^{3t}&=e^t\sin t\cr \dot v&=e^{-3t}e^t\sin t=e^{-2t}\sin t\cr v&=-{1\over 5}(2\sin t+\cos t)e^{-2t}.\cr} $$ Then substituting we get $$\eqalign{ \dot u&=-e^{-2t}\dot ve^{3t}=-e^{-2t}e^{-2t}\sin(t)e^{3t}=-e^{-t}\sin t\cr u&={1\over 2}(\sin t+\cos t)e^{-t}.\cr} $$ The particular solution is $$\eqalign{ ue^{2t}+ve^{3t}&={1\over 2}(\sin t+\cos t)e^{-t}e^{2t} -{1\over 5}(2\sin t+\cos t)e^{-2t}e^{3t}\cr &={1\over 2}(\sin t+\cos t)e^t-{1\over 5}(2\sin t+\cos t)e^t\cr &={1\over 10}(\sin t+3\cos t)e^t,\cr} $$ and the solution to the differential equation is $\ds Ae^{2t}+Be^{3t}+e^t(\sin t+3\cos t)/10$. $\square$
Example 17.7.3 The differential equation $\ds\ddot y -2\dot y+y=e^t/t^2$ is not of the form amenable to the method of undetermined coefficients. The solution to the homogeneous equation is $\ds Ae^t+Bte^t$ and so the simultaneous equations are $$\eqalign{ \dot ue^{t}+\dot vte^{t}&=0\cr \dot ue^{t}+\dot vte^{t}+\dot ve^t&={e^t\over t^2}.\cr} $$ Subtracting the equations gives $$\eqalign{ \dot ve^{t}&={e^t\over t^2}\cr \dot v&={1\over t^2}\cr v&=-{1\over t}.\cr} $$ Then substituting we get $$\eqalign{ \dot ue^t&=-\dot vte^t=-{1\over t^2}te^t\cr \dot u&=-{1\over t}\cr u&=-\ln t.\cr} $$ The solution is $\ds Ae^t+Bte^t-e^t\ln t-e^t$. $\square$
Exercises 17.7
Find the general solution to the differential equation using variation of parameters.
Ex 17.7.1 $\ds\ddot y+y=\tan x$ (answer)
Ex 17.7.2 $\ds\ddot y+y=e^{2t}$ (answer)
Ex 17.7.3 $\ds\ddot y+4y=\sec x$ (answer)
Ex 17.7.4 $\ds\ddot y+4y=\tan x$ (answer)
Ex 17.7.5 $\ds\ddot y+\dot y-6y=t^2e^{2t}$ (answer)
Ex 17.7.6 $\ds\ddot y-2\dot y+2y=e^{t}\tan(t)$ (answer)
Ex 17.7.7 $\ds\ddot y-2\dot y+2y=\sin(t)\cos(t)$ (This is rather messy when done by variation of parameters; compare to undetermined coefficients.) (answer)