The general idea here follows the same idea as variation of parameters for first-order linear equations, described in
Subsection 2.6.3. Let
\(L\) be the second order operator
\begin{equation*}
L = \frac{d^2}{dt^2} +P \frac{d}{dt} + Q\text{.}
\end{equation*}
Let \(y_1\) and \(y_2\) be solutions to the homogeneous equation \(Ly=0\text{.}\) The general solution to the homogeneous equation is \(Ay_1 + By_2\text{.}\) The parameters are the constant \(A\) and \(B\text{.}\) To ‘vary the parameters’ is to replace the constants with functions. That is, I look for a solution which has the form
\begin{equation*}
y_p = u_1 y_1 + u_2 y_2
\end{equation*}
where \(u_1(t)\) and \(u_2(t)\) are unknown functions instead of unknown constant. Then I put this form of \(y_p\) into the differential equation to try to determine what the unknown functions might be. A long and tedious calculation ensues. In this calculation, I calculate the derivative of \(y_p\text{,}\) put them in the differential equation, and then rearrange and group terms for the steps that will follow.
\begin{align*}
y^\prime _p \amp = u_1^\prime y_1 + u_1 y_1^\prime +
u_2^\prime y_2 + u_2 y_2^\prime \\
y^{\prime \prime}_p \amp = u_1^{\prime \prime} y_1 + 2 u_1^\prime
y_1^\prime + u_1 y_1^{\prime \prime} + u_2^{\prime \prime}
y_2 + 2 u_2^\prime y_2^\prime + u_2 y_2^{\prime \prime} \\
Ly_p \amp = u_1^{\prime \prime} y_1 + 2 u_1^\prime
y_1^\prime + u_1 y_1^{\prime \prime} + u_2^{\prime \prime}
y_2 + 2 u_2^\prime y_2^\prime + u_2 y_2^{\prime \prime} \\
\amp + P \left( u_1^\prime y_1 + u_1 y_1^\prime + u_2^\prime
y_2 + u_2 y_2^\prime \right) Q \left( u_1 y_1 + u_2 y_2
\right) = f\\
\amp = u_1 \left( y_1^{\prime \prime} + Py_1^\prime + Q y_1
\right) + u_2 \left( y_2^{\prime \prime} + Py_2^\prime + Q
y_2 \right) + (y_1 u_1^{\prime \prime} + u_1^\prime
y_1^\prime) \\
\amp + (y_2 u_2^{\prime \prime} + u_2^\prime y_2^\prime)
+ P \left( y_1 u_1^\prime + y_2 u_2^\prime \right) +
y_1^\prime u_1^\prime + y_2^\prime u_2^\prime = f
\end{align*}
The first two terms in brackets are precisely the differential operators applied to the two homogeneous solutions. I can make that replacement. But, by definition, the homogeneous solutions are sent to zero by the differential operator, so both of those terms vanish.
\begin{align*}
\amp = u_1 (L y_1) + u_2 (L y_2) + \frac{d}{dt} \left( y_1
u_1^\prime \right) + \frac{d}{dt} \left( y_2 u_2^\prime
\right) \\
\amp + P \left( y_1 u_1^\prime + y_2 u_2^\prime \right) +
\left( y_1^\prime u_1^\prime + y_2^\prime u_2^\prime \right)
= f\\
\amp = 0 + 0 + \frac{d}{dt} \left(y_1 u_1^\prime + y_2
u_2^\prime \right) + P \left( y_1 u_1^\prime + y_2
u_2^\prime \right) + \left( y_1^\prime u_1^\prime +
y_2^\prime u_2^\prime \right) = f
\end{align*}
The result, so far, is still a complicated differential equations with three terms. I’m trying to determine the two functions \(u_1\) and \(u_2\text{,}\) but I simply don’t have enough information here. What to do? Well, one possible problem might be that the system is underdetermined. I took two entirely unknown functions, \(u_1\) and \(u_2\text{,}\) and only imposed on equation (the differential equation) on them. That might not have anywhere near a unique solution for both functions. If the system is underdetermined, I could try to solve the system by imposing another constraint. I could try any constraint, but I’d like to impose a constraint that makes the system easier to solve. There is a term that shows up twice, in brackets, in the previous equation. What if I simply impose the constraint that sets that term equal to zero: \(y_1 u_1^\prime
+ y_2 u_2^\prime = 0\text{.}\) This restriction removes two terms from the previous equation and leaves me with a much easier equation.
\begin{equation*}
\left( y_1^\prime u_1^\prime + y_2^\prime u_2^\prime \right) =
f
\end{equation*}
Along with the restriction itself , I now have a linear system of two equations.
\begin{align*}
y_1 u_1^\prime + y_2 u_2^\prime \amp = 0\\
y_1^\prime u_1^\prime + y_2^\prime u_2^\prime \amp = f
\end{align*}
I can express this system as a matrix.
\begin{equation*}
\left( \begin{matrix}
0 \\
f
\end{matrix} \right) = \left( \begin{matrix}
y_1 \amp y_2 \\
y_1^\prime \amp y_2^\prime
\end{matrix} \right)
\left( \begin{matrix}
u_1^\prime \\
u_2^\prime
\end{matrix} \right)
\end{equation*}
Linear algebra then solves the system. Conveniently, the determinant of the system is the Wronskian \(W(y_1,y_2)\text{,}\) which I will simply write \(W\) for the remainder of this calculation.
\begin{align*}
u_1^\prime \amp = \frac{-y_2 f}{W}\\
u_2^\prime \amp = \frac{y_1 f}{W}
\end{align*}
The solution of the system of two equations only solves for the derivatives of \(u_1\) and \(u_2\text{.}\) To find the actual functions, I integrate.
\begin{align*}
u_1 \amp = - \int \frac{y_2 f}{W} dt\\
u_2 \amp = \int \frac{y_1 f}{W} dt
\end{align*}
I insert these \(u_i\) in the original expression.
\begin{equation*}
y_p = \left( -\int \frac{y_2 f}{W} dt \right) y_1 + \left(
\int \frac{y_1 f}{W} dt \right) y_2
\end{equation*}
Therefore, the general solution to the original equation \(Ly =
f\) is
\begin{equation*}
y_p = \left( -\int \frac{y_2 f}{W} dx \right) y_1 + \left(
\int \frac{y_1 f}{W} dt \right) y_2 + Ay_1 + By_2\text{.}
\end{equation*}
Conveniently, I don’t have to worry about constants of integration in either of the two integrals. If I had a constant of integration, it would lead to a multiple of one of the homogeneous solutions. Those multiples are already accounted for in the general homogeneous solution.