# Finding ODE given two solutions

how do I find a first order linear non homogeneous ODE given two solutions?

I need to find a method of finding an equation of the form $$y'+p(x)y=g(x)$$

given the solutions $$y_1(x) , y_2(x)$$

• Really sorry. I thought in a wrong direction. I hope you will forgive my ignorance. Apr 17, 2021 at 16:25
• Now I think if we write y = c1y1(x) + c2y2(x), and y' = c1y1'(x) + c2y2'(x) which are all functions in x. We find p(x) such that y1'(x) = -p(x)y1(x), and then now the equation becomes (c1y1'(x) + c2y2'(x)) + (p(x)c1y1(x) + p(x)c2y2(x)) = g(x), but the terms c1y1'(x) and p(x)c1y1(x) get cancelled, and g(x) is just the remaining terms on left hand side c2y2'(x) + c2p(x)y2(x). Apr 17, 2021 at 16:37
• Look at the second part of this answer math.stackexchange.com/a/3343315/399263
– zwim
Apr 17, 2021 at 18:23

By assumption, you have $$y_1' + py_1 = g \\ y_2' + p y_2 = g \\$$ which is equivalent to $$\begin{bmatrix} y_1 & - 1 \\ y_2 & -1 \end{bmatrix} \begin{bmatrix} p \\ g \end{bmatrix} = -\begin{bmatrix} y_1' \\ y_2' \end{bmatrix}.$$ This system of equations can be easily inverted to find $$p$$ and $$g$$.