Linear independence in differential equations

I'm currently taking linear algebra and differential equations class simultaneously. However, its not clear to me that why we need 2 linearly independent solutions for 2nd order linear equations. If it was 3rd order, would it be 3 and why? Like is it 2 dimensional when it becomes 2nd order?

$$ay''+by'+cy=f(x)$$

Also, didn't get the reason behind solving for nonhomogenous functions, why do we only add 1 solution of nonhomogenous to the homogenous solutions in order to get the general solution? . And is this limited with linear DE's?

One could dive into theory here, but I will choose the approach of using a simple example, and then claiming that things generalise neatly. Mostly they do.

Let's take the simplest non-trivial, linear, homogenous, degree-$$n$$ differential equation there is: $$\frac{d^ny}{dx^n}=0$$ I am pretty certain you can see the solutions to this equation immediately: All the polynomials of degree strictly less than $$n$$. For a fixed $$n$$, how many linearly independent solutions can we pick? It's pretty easy to see that the answer is $$n$$: $$1,x, x^2,\ldots, x^{n-1}$$ So yes, usually a degree-$$n$$ differential equation will have an $$n$$-dimensional solution space.

What happens in the inhomogeneous case? Let's inhomogenize our example equation in the simplest way possible: $$\frac{d^ny}{dx^n}=n!$$ (I could've picked $${}=1$$ here, but the solutions would be uglier.) How do we solve this? Well, one solution is clearly $$y=x^n$$. Now let $$y_0$$ be an arbitrary solution, and consider $$y_1=y_0-x^n$$. We know that $$\frac{d^ny_0}{dx^n}=n!$$, what about $$y_1$$? We insert and get $$\frac{d^ny_1}{dx^n}=\frac{d^n(y_0-x^n)}{dx^n}=n! - n!=0$$ If $$y_0$$ is a solution to the inhomogenous equation, then $$y_1$$ is a solution to the homogenous one. And vice versa. So there is a pairing between the solutions of the inhomogenous equation and the homogenous version. That pairing consists of adding / subtracting one inhomogenous solution (it doesn't really matter which one, but you must fix one and use that).

There is a nice parallel in linear algebra. Consider the (regular, algebraic, underdetermined) set of equations $$x+y=1$$. It is linear and inhomogenous. How do you solve it? By finding one inhomogenous solution, then solving the homogenous version $$x+y=0$$. To each of those homogenous solutions you add the one inhomogenous solution you found, and this gives you all the inhomogenous solutions.

And yes, linearity of the involved differential equations is crucial for all of this. It is what ensures that we can add and scale solutions to homogenous equations and still have solutions. Without linearity, this fails. Consider, for instance, the simple but non-linear $$y'+y^2=0$$. Its solutions (apart from the zero function) are given by $$\frac{1}{x-a}$$ (there are complications with the asymptote, but let's ignore those). These solutions clearly aren't scalar multiples of one another, and the sum of two solutions clearly isn't a new solution (unless one of them is the zero function). Anything linear about the relationships between solutions disappear when the equation isn't linear any more.

• About x+y =1, 1 inhomogenous solution is y = 1-x, the solution to the homogenous is y=-x, how do we come up with the general solution 1-x.
– mark
May 6 at 13:24
• @steatoda No. One inhomogenous solution is $x=2, y=-1$. The homogenous solutions are all given by $x=a, y=-a$ for all possible $a$. Thus the inhomogenous solutions are $x=a+2, y=a-1$ for all possible $a$. May 6 at 13:45
• To make it one line, could we say y = 1-x, and for homogenous y = 0 for all and y = 1-x is a solution for inhomogenous, then add them up. Since that's what we do normally on differential equations? But isn't 1-x a multiple solution ? Confusion contunies sorry
– mark
May 6 at 15:48
• @steatoda You seem to be thinking of solving for $y$ in terms of $x$. That's not usually what you do with a set of equations in several unknowns (although it can be a common intermediate step). You find all sets of values for each of the unknowns that satisfy the equations. $x=2,y=-1$ is one such solution. $x=0, y=1$ is another. If you have one solution, how do you find all of them? You do it by finding all the solutions to the homogenous variation and adding the inhomogenous solution to each of them. May 6 at 17:30

Yes, the dimension of the solution space of a homogeneous ordinary linear differential equation of order $$n$$ is indeed $$n.$$ Roughly speaking, the dimension is at least $$n$$, because you can set $$n$$ initial conditions independently of each other. It is at most $$n$$, because those $$n$$ conditions uniquely determine the solution. Both of those facts can be derived e.g. by rewriting the ODE of order $$n$$ as a system of $$n$$ differential equations of order $$1$$ and then apply the Picard-Lindelöf theorem.

Why is it enough to use one single solution of the inhomogeneous system? Assume you had two solutions of the inhomogeneous system, $$y_1$$ and $$y_2,$$ such that $$ay_1''+by_1'+cy_1 = f(x) \\ ay_2''+by_2'+cy_2 = f(x)$$ Then their difference $$y_0=y_2-y_1$$ would obviously be a solution of the homogeneous system: $$ay_0''+by_0'+cy_0 \\ =a\frac{d^2}{dx^2}(y_2-y_1)+b\frac{d}{dx}(y_2-y_1)+c(y_2-y_1) \\ =ay_2''-ay_1''+by_2'-by_1'+cy_2-cy_1 \\ = \left(ay_2''+by_2'+cy_2\right)-\left(ay_1''+by_1'+cy_1\right) \\ = f(x) - f(x) = 0$$ This means that $$y_2$$ could have been written as $$y_0+y_1$$ in the first place. Therefore, it is enough to consider one solution of the inhomogeneous system.

For an example of a non-linear ODE that does not work with vector spaces, see for example Arthur's answer.