# The Method of Variation of Parameters

Recall from The Method of Undetermined Coefficients that we could solve a second order linear nonhomogeneous differential equation relatively easy provided that the function $g(t)$ was of the form of a polynomial, exponential function, or cosine/sine function. Unfortunately, the method of undetermined coefficients is much more difficult to apply when $g(t)$ is not of this form. Instead, **The Method of Variation of Parameters** is often times more suitable to use.

Consider a general second order linear nonhomogeneous differential equation whose coefficient functions $p$, $q$, and $g$ are continuous:

(1)The corresponding second order linear homogeneous differential equation is thus $\frac{d^2y}{dt^2} + p(t) \frac{dy}{dt} + q(t) y = 0$. Suppose that we know the general solution to the corresponding second order linear homogeneous differential equation in terms of two functions $y_1(t)$ and $y_2(t)$ which form a fundamental set of solutions to the corresponding second order linear homogeneous differential equation, say $y_h(t) = Cy_1(t) + Dy_2(t)$.

We will now replace the constants $C$ and $D$ with functions, $u_1(t)$ and $u_2(t)$ to get:

(2)We then want to try and determine what functions $u_1(t)$ and $u_2(t)$ make $Y(t) = u_1(t)y_1(t) + y_2(t)y_2(t)$ a particular solution to our original second order linear nonhomogeneous differential equation. We first differentiate $y$ and apply the product rule where appropriate to get:

(3)Now we will set the terms containing the derivatives of the functions $u_1'(t)$ and $u_2'(t)$ to equal zero, that is $u_1'(t)y_1(t) + u_2'(t)y_2(t) = 0$. Note that this is a rather hefty assumption, however, this assumption is not rash as we're looking only for a particular solution, namely one for which this property holds. We'll see that making this assumption does not lead to any contradictions, and so:

(4)We now differentiate again by applying the product rule where appropriate to get the second derivative of $y$:

(5)We will now plug in $y$, $y'$, and $y''$ into our second order linear nonhomogeneous differential equation to get that:

(6)Now recall that we supposed that $u_1'(t)y_1(t) + u_2'(t)y_2(t) = 0$. To solve for $u_1'(t)$ and $u_2'(t)$, then all we need to do is solve the following system of equations:

(7)Recall that a unique solution exists provided that the determinant $\begin{vmatrix} y_1(t) & y_2(t)\\ y_1'(t) & y_2'(t) \end{vmatrix}$ is nonzero. But this determinant is identically the Wronskian $W(y_1, y_2)$, and it is assumed that this Wronskian is nonzero since $y_1$ and $y_2$ form the general solution of the corresponding second order linear homogeneous differential equation, and so by apply Cramer's rule, the values of $u_1'(t)$ and $u_2'(t)$ are:

(8)We now integrate both sides of each equation above, and for constants $A$ and $B$, we get $u_1(t)$ and $u_2(t)$:

(9)Therefore, a particular solution to our second order linear nonhomogeneous differential equation is:

(10)And finally, the general solution to our differential equation will be:

(11)Note that the method of variation of parameters is useful provided that the general solution to the corresponding second order linear homogeneous differential equation is easy to solve, and provided that the two integrals in the formula above are relatively simply to compute.