Hello it's a me again drifter1! Today we continue with **Mathematics **to talk about **Differential equations** that are **second-order**, **linear **and have **constant coefficients**! Next time we will get into other simple types of 2nd-order ODE's.

So, without further do, let's get straight into it!

## Second-order ODE's

Before getting into the main topic of this post, we might first want to talk about 2nd-order ODE's in general.

An **2nd-order ODE** is of the form:

**y" + P(x, y)y' + Q(x, y)y = R(x)**

The right side is a function of x, cause if it had any y then it would be a part of Q(x, y) in the left side.

### Actually 1st-order

If y=y(x) is not a part of an 2nd-order ODE, then we can solve it as an 1st-order ODE.

By **substituting y' = u** we get a **1-st order ODE with variable u**.

This "new" ODE will be one of the 6 types we covered in my previous posts.

By solving it and finding u we can then find y by finding the integral of u:

**y(x) = integral(u(x)dx) + c**

**For example:**

y" + 5xy' = x^2 + 3

By setting y' = u we get:

u' + 5xu = x^2 + 3 [linear 1st-order ODE]

### Linear second-order ODE's

A linear ODE of any order contains P(x), Q(x) etc. "coefficient functions" of x.

That way a **second-order linear ODE** is of the **form**:

**y" + P(x)y' + Q(x)y = R(x)**

If R(x) = 0 then we get the **homogeneous form**:

**y" + P(x)y' + Q(x)y = 0**

This last one is pretty **important **cause the following **statement **is true:

If **y1(x) and y2(x) are two solutions** of this homogeneous OE then:

* y0 = c1*y1(x) + c2*y2(x)* is the

**general solution**of the homogeneous ODE,

where c1, c2 are real numbers

If the homogeneous is the **corresponding homogeneous** of an 2nd-order linear ODE (by setting R(x) = 0) then we can find the solution of the given ODE by using:

* y = y0 + yp*, where y is the

**general solution**of our 2nd-order linear ODE.

As told before y0 is the general solution of our homogeneous.

The other part (yp) is any solution of the given (non-homogeneous) ODE.

After this introduction let's now get into the main topic of this post.

## Linear second-order ODE's with const coeffs

When **P(x) and Q(x) don't contain x** as an variable **and are real numbers** then we have an linear second-order ODE with constant coefficients.

Note that **R(x) is still a function of x** (it can be 0 or any real number too tho).

So, the **basic form** of such an ODE is:

**ay" + by' + cy = R(x)**

**For example:**

5y" + 3y' -2y = x^2 + e^x

### Solution

To solve such a ODE we first get the** corresponding homogeneous**:

**ay" + by" + cy = 0**

We suppose that **y = e^px is a solution of the homogeneous **(can be proven).

Doing that we get the **characteristic equation**:

**ap^2 + bp + c = 0**

This is a 2nd-order polynomial equation that can be solved very easily.

There are **3 possible outcomes**:

- 2 real solutions: p1, p2 => y1 = e^(p1*x) and y2 = e^(p2*x) solutions of the homogeneous.
- 1 double-solution: p => y1 = e^px and y2 = x*e^px (can be proven) solutions of the homogeneous
- 2 complex solutions: p1, p2 => We use the Euler equation (e^iφ = cosφ + i*sinφ) and get y1= e^(i*x) = cosx, y2 = e^(-i*x) = sinx.

**For example:**

y" - 2y' - 3y = 2cos(x) [given ODE]

y" - 2y' - 3y = 0 [corresponding homogeneous ODE]

p^2 - 2p - 3 = 0 [characteristic equation]

p1 = 3 and p2 = -1 are the 2 real solutions and so:

y1 = e^3x and y2 = e^-x are the solutions of the homogeneous.

The general solutions will be: y0 = c1e^3x + c2e^-x

After that we have to **find one solution of the given ODE**.

There are some **Cases **that depend on the form of R(x):

**1. If R(x) = 0** then yp = 0 and so:

y = y0 = c1*y1 + c2*y2, where c1, c2 reals

**2. If R(x) = e^(k*x) **[**Exponential**], where k a real number

Then we have some **cases that depend on the solutions p1, p2**:

**k != p1, p2**=>**yp = λ*e^(k*x)**and we find λ with substituting in the given ODE.**k = p1 or k = p2**=>**yp = λ*x*e^(k*x)**and we again find λ with substitution.**p is double-solution**=>**yp = λ*x^2*e^(k*x)**and we again find λ.

**3. If R(x) = an*x^n + ... + a1*x + a0** [**Polynomial **of x], where ai reals

Then we have **cases that depend on c**:

**c!=0**=>**yp = bn*x^n + ... + b1*x + b0**, bi reals and we substitute to find those coefficients.**c==0**=>**yp = x*(bn*x^n + ... + b1*x + b0)**, bi reals and we again substitute.

**4. If R(x) = k*cos(n*x) + λ*sin(n*x)** [Trigonometric], where k, l, n are reals

Then we have **cases that depend on the solutions**:

**cos(nx) and sin(nx) ARE NOT solutions of the homogeneous**=>**yp = s*cos(n*x) + t*sin(n*x)**, where s, t are reals and we have to find s, t with substitution.**cos(nx) and sin(nx) ARE solutions of the homogeneous => yp = x*[s*cos(n*x) + t*sin(n*x)]**, where we find s, t with substitution.

**5. If R(x): Combination** of the previous cases

R(x) is of the form:

* R(x) = R1(x) + R2(x) + ... + Rn(x)*, where Ri(x) one of the cases 2-4.

We find the **solution** for each **independently**.

ay" + by' + cy = R1(x) => yp1

ay" + by' + cy = R2(x) => yp2

...

ay" + by' + cy = Rn(x) => ypn

Then we **sum **all of these together:

**yp = yp1 + yp2 + ... + ypn**

**For example:**

R(x) = e^2x - 3x^2 + 4x - 5 + 7cos(3x) - 8sin(3x) [Combination]

We can split it into:

R1(x) = e^2x [Exponential]

R2(x) = -3x^2 + 4x - 5 [Polynomial]

R3(x) = 7cos(3x) - 8sin(3x) [Trigonometric]

For all those cases the **general solution** of our given ODE is then:

**y = y0 + yp**

I will get into practical examples of 2nd-order linear ODE's when we cover the other special forms too (next post).

### Previous posts of the series:

Introduction -> Definition and Applications

First-order part(1) -> Separable, homogeneous and exact 1st-order ODE's

First-order part(2) -> Linear, Bernoulli and Riccati first-order ODE's

First-order exercises -> Exercises for all the 1st-order ODE types

And this is actually it!

Next time we will get into linear 2nd-order ODE's that are of other special forms!

C ya!