Given that three solutions to the inhomongenous DE equation y''+p(t)y'+q(t)y=g(t)
are y1=1+e^(t^2), y2= 1+te^(t^2), y3= 1+(t+1)e^(t^2),
find the general solution
Since $\displaystyle y_1$, $\displaystyle y_2$ and $\displaystyle y_3$ all satisfy the ODE then
$\displaystyle u_1 = y_3 - y_2 = e^{t^2}$ and $\displaystyle u_2 = y_3 - y_2 = t e^{t^2}$
satisfy
$\displaystyle u'' + pu' + q u = 0$
Thus, the general solution is
$\displaystyle y = c_1 e^{t^2} + c_2 t e^{t^2} + 1$.
Note that we could have used either $\displaystyle y_1, y_2\; \text{or}\; y_3$ for $\displaystyle y_p$ but can adjust the constants such that all we need is $\displaystyle y_p =1$.
It was to get to the homogeneous ODE
If $\displaystyle y_1$ and $\displaystyle y_2$ satisfy your ODE, i.e.
$\displaystyle y_1'' + py_1' + q y_1 = g$
and
$\displaystyle y_2'' + py_2' + q y_2 = g$
then substracting gives
$\displaystyle (y_2''-y_1'') + p(y_2'-y_1') + q(y_2-y_1) = 0$.