# Ordinary Differential Equations/Homogenous 1
## Homogeneous Equations of Constant Coefficients

Consider a DE of the form
       $p_{0}(x){\frac {d^{n}y}{dx^{n}}}+\ldots +p_{n-1}(x){\frac {dy}{dx}}+p_{n}(x)y=f(x)$
Constant coefficients refers to the left hand side of a differential equation - the coefficients of all terms of y,(i.e. p$_1$(x), etc) are constants. While this may seem unrealistic, this actually happens frequently in electric circuits and harmonic motion.
"Homogeneous" refers to the right hand side of the equation. If f(x)=0, the equation is homogeneous, if it isn't, it is nonhomogenous. Again, it seems useless but it isn't. And it makes for a much easier to solve problem. We'll deal with nonhomogenous equations later.
So a homogenous equation of constant coefficients is an equation of the form
    ${\frac {d^{n}y}{dx^{n}}}+c_{1}{\frac {d^{n-1}y}{dx^{n-1}}}+c_{2}{\frac {d^{n-2}y}{dx^{n-2}}}+\ldots +c_{n}y=0$
where c$_1$, c$_2$, etc are all constants.

## Second order equations

In order to show how these equations are solved, lets start with the most basic case - a second order equation
       $A{\frac {d^{2}y}{dx^{2}}}+B{\frac {dy}{dx}}+Cy=0$
where A, B, and C are constants.

### The Auxiliary Quadratic

For a DE
       $a{\frac {d^{2}y}{dx^{2}}}+b{\frac {dy}{dx}}+cy=0,$
Make the following substitution:
       $y=e^{mx}\,$
This gives also
       ${\frac {dy}{dx}}=me^{mx}\,$
       ${\frac {d^{2}y}{dx^{2}}}=m^{2}e^{mx}\,$
The DE is now
       $am^{2}e^{mx}+bme^{mx}+ce^{mx}=0\,$
Dividing by $e^{mx}$ gives (note:$e^{mx}$ can never equal zero)
       $am^{2}+bm+c=0\,$
This is the auxiliary quadratic (AQ) of the DE. There are four classes of outcomes to the auxiliary quadratic:
* $b^{2}-4ac>0,\,$, giving two distinct, real, roots.
* $b^{2}-4ac=0,\,$, giving two coincident real, roots.
* $b^{2}-4ac<0,\,$, giving complex roots.
    a: Purely imaginary roots.
    b: Complex-conjugate pair.
The method of solution of the DE depends on the class of AQ.

### Class 1: Distinct, Real Roots

Consider the DE
       ${\frac {d^{2}y}{dx^{2}}}+{\frac {dy}{dx}}-6y=0$
The AQ is
       $m^{2}+m-6=0\,$
       $(m+3)(m-2)=0\,$
This gives us the following roots:
       $m=2,\ m=-3$
Going back to the substitution we made to obtain the AQ, we have
       $y=e^{2x},\ y=e^{-3x}$
as two distinct solutions to the DE. According to the superposition principle, the general solution is therefore
       $y=Ae^{2x}+Be^{-3x}\,$

#### General Solution to Class 1 DEs

    Generalizing, for the Second Order DE
          $a{\frac {d^{2}y}{dx^{2}}}+b{\frac {dy}{dx}}+cy=0$
    with the auxiliary quadratic given by
          $am^{2}+bm+c=0\,$
    with roots α and β, the general solution is
          $y=Ae^{\alpha x}+Be^{\beta x}\,$

### Class 2: Coincident, Real Roots

Consider the DE
       ${\frac {d^{2}y}{dx^{2}}}-4{\frac {dy}{dx}}+4y=0$
The AQ is
       $m^{2}-4m+4=0\,$
       $(m-2)(m-2)=0\,$
so, $e^{2x}\,$ is a solution. However, we cannot have it as both solutions as the factor of two produced will be absorbed into the constant, leaving us with only one constant, and therefore a DE without a full solution.
For the other solution we will use the Method of Reduction of Order. To do so we assume that it is in the form of:
       $y_{2}=u(x)y_{1}=u(x)e^{2x}\,$
