Retrieving second order ODE from its solutions
We have a second-order constant-coefficient ODE $y'' + py' + qy = g(t)$ with solutions:
$$ t^2 + 1 + e^t\cos t \\ t^2 + 1 + e^t\sin t \\ t^2 + 1 + e^t\cos t + e^t \sin t $$
I know every solution is of form $y(t) = y_p(t) + y_c(t)$ where $y_c(t) = c_1y_1(t) + c_2y_2(t)$ is the solution for the homogenous case and $y_p$ is a particular solution.
I also know that if $y'' + py' + qy = g_1(t)$ has solution $f_1(t)$ and $y'' + py' + qy = g_2(t)$ has solution $f_2(t)$ then $y'' + py' + qy = g_1(t) + g_2(t)$ has solution $f_1(t) + f_2(t)$
My attempt: Since $e^t(\cos t + \sin t)$ appears in the last solution I thought maybe I could somehow show that the auxiliary equation $f(x) = x^2 + px + q = 0$ has complex roots $a + \pm bi$ and gives $y_c = e^{at}(c_1\cos bt + c_2\sin bt)$. (We have $a = b = 1$. In the first solution we just have $c_1 = 1, c_2 = 0$, for the second solution we have $c_1 = 0, c_2 = 1$, and for the third one we have $c_1 = c_2 = 1$) This way we can easily find $p = -2$ and $q = 2$.
Then using the first remark I made, I might be able to show that $g(t) = g_1(t) + g_2(t)$ where $f_1(t) = t^2$ and $f_2(t) = 1$ are solutions to $y'' + py' + q = g_1$ and $y'' + py' + qy = g_2$ respectively. I might then be able to retrieve the coefficients to the equation based on the method of undetermined coefficients and by assuming that $y'' + py' + qy = g_i(t) = C_it^{m_i}e^{r_1t}$ and solving for $C, m, r$.
However, I tried doing this and we can't uniquely determine $g_1(t)$ and $g_2(t)$ this way. For example $C_1$ turns could be anything. Can we actually uniquely determine the differential equation? What are some good ways to approach this problem? Hints would be appreciated. Thanks in advance.
Edit: I just realized that I don't actually need to write $g = g_1 + g_2$. We can directly solve for $g$.
(This problem is problem 48, chapter 4.5 from "Fundamentals of Differential Equations", Nagle.)
Solution 1:
You are almost finished. All that's needed is to use your remark backwards.
Hint:
Step 1: If both $y_1$ and $y_2$ solve $y''+py'+qy=g(t)$, then the function $y_3=y_1-y_2$ solves $y''+py'+qy=0$. With the given three functions you thus have (up to $\pm$) three functions solving the homogeneous equation. Computing the Wronskian of any two of them one can get the general solution $c_1Y_1+c_2Y_2$ to the homogeneous equation (hence also the general solution $c_1Y_1+c_2Y_2+ Y_p$ to the original equation). Note that these expressions for general solutions are not unique, however given any solution to the original equation, some summand in it will have to be included in $Y_p$. It might be a good idea to let $c_1$ and $c_2$ absorb the redundant parts of $Y_p$.
Step 2: Plugging $Y_1$ and $Y_2$ into $y''+py'+qy=0$ gives the values of $p$ and $q$.
Step 3: Plugging in $Y_p$ into $y''+py'+qy=g(t)$ (with $p$ and $q$ known now) gives the function $g(t)$.