# Finding the general solution of a non-homogeneous differential equation when three of its solutions are given

I've been given three solutions of a non-homogeneous differential equation: $$y_1(x)=1+e^{x^2},\;y_2(x)=1+xe^{x^2},\;y_3(x)=(1+x)e^{x^2}-1$$

I'm supposed to find the general solution of that differential equation. $[y''+p(x)y'+q(x)=r(x)]$

Now, $y_4=y_3-y_1$ and $y_5=y_3-y_2$ would give me solutions of the corresponding homogeneous differential equation. $[y''+p(x)y'+q(x)=0]$

So, I write the general solution of the homogeneous equation as $y=c_1y_4+c_2y_5$, and then proceed to differentiate the solution twice to remove $c_1$ and $c_2$. I hope to get the homogeneous equation from there, and then substituting one of the above three given solutions, I can find $r(x)$, and then using 'Variation of Parameters', can find the general solution of the non-homogeneous equation.

Problem is, I get a very ugly equation when I differentiate that general solution twice, in terms of $y_4$, $y_5$ and their derivatives. Substituting actual functions of $y_4$ and $y_5$ only makes it uglier. Cuz I don't see any cancellations happening.

Is there a simpler method?

EDIT: Please tell me if this approach is correct. The solution of homogeneous equation is $y=c_1y_4+c_2y_5$. I can write the solution of non-homogeneous equation as $y=c_1y_4+c_2y_5+y_p$, where $y_p$ is a particular solution of the non-homogeneous equation. The given three solutions act as particular solutions and I can just substitute one of them for $y_p$ and get my general solution.

• What is the differential equation? Commented Apr 9, 2016 at 9:37
• We are not given the equation. We've to construct it using the solutions. Commented Apr 9, 2016 at 9:38
• After the edit the title of the question no longer corresponds to its essential content. Commented Apr 9, 2016 at 18:16
• Yeah, I'll edit the title too. Commented Apr 12, 2016 at 19:02

Your approach is solid. I'm afraid the expressions you obtain aren't very nice, but that's just the nature of the problem. I would advise though to obtain two equations for $p(x)$ and $q(x)$ by substituting $y_4$ resp. $y_5$, and then solve for $p$ and $q$. For example, assuming my calculations are correct, I obtain $$q(x) = \frac{2 e^{x^2}(2 x^2 -1)}{e^{x^2} -4x(x-1)-2},$$ which isn't very nice, but seems correct.
What you propose in your edit is fine. We don't need to construct the underlying ODE in order to obtain the general solution. You can see it in this way: The solution set ${\cal L}$ is a two-dimensional plane in function space, and you are given three points $y_1$, $y_2$, $y_3$ of this plane.