At the end we will check if our assumption is correct. We will now substitute this equation and solve for u(x)
       $y_{2}''-4y_{2}'+4y_{2}=0\,$
       $u''(x)e^{2x}+2u'(x)e^{2x}+2u'(x)e^{2x}+4u(x)e^{2x}-4(u'(x)e^{2x}+2u(x)e^{2x})+4u(x)e^{2x}=0\,$
       $u''(x)e^{2x}=0\,$
       $e^{2x}\,$ is always non-zero so the only way the product can equal zero is if:
       $u''(x)=0\,$
Integrating twice offers
       $u(x)=a_{1}x+a_{2}\,$
Therefore
       $y_{2}=(a_{1}x+a_{2})y_{1}\,$
       $y_{2}=(a_{1}x+a_{2})e^{2x}\,$
Our general solution is:
       $y=C_{1}y_{1}+C_{2}y_{2}\,$
       $y=C_{1}e^{2x}+C_{2}(a_{1}x+a_{2})e^{2x}\,$
       $y=(C_{1}+a_{2})e^{2x}+C_{2}a_{1}xe^{2x}\,$
Because each constant is arbitrary we can simply write
       $y=C_{1}e^{2x}+C_{2}xe^{2x}\,$
The Method of Reduction of Order can be used on different equations and u(x) does not always equal x. You can see below that $y=xe^{x}$ is a valid solution.
       $y=xe^{2x}\,$
       ${\frac {dy}{dx}}=2xe^{2x}+e^{2x}=e^{2x}(2x+1)\,$
       ${\frac {d^{2}y}{dx^{2}}}=2e^{2x}+2e^{2x}(2x+1)=e^{2x}(4x+4)\,$
To check substitute these into the original DE:
       $e^{2x}(4x+4)-4e^{2x}(2x+1)+4xe^{2x}=0\,$
       $4xe^{2x}+4e^{2x}-8xe^{2x}-4e^{2x}+4xe^{2x}=0\,$
       $0=0\,$
Therefore, $y=xe^{2x}\,$ is a solution as well.

#### General Solution to Class 2 DEs

    Generalizing, for the Second Order DE
          $a{\frac {d^{2}y}{dx^{2}}}+b{\frac {dy}{dx}}+cy=0$
    with the coincident root α of the AQ, the general solution is
          $y=(A+Bx)e^{\alpha x}\,$

### Class 3a: Purely Imaginary Roots

To have complex roots, the AQ must have a discriminant less than zero, so
       $b^{2}-4ac<0\,$
Also, for the solution to be purely imaginary, the value of b must be exactly zero.
Therefore,
       $4ac>0\,$
This means that a and c have to have the same signs: either a and c are both positive or they are both negative. If we consider our general second-order DE:
       $a{\frac {d^{2}y}{dx^{2}}}+b{\frac {dy}{dx}}+cy=0$
Setting b to zero gives
       $a{\frac {d^{2}y}{dx^{2}}}+cy=0$
Dividing through by a gives
       ${\frac {d^{2}y}{dx^{2}}}+{\frac {c}{a}}y=0$.
Therefore, the y term is always positive, and this can be represented by
       ${\frac {d^{2}y}{dx^{2}}}+\omega ^{2}y=0$.
(I'm using ω here as it is used for simple harmonic motion, which is the primary use of this DE). There are now two paths to the solution of the DE. The first relies on us spotting that we can use the cyclical nature of trig. functions when derived. Substitute the following
       $y=\cos \omega x\,$
       ${\frac {dy}{dx}}=-\omega \sin \omega x\,$
       ${\frac {d^{2}y}{dx^{2}}}=-\omega ^{2}\cos \omega x\,$
And check in our DE:
       ${\frac {d^{2}y}{dx^{2}}}+\omega ^{2}y=-\omega ^{2}\cos \omega x+\omega ^{2}\cos \omega x=0$
This checks out, so $\cos \omega x\,$ is a solution. A similar result holds true for the substitution using $y=\sin \omega x\,$.
Our solutions are therefore
       $y=\cos \omega x\,$
       $y=\sin \omega x\,$
So the general solution is
       $y=A\cos \omega x+B\sin \omega x.\,$
The other method of solving this equation is to use Euler's Formula:
       $e^{\omega ix}=\cos \omega x+i\sin x\,$
    and
       $e^{-\omega ix}=\cos \omega x-i\sin x\,$
From our original DE, we have an AQ of
       $m^{2}+\omega ^{2}=0\,$
giving us roots of
       $m=\pm i\omega \,$
so the general solution, similar to the Class 1 DEs, is
       $y=Ae^{\omega ix}+Be^{-\omega ix}\,$
       $y=A(\cos \omega x+i\sin \omega x)+B(\cos \omega x-i\sin \omega x)\,$
       $y=(A+B)\cos \omega x+i(A-B)\sin \omega x\,$
Since A and B are arbitrary, we can set new constants for convenience, letting our new A equal A+B and our new B equal i(A-B).
Thus we have as our general solution
       $y=A\cos \omega x+B\sin \omega x\,$

#### General Solution to Class 3a DEs

    Generalizing, for the Second Order DE
          ${\frac {d^{2}y}{dx^{2}}}+\omega ^{2}y=0$
    the general solution is
          $y=A\cos \omega x+B\sin \omega x\,$

### Class 3b: Complex Conjugate Roots

Since it is a proven theorem that complex roots of polynomials always occur in conjugate pairs, the only remaining class of AQ is the one with complex conjugates for solutions.
Given that the solutions are complex, we know that in the AQ
       $am^{2}+bm+c=0\,$
       $b^{2}-4ac,<0,\ b\neq 0\,$ (see Class 3a).
The roots of this are in the form
       $(p\pm iq)\,$
The general solution is then
       $y=Ae^{(p+iq)x}+Be^{(p-iq)x}\,$
       $y=e^{px}\left(Ae^{iqx}+Be^{-iqx}\right)\,$
From Euler's Formulas, we can now get
       $y=e^{px}\left(A\left(\cos qx+i\sin qx\right)+B\left(\cos qx-i\sin qx\right)\right)\,$
       $y=e^{px}\left((A+B)\cos qx+i(A-B)\sin qx\right)\,$
As A and B are arbitrary, we can collapse them as in Class 3a, so that we have the general solution
       $y=e^{px}\left(A\cos qx+B\sin qx\right)\,$

#### General Solution to Class 3b DEs

    Generalizing, for the Second Order DE
          $a{\frac {d^{2}y}{dx^{2}}}+b{\frac {dy}{dx}}+cy=0$
    with an AQ with roots
          $m=p\pm iq,$
    The general solution is
          $y=e^{px}\left(A\cos qx+B\sin qx\right)\,$
We have now covered all possible types of homogeneous second-order differential equation, and we didn't even have to integrate anything! We will now have a look at higher order equivalents.

## nth-Order Equations

How do we expand the above to the nth order? Well, the nth order has the same requirements of orders of x as second order equations do. So we still need functions involving $e^{mx}$. There's just 2 major differences. Firstly, we'll have more terms - we won't just be able to plug into the auxiliary quadratic equation to get the roots. Secondly, there are more roots. We'll end up with n roots, so y will be the sum of n equations.

### An Example of a Third-Order Equation

Consider the third-order DE
       ${\frac {d^{3}y}{dx^{3}}}-4{\frac {d^{2}y}{dx^{2}}}-7{\frac {dy}{dx}}+6y=0$.
Find the roots of the auxiliary cubic equation of the form
       $m^{3}-4m^{2}-7m+6=0\,$
       $m=-1,2,3\,$
Our distinct solutions are therefore
       $y=e^{-x},\ e^{2x},\ e^{3x}\,$
This gives us a general solution
       $y=Ae^{-x}+Be^{2x}+Ce^{3x}\,$