**Proof plan.** Since $Y_1(x)$ and $Y_2(x)$ form a basis for the two-dimensional phase space at each $x$, we can write $Y_p(x) = u(x)Y_1(x) + v(x)Y_2(x)$ for [functions](/page/Function) $u, v$ to be determined. Matching both components of this vector equation, plus requiring compatibility of the first and second components, yields a $2 \times 2$ linear system for $u'$ and $v'$ involving the Wronskian. Solving this system and integrating gives the formula.
**Step 1: Ansatz and compatibility.**
Write $y_p = u(x)y_1 + v(x)y_2$. Differentiating:
\begin{align*}
y_p' = u'y_1 + uy_1' + v'y_2 + vy_2'.
\end{align*}
Impose the constraint $u'y_1 + v'y_2 = 0$ so that $y_p' = uy_1' + vy_2'$ (this is the compatibility condition ensuring the second component of the solution vector matches).
**Step 2: Substitute into the ODE.**
Differentiating again: $y_p'' = uy_1'' + u'y_1' + vy_2'' + v'y_2'$. Substituting into $y'' + py' + qy = f$:
\begin{align*}
u(y_1'' + py_1' + qy_1) + v(y_2'' + py_2' + qy_2) + u'y_1' + v'y_2' = f(x).
\end{align*}
Since $y_1$ and $y_2$ are complementary functions, the bracketed expressions vanish, leaving:
\begin{align*}
u'y_1' + v'y_2' = f(x).
\end{align*}
**Step 3: Solve the linear system.**
Combining with the constraint from Step 1:
\begin{align*}
\begin{pmatrix} y_1 & y_2 \\ y_1' & y_2' \end{pmatrix} \begin{pmatrix} u' \\ v' \end{pmatrix} = \begin{pmatrix} 0 \\ f \end{pmatrix}.
\end{align*}
The determinant of the coefficient matrix is the Wronskian $W = y_1 y_2' - y_2 y_1'$, which is non-zero by [Abel's Theorem](/theorems/834) (since $y_1, y_2$ are linearly independent). Solving by Cramer's rule:
\begin{align*}
u'(x) = -\frac{y_2(x) f(x)}{W(x)}, \qquad v'(x) = \frac{y_1(x) f(x)}{W(x)}.
\end{align*}
**Step 4: Integrate.**
\begin{align*}
y_p(x) = y_2(x) \int^x \frac{y_1(t) f(t)}{W(t)} \, dt - y_1(x) \int^x \frac{y_2(t) f(t)}{W(t)} \, dt.
\end{align*}
Changing the lower [limits](/page/Limit) of [integration](/page/Integral) simply adds a multiple of a complementary function, so $y_p$ remains a particular integral regardless of the choice of lower limit.