# Method of Solution

To find the solution of the linear homogeneous differential equation wiith constant coefficients `y^((n))+a_(n-1)y^((n-1))+...+a_2y''+a_1y'+a_0=0`, we assume that the solution has the form `y(x)=e^(rx)`.

Plugging this slution into the equation and noting that `y^((n))=r^n e^(rx)` gives

`r^n e^(rx)+a_(n-1) r^(n-1) e^(rx)+...+a_2 r^2e^(rx)+a_1re^(rx)+a_0e^(rx)=0`, or

`r^n+a_(n-1) r^(n-1) +...+a_2 r^2+a_1r+a_0=0`.

This is called the characteristic equation of the differential equation. Solving it, we will find `n` solutions `r_1,r_2,...,r_n`; so, the solutions to the homogeneous equation are `y_1(x)=e^(r_1x),\ y_2(x)=e^(r_2x),\ ...,\ y_n(x)=e^(r_nx)`.

Depending on the roots of the characteristic equation, there are different general solutions.

**Case 1. **The roots are distinct and real. In this case, `y_1(x)=e^(r_1x),\ y_2(x)=e^(r_2x),\ ...,\ y_n(x)=e^(r_nx)` are all different and thus linearly independent (exponents with different powers are linearly independent); so, the solution can be written as `y=c_1e^(r_1x)+c_2e^(r_2x)+...+c_n e^(r_n x)`.

**Example 1.** Solve `y'''-6y''+11y'-6y=0`.

The characteristic equation is `r^3-6r^2+11r-6=0`, which can be factored into `(r-1)(r-2)(r-3)=0`. The roots are `r_1=1`, `r_2=2`, `r_3=3`. They are real and distinct; so, the general solution is `y_h=c_1 e^x+c_2 e^(2x)+c_3 e^(3x)`.

**Case 2. **The roots are complex. Since the coefficients in the differential equation are assumed to be real, there is a complex root `a+bi` and the corresponding complex conjugate `a-bi`. For this pair of roots, the part of the solution is given by `d_1e^((a+bi)x)+d_2e^((a-bi)x)`.

Now, using Euler's formula we can write that `e^((a+bi)x)=e^(ax)e^(bix)=e^(ax)(cos(bx)+isin(bx))` and `e^((a-bi)x)=e^(ax)e^(-bix)=e^(ax)(cos(bx)-isin(b(x))`.

So, `d_1e^((a+bi)x)+d_2e^((a-bi)x)=(d_1+d_2)e^(ax)cos(bx)+(d_1-d_2)ie^(ax)sin(bx)`.

Taking `c_1=d_1+d_2` and `c_2=(d_1-d_2)i`, we can write the solution as `c_1e^(ax)cos(bx)+c_2e^(ax)sin(bx)`.

**Example 2.** Solve `y''+2y'+5y=0`.

The characteristic equation is `r^2+2r+5=0`. This equation has the roots `r_1=-1-2i` and `r_2=-1+2i`; so, the general solution is

`y=c_1 e^(-x)cos(2x)+c_2 e^(-x)sin(2x)`.

**Case 3. **Some roots of the multiplicity `p>1` (if the root `r_k` is of the multiplicity `p`, we have that`(r-r_k)^p` is a factor of the characteristic equation, but `(r-r_k)^(p+1)` is not). In this case, some solutions are the same and, therefore, are not linearly independent. Here, the solutions are `y_1=e^(r_k x)`, `y_2=xe^(r_k x)`, ...,`y_p=x^(p-1)e^(r_k x)`.

**Example 3.** Solve `y'''+3y''+3y'+y=0`.

The characteristic equation is `r^3+3r^2+3r+1=0` or `(r+1)^3=0`. So, the roots are `r_1=-1`, `r_2=-1`, `r_3=-1`.

Here, one root is of the multiplicity 3; so, the general solution is `y=c_1 e^(-x)+c_2 xe^(-x)+c_3 x^2 e^(-x)`.

Now, let's do some more work.

**Example 4.** Solve `y''''+2y''+y=0`.

The characteristic equation is `r^4+2r^2+1=0`, or `(r^2+1)^2=0`. So, here are the complex roots of the multiplicity 2: `r_1=i`,`r_2=-i`, `r_3=i`, `r_4=-i`.

So, the general solution is `y=c_1cos(x)+c_2sin(x)+c_3xcos(x)+c_4xsin(x)`.

Note that in general, there will be some roots of multiplicity more than one, some roots are complex, and some are real and distinct. In this case, we just combine the corresponding solutions.

**Example 5.** Solve `y^((6))-3y^((5))-3y^((4))+25y'''-46y''+38y'-12y=0`.

The characteristic equation is `r^6-3r^5-3r^4+25r^3-46r^2+38r-12=0`. It has the roots `r_1=1+i`, `r_2=1-i`, `r_3=2`, `r_4=-3`, `r_5=1`, `r_6=1`.

There are a pair of complex roots, 2 distinct roots and one root of multiplicity 2; so, the general solution is `y=c_1 e^x cos(x)+c_2 e^x sin(x)+c_3e^(2x)+c_4e^(-3x)+c_5e^x+c_6 xe^x`.

In theory, it is always possible to factor the characteristic equation, but in practice this can be extremely difficult, especially for differential equations of higher order. In such cases, one often has to use numerical techniques to approximate the solutions.

** Warning:** A characteristic equation is valid only for a linear differential equation with constant coefficients. Consider, for example, the equation `y''-x^2y=0`. The characteristic equation is `r^2-x^2=0`; it has the roots `r_1=x` and `r_2=-x`, but the solution is not `y=c_1e^((x)x)+c_2e^((-x)x)=c_1e^(x^2)+c_2e^(-x^2)`.