# Finding an ODE given some of its solutions

Find $a, b, f(x)$ such that $$y''+ay'+by = f(x)$$ Is satisfied by $g_{1}=\sin x + e^x$ and $g_{2}=\sin x - e^{-x}$

What I tried to do:

First, I used the fact that if $g_{1}$ and $g_{2}$ are solutions for the nonhomogeneous ODE, than $g_{1}-g_{2}$ is a solution for the homogeneous correspondent ODE. So, $g = e^x + e^{-x}$ is a solution of $y''+ay'+b=0$. On the other hand, if I had $y''+ay'+b=0$ and the discriminant $d = a^2-4b>0$, I would have solutions of the form: $$c_{1}e^{r_{1}x} + c_{1}e^{r_{2}x}$$, where $r_{1}$ and $r_{2}$ are solutions of $$r^2+ar+b=0$$ As in my case I have $r_{1} = 1$ and $r_{2} = -1$, the quadratic equation gives $a=0$ and $b= -1$.

I don't know how to find the function (or the functions) $f$ such that $$y''-y = f(x)$$ I was thinking about putting $y = \sin x$, as $\sin x$ appears in both the particular solutions $g_{1}$ and $g_{2}$ (that is, I expected that sine was a particular solution for the nonhomegeneous equation). I'm I doing this right? Does someone has a suggestion on how I could improve it?

I would just plug in the solutions to see what the equation looks like $$g_1'' + ag_1' + bg_1 = (b-1)\sin x + a\cos x + (a+b+1)e^x = f(x)$$ $$g_2'' + ag_2' + bg_2 = (b-1)\sin x + a\cos x + (a-b-1)e^{-x} = f(x)$$
This means \begin{align} f(x) &= (b-1)\sin x + a\cos x + (a+b+1)e^x \\&= (b-1)\sin x + a\cos x + (a-b-1)e^{-x} \end{align}
Since $f(x)$ can't both have $e^x$ and $e^{-x}$ terms, they have to both be zero. Thus $$\left\{ \begin{matrix} a+b+1 = 0 \\a-b-1=0 \end{matrix} \right.$$
This gives $a=0$, $b=-1$ and $f(x) = -2\sin x$
Just compute $y''-y$ for your given solutions. I.e., you certainly want $g_1''(x)-g_1(x)=f(x)$ to hold.