Consider the non-homogeneous linear ODE
\[
y'' + p(x)\,y' + q(x)\,y = r(x).
\]
Let \(y_1(x)\) and \(y_2(x)\) be a fundamental set of solutions of the homogeneous equation
\[
y'' + p(x)\,y' + q(x)\,y = 0.
\]
Then every solution of the homogeneous equation is
\[
y_h(x)=C_1y_1(x)+C_2y_2(x).
\]
Wronskian
The Wronskian of \(y_1,y_2\) is
\[
W(x)=
\begin{vmatrix}
y_1 & y_2\\
y_1' & y_2'
\end{vmatrix}
= y_1y_2' - y_1'y_2.
\]
On intervals where \(W(x)\neq 0\), the pair \(\{y_1,y_2\}\) is linearly independent and forms a valid basis.
Particular solution ansatz
Variation of parameters seeks a particular solution of the form
\[
y_p(x)=u_1(x)y_1(x)+u_2(x)y_2(x),
\]
where \(u_1,u_2\) are unknown functions.
A standard derivation imposes the auxiliary condition
\[
u_1'(x)y_1(x)+u_2'(x)y_2(x)=0,
\]
which simplifies the algebra.
Formulas for \(u_1',u_2'\)
With the above condition, one obtains the classic system
\[
\begin{aligned}
u_1'(x)y_1(x) + u_2'(x)y_2(x) &= 0,\\
u_1'(x)y_1'(x) + u_2'(x)y_2'(x) &= r(x).
\end{aligned}
\]
Solving it gives
\[
u_1'(x) = -\frac{y_2(x)\,r(x)}{W(x)},
\qquad
u_2'(x) = \frac{y_1(x)\,r(x)}{W(x)}.
\]
Integrating to obtain \(u_1,u_2\)
Typically,
\[
u_1(x)=\int u_1'(x)\,dx,\qquad u_2(x)=\int u_2'(x)\,dx,
\]
and then
\[
y_p(x)=u_1(x)y_1(x)+u_2(x)y_2(x).
\]
Any constants from these integrals can be absorbed into \(C_1,C_2\) in the homogeneous part.
Full solution
The general solution of the original ODE is
\[
y(x)=y_h(x)+y_p(x)=C_1y_1(x)+C_2y_2(x)+y_p(x).
\]
If initial conditions \(y(x_0)=y_0\), \(y'(x_0)=v_0\) are given, substitute them to solve for \(C_1,C_2\).
Tip: If \(r(x)\) is a “nice” forcing term and the coefficients are constant, you may compare with the
method of undetermined coefficients. Variation of parameters works more generally but often requires integration.