I am trying to solve the ODE $\dfrac{d^2 \bar{\phi}}{dx^2} - s \bar{\phi} = \dfrac{\cos(x)}{s}$.
If I am not mistaken, I can solve this using the method of undetermined coefficients.
Solving the homogeneous equation
$$\dfrac{d^2 \bar{\phi}}{dx^2} - s \bar{\phi} = 0,$$
we get the characteristic equation
$$m^2 - s = 0,$$
which gives us
$$m = \pm \sqrt{s}.$$
Therefore, the complementary equation is
$$y_c(x) = Ae^{x\sqrt{s}} + Be^{-x\sqrt{s}}$$
What I'm now confused about is the form of the particular solution. Given that we have $\dfrac{\cos(x)}{s}$, how do I go about solving this?
I would appreciate it if people could please take the time to clarify this.
The equation is in $x$, so you can treat $s$ as a constant. Let the particular solution be
$$ \phi_p(x) = A\cos x + B\sin x $$
Then ${\phi_p}'' = -A\cos x - B\sin x = -(A\cos x + B\sin x)$, therefore
$$ {\phi_p}'' - s\phi_p = -(A\cos x + B\sin x) - s(A\cos x + B\sin x) = -(1+s)(A\cos x + B\sin x) $$
This gives
$$ A = - \frac{1}{s(1+s)}, B = 0 $$