## Thursday, June 22, 2017

### Unizor - Ordinary Differential Equations - Linear Equations

Notes to a video lecture on http://www.unizor.com

Linear Ordinary Differential Equations

Standard form of linear ordinary differential equations is
f(x)·y' + g(x)·y + h(x) = 0
As the first step, we can divide all members of this equation by f(x) (assuming it's not identically equal to 0), getting a simpler equation
y'+u(x)·y+v(x) = 0
The suggested solution lies in the substitution y(x)=p(x)·q(x), where p(x) and q(x) are unknown (for now) functions.
Express y'(x) in terms of p(x) and q(x):
y' = p·q'+q·p'
Substitute this into our equation:
p·q'+q·p'+u·p·q+v = 0
Let's simplify this
p(q'+u·q)+q·p'+v = 0
If there are such functions p(x) and q(x) that satisfy conditions
(1) q'+u·q = 0 and
(2) q·p'+v = 0
our job would be finished.
Let's try to find such functions.
From the equation (1) in our pair of equations we derive
q'/q = −u,
which can be converted into
dq(x)/q(x) = −u(x)·dx
that can be solved by integrating:
ln(q(x)) = −u(x)·dx
q(x) = e−∫u(x)·dx
Once q(x) is found, we solve the equation (2) for p(x):
p'(x) = −v(x)/q(x),
which can be integrated to find
p(x) = −v(x)/q(x) dx
and, consequently, y(x)=p(x)·q(x) can be fully determined.
Let's consider a few examples.

Example 1

Solve the following linear differential equation
y' + y + x = 0

Let's look for a solution in a form
y(x)=p(x)·q(x)
Then
y'(x) = p'(x)·q(x)+p(x)·q'(x)
Our equation looks like this now
p'·q+p·q' + p·q + x = 0
Factor out p, getting
p·(q'+q) + (p'·q+x) = 0
We will try to find p(x) and q(x) to separately bring to zero q'+q and p'·q+x.
Let's look for a function q(x) that brings expression q'+q to zero:
q'+q = 0
dq/q = −dx
dq/q = −dx
ln(q) = −x + A
(where A is any constant)
q(x) = B·e−x
(where B=eA, so it represents any positive number)
Next, let's find a solution to
p'·q+x = 0
p'·B·e−x+x = 0
p(x) = −(1/B)·x·exdx
This integral can be found using the "by parts" technique:
p(x) = −(1/B)·(x·exexdx) =
= −(1/B)·(x·ex−ex−C) =
= −(1/B)·(x−1)·ex+C/B

(where B is any positive constant and C is any constants)
Now let's find y(x)=p(x)·q(x):
y(x) = [−(1/B)·(x−1)·ex+C/B]·[B·e−x] =
1−x+C·e-x

Checking:
y'(x) = −1 − C·e-x
y'+y+x = −1 − C·e-x+1−x+C·e-x+x = 0
Solution was correct.

Example 2

Solve the following linear differential equation
y'·cos(x) + y·sin(x) − 1 = 0

First of all, let's normalize it by dividing by cos(x), noticing that sin(x)/cos(x)=tan(x) and 1/cos(x)=sec(x):
y' + y·tan(x) − sec(x) = 0
Let's look for a solution to this equation in a form
y(x)=p(x)·q(x)
Then
y'(x) = p'(x)·q(x)+p(x)·q'(x)
Our equation looks like this now:
p'·q+p·q'+p·q·tan(x)−sec(x) = 0
Factor out p, getting
p·(q'+q·tan(x))+p'·q−sec(x) = 0
First, let's find function q(x) such that
q' + q·tan(x) = 0
It can be solved using the technique of separation:
dq/q = −tan(x)dx
Since [ln(x)]' = 1/x and [cos(x)]' = −sin(x), the last equation can be transformed into
d(ln(q)) = d(cos(x))/cos(x)
d(ln(q)) = d(ln(cos(x)))
Now it's easy to integrate, the result is
ln(q) = ln(cos(x))+C
where C - any real number, from which, raising number e to both left and right sides, follows that
q = D·cos(x)
(new constant D=eC represents any positive number)
Now let's find function p(x) such that
p'·q − sec(x) = 0
Substitute already found q(x) getting
p'·D·cos(x) − sec(x) = 0
p'(x) = (1/D)·(1/cos²(x))
p(x) = (1/D)·dx/cos²(x) =
= (1/D)·
[tan(x) + E]
where D and E are constants (D - any positive, E - any real)
Let's determine y=p·q now.
y(x) = p(x)·q(x) =
= (1/D)·
[tan(x) + E]·D·cos(x) =
= sin(x) + E·cos(x)

Let's check this result.
y'(x) = cos(x)−E·sin(x)
y'·cos(x) + y·sin(x) − 1 =
= cos²(x)−E·sin(x)·cos(x) + sin²(x)+E·cos(x)·sin(x)−1 =
= sin²(x) + cos²(x) −1 = 0

which proves the correctness of our answer.

Example 3

Solve the following differential equation
ln(x·y'+y) = ln(2x)+x²

It's not linear, but can be made linear if we raise e to a power defined by its left and right sides, getting
x·y'+y = 2x·e
Let's normalize it by dividing by x:
y' + y/x = 2e
Now it's a linear equation that we know how to solve.
Let's look for a solution in a form
y(x)=p(x)·q(x)
Then
y'(x) = p'(x)·q(x)+p(x)·q'(x)
Our equation looks like this now
p'·q+p·q' + p·q/x = 2e
Factor out p, getting
p·(q'+q/x) + p'·q = 2e
We will try to find p(x) and q(x) to separately
(a) bring to zero q'+q/x and
(b) equalize p'·q with 2e.
Let's solve equation (a) and look for a function q(x) that brings expression q'+q/x to zero:
q'+q/x = 0
dq/q = −dx/x
dq/q = −dx/x
ln(|q|) = −ln(|x|) + A
where A - any constant.
Raising e to both sides of this equation, we get
|q| = B/|x|
where B=eA - any positive number.
Let's get rid of absolute values in the above equation by allowing B to be any non-zero real number, so
q = B/x
Substitute it to equation (b):
p'·B/x = 2e
p(x) = (1/B)2x·e·dx
Since derivative of  is 2x,
p(x) = (1/B)e·d(x²)
Now we can integrate directly:
p(x) = (1/B)e + C
where C is any real number.
This allows to express the solution to our differential equation in the form
y(x) = p(x)·q(x)
where
p(x) = (1/B)e + C and
q(x) = B/x
That produces
y = e/x + C/x = (e+C)/x
where C - any real number.

Checking:
y' = −(e+C)/x² + e·2x/x =
= e·(2−1/x²) −C/x²

y/x = e/x² + C/x²
y' + y/x = 2e,
which corresponds to the original equation after multiplying both sides by x and taking logarithm.
The end.