Finding General Solution of Non-Homogeneous Differential Equation

ordinary differential equations

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.

Best Answer

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 \begin{equation} q(x) = \frac{2 e^{x^2}(2 x^2 -1)}{e^{x^2} -4x(x-1)-2}, \end{equation} which isn't very nice, but seems correct.

Related Question