Possible solutions to the differential equation
d
y
d
x
=
x
2
−
x
−
2
{\displaystyle \frac{dy}{dx}=x^2-x-2}
represented by a slope field .
An ordinary differential equation or ODE (as opposed to a partial differential equation ) is a type of differential equation that involves a function of only one independent variable . It can simply be defined, for a layman, as any equation that involves any combination of the following:
An independent variable (
x
{\displaystyle x}
)
Functions of the independent variable (or dependent variables) (
g
(
x
)
{\displaystyle g(x)}
)
A primary dependent variable (the function in question) (
y
(
x
)
{\displaystyle y(x)}
)
And, necessarily, any number of and degrees of derivatives of the primary function (
d
y
d
x
,
d
2
y
d
x
2
{\displaystyle {\frac {dy}{dx}},{\frac {d^{2}y}{dx^{2}}}}
)
An example differential equation is as follows:
x
2
y
+
3
d
2
y
d
x
2
−
x
y
d
2
y
d
x
2
=
3
{\displaystyle x^{2}y+3{\frac {d^{2}y}{dx^{2}}}-xy{\frac {d^{2}y}{dx^{2}}}=3}
Methods of solving [ ]
First order [ ]
First order first degree differential equations in the form
d
y
d
x
=
f
(
x
)
{\displaystyle {\frac {dy}{dx}}=f(x)}
Can be solved with direct integration.
Separable equations [ ]
Separable equations are the one of the easiest to solve. For any ODE in the form
d
y
d
x
=
f
(
x
)
g
(
y
)
{\displaystyle \frac{dy}{dx}=f(x)g(y)}
the solution is
∫
d
y
g
(
y
)
=
∫
f
(
x
)
d
x
{\displaystyle \int {\frac {dy}{g(y)}}=\int f(x)dx}
General linear equations [ ]
For linear equations in the form
d
y
d
x
+
f
(
x
)
y
=
g
(
x
)
{\displaystyle \frac{dy}{dx} + f(x)y = g(x)}
,
the solution can be found with the formula
y
=
1
μ
(
∫
μ
g
(
x
)
d
x
+
C
)
,
μ
=
e
∫
f
(
x
)
d
x
{\displaystyle y={\frac {1}{\mu }}\left(\int \mu g(x)dx+C\right),\,\,\mu =e^{\int f(x)dx}}
Bernoulli equations [ ]
Bernoulli differential equations are those in the form
d
y
d
x
+
f
(
x
)
y
=
g
(
x
)
y
n
{\displaystyle {\frac {dy}{dx}}+f(x)y=g(x)y^{n}}
,
They can be solved by transforming them into linear differential equations by substituting.
Exact equations [ ]
Exact differential equations are those in the form
m
(
x
,
y
)
d
x
+
n
(
x
,
y
)
d
y
=
0
if
∂
∂
y
m
(
x
,
y
)
=
∂
∂
x
n
(
x
,
y
)
{\displaystyle m(x,y)dx+n(x,y)dy=0\,\,{\text{if}}\,\,{\frac {\partial }{\partial y}}m(x,y)={\frac {\partial }{\partial x}}n(x,y)}
and will have the solution
∫
m
(
x
,
y
)
d
x
+
∫
n
(
x
,
y
)
d
y
=
C
{\displaystyle \int m(x,y)dx+\int n(x,y)dy=C}
Systems of differential equations [ ]
By viewing the matrix A as a linear transformation , one can create a vector field called the phase portrait based on the mapping from x (the vector representing a given point) to x' , similarly to a slope field . This particular phase portrait is based on the equation
d
2
y
d
t
2
+
(
y
2
−
1
)
d
y
d
t
+
y
=
0.
{\displaystyle {\tfrac {d^{2}y}{dt^{2}}}+(y^{2}-1){\tfrac {dy}{dt}}+y=0.}
A system of ODEs in the form
[
x
1
′
⋮
x
n
′
]
=
[
C
11
⋯
C
1
n
⋮
⋱
⋮
C
n
1
⋯
C
n
n
]
[
x
1
⋮
x
n
]
{\displaystyle {\begin{bmatrix}x'_{1}\\\vdots \\x'_{n}\end{bmatrix}}={\begin{bmatrix}C_{11}&\cdots &C_{1n}\\\vdots &\ddots &\vdots \\C_{n1}&\cdots &C_{nn}\end{bmatrix}}{\begin{bmatrix}x_{1}\\\vdots \\x_{n}\end{bmatrix}}}
or, in more compact notation,
x
→
′
=
A
x
→
{\displaystyle {\vec {x}}'=A{\vec {x}}}
the general solution will be
x
→
=
C
1
v
→
1
e
λ
1
t
+
⋯
+
C
n
v
→
n
e
λ
n
t
{\displaystyle {\vec {x}}=C_{1}{\vec {v}}_{1}e^{\lambda _{1}t}+\cdots +C_{n}{\vec {v}}_{n}e^{\lambda _{n}t}}
where
v
→
{\displaystyle \vec{v}}
and
λ
{\displaystyle \lambda}
represent the eigenvectors and eigenvalues of A , respectively.
Higher order differential equations can be converted into such a system by making the substitution
x
n
=
y
(
n
)
(
t
)
{\displaystyle x_{n}=y^{(n)}(t)}
differentiating, and substituting variables from the original equation for derivatives of y to yield a system of first order ODEs. For example:
y
″
−
2
y
′
+
y
=
0
{\displaystyle y''-2y'+y=0}
We can make the substition
[
x
1
x
2
]
=
[
y
y
′
]
{\displaystyle {\begin{bmatrix}x_{1}\\x_{2}\end{bmatrix}}={\begin{bmatrix}y\\y'\end{bmatrix}}}
[
x
1
x
2
]
′
=
[
y
′
y
″
]
=
[
x
2
2
x
2
−
x
1
]
{\displaystyle {\begin{bmatrix}x_{1}\\x_{2}\end{bmatrix}}'={\begin{bmatrix}y'\\y''\end{bmatrix}}={\begin{bmatrix}x_{2}\\2x_{2}-x_{1}\end{bmatrix}}}
x
→
′
=
[
0
1
2
−
1
]
x
→
{\displaystyle {\vec {x}}'={\begin{bmatrix}0&1\\2&-1\end{bmatrix}}{\vec {x}}}
Higher order equations [ ]
In general, if f(x) and g(x) are both solutions to a differential equation, C1 f(x) + C2 g(x) is also a solution.
Homogenous equations [ ]
a
d
2
y
d
x
2
+
b
d
y
d
x
+
c
y
=
0
{\displaystyle a{\frac {d^{2}y}{dx^{2}}}+b{\frac {dy}{dx}}+cy=0}
Differential equations in this form can be solved by first finding the roots of the auxiliary or characteristic equation, which is equal to
a
r
2
+
b
r
+
c
=
0
{\displaystyle ar^{2}+br+c=0}
The roots may be real or complex . If the roots are
r
1
,
r
2
{\displaystyle r_{1}, r_{2}}
then the general solution will be:
y
=
C
1
e
r
1
x
+
C
2
e
r
2
x
{\displaystyle y=C_{1}e^{r_{1}x}+C_{2}e^{r_{2}x}}
If the characteristic equation has only one solution, the general solution of the ODE will be
y
=
C
1
e
r
x
+
C
2
x
e
r
x
{\displaystyle y=C_{1}e^{rx}+C_{2}xe^{rx}}
If the roots are complex and equal to
a
±
b
i
{\displaystyle a\pm bi}
, by Euler's formula the solution simplifies to
y
=
e
a
x
(
C
1
cos
(
b
x
)
+
C
2
sin
(
b
x
)
)
{\displaystyle y=e^{ax}(C_{1}\cos(bx)+C_{2}\sin(bx))}
The constant of integration is not restricted to real numbers in this case.
Method of undetermined coefficients [ ]
This method is used to find a particular solution for non-homogeneous equations by using a similar function as a potential particular solution YP and adjusting the coefficients. It is especially useful when the forcing term is a polynomial , trigonometric function , or exponential function , however if there is information known about the particular integral required different guesses can be tried.
For example:
y
″
+
3
y
′
−
4
y
=
3
x
2
{\displaystyle y''+3y'-4y=3x^{2}}
Y
p
=
A
x
2
+
B
x
+
C
,
Y
p
′
=
2
A
x
+
B
,
Y
p
″
=
2
A
{\displaystyle Y_{p}=Ax^{2}+Bx+C,\;\;Y'_{p}=2Ax+B,\;\;Y''_{p}=2A}
2
A
+
3
(
2
A
x
+
B
)
−
4
(
A
x
2
+
B
x
+
C
)
=
3
x
2
{\displaystyle 2A+3(2Ax+B)-4(Ax^{2}+Bx+C)=3x^{2}}
This equality now creates a linear system of equations .
−
4
A
=
3
{\displaystyle -4A=3}
6
A
−
4
B
=
0
{\displaystyle 6A-4B=0}
2
A
+
3
B
−
4
C
=
0
{\displaystyle 2A+3B-4C=0}
A
=
−
3
4
,
B
=
−
9
8
,
C
=
−
39
32
{\displaystyle A=-{\frac {3}{4}},\;\;B=-{\frac {9}{8}},\;\;C=-{\frac {39}{32}}}
Y
p
=
−
3
4
x
2
−
9
8
x
−
39
32
{\displaystyle Y_{p}=-{\frac {3}{4}}x^{2}-{\frac {9}{8}}x-{\frac {39}{32}}}
This particular solution, combined with the general solution of the associated homogeneous equation, gives a final general solution of
y
=
C
1
e
−
4
x
+
C
2
e
x
−
3
4
x
2
−
9
8
x
−
39
32
{\displaystyle y=C_{1}e^{-4x}+C_{2}e^{x}-{\frac {3}{4}}x^{2}-{\frac {9}{8}}x-{\frac {39}{32}}}
Real world examples [ ]
Murder case [ ]
Detectives find a murder victim in room with the thermostat set to 20 °C at 4:30 AM. The detectives take a measurement as soon as they arrive and find the body to be 27 °C. An hour later the body is at 25 °C. What time was the victim killed?
This problem can be solved by using Newton's Law of Cooling, which states
d
T
d
t
=
−
k
(
T
−
a
)
{\displaystyle {\frac {dT}{dt}}=-k(T-a)}
T
{\displaystyle T}
is temperature, the dependent variable,
t
{\displaystyle t}
is time, the independent variable,
a
{\displaystyle a}
is the ambient temperature and
k
{\displaystyle k}
is a constant. Since the variables can be separated, we can find the solution using that method.
d
T
d
t
=
−
k
(
T
−
a
)
{\displaystyle {\frac {dT}{dt}}=-k(T-a)}
d
T
(
T
−
a
)
=
−
k
d
t
{\displaystyle {\frac {dT}{(T-a)}}=-kdt}
∫
d
T
(
T
−
a
)
=
∫
−
k
d
t
{\displaystyle \int {\frac {dT}{(T-a)}}=\int -kdt}
ln
(
T
−
a
)
=
−
k
t
+
C
{\displaystyle \ln(T-a)=-kt+C}
T
=
C
e
−
k
t
+
a
{\displaystyle T=Ce^{-kt}+a}
T
=
C
e
−
k
t
+
20
{\displaystyle T=Ce^{-kt}+20}
Firstly, we must find
C
{\displaystyle C}
. We can do this with the initial value
T
(
0
)
=
36.8
{\displaystyle T(0)=36.8}
(human body temperature).
36.8
=
C
e
0
+
20
{\displaystyle 36.8=Ce^{0}+20}
36.8
=
C
+
20
{\displaystyle 36.8=C+20}
C
=
16.8
{\displaystyle C=16.8}
We can now solve for
x
{\displaystyle x}
and
k
{\displaystyle k}
. We will assume that 4:30 is
x
{\displaystyle x}
hours after death.
27
=
16.8
e
−
k
x
+
20
,
25
=
16.8
e
−
k
(
x
+
1
)
+
20
{\displaystyle 27=16.8e^{-kx}+20,25=16.8e^{-k(x+1)}+20}
k
=
−
ln
(
7
16.8
)
x
=
0.875
x
,
k
=
−
ln
(
5
16.8
)
x
+
1
=
1.212
x
+
1
{\displaystyle k=-{\frac {\ln({\frac {7}{16.8}})}{x}}={\frac {0.875}{x}},k=-{\frac {\ln({\frac {5}{16.8}})}{x+1}}={\frac {1.212}{x+1}}}
0.875
x
=
1.212
x
+
1
{\displaystyle {\frac {0.875}{x}}={\frac {1.212}{x+1}}}
x
=
2.597
{\displaystyle x=2.597}
The murder took place 2.597 hours ago, or at 1:56 AM. We can also find
k
{\displaystyle k}
and find our final solution, although this is unnecessary as far as the detectives are concerned since we already know the time of death.
27
=
16.8
e
−
2.597
k
+
20
{\displaystyle 27=16.8e^{-2.597k}+20}
k
=
0.875
x
=
0.875
2.597
=
0.337
{\displaystyle k={\frac {0.875}{x}}={\frac {0.875}{2.597}}=0.337}
T
=
16.8
e
−
0.337
t
+
20
{\displaystyle T=16.8e^{-0.337t}+20}
Radioactive decay [ ]
Polunium-208 has a half life of 2.898 years. If the original sample was 10 grams, how much will remain after 1 year?
We can set this up as a differential equation, with
A
{\displaystyle A}
as the amount,
t
{\displaystyle t}
as time, and
k
{\displaystyle k}
as a constant.
d
A
d
t
=
k
A
{\displaystyle {\frac {dA}{dt}}=kA}
This is a separable differential equation, and can be solved to give
ln
(
A
)
=
k
t
+
C
{\displaystyle \ln(A)=kt+C}
A
=
C
e
k
t
{\displaystyle A=Ce^{kt}}
Since we have the initial value
A
(
0
)
=
10
{\displaystyle A(0)=10}
, we can find C.
10
=
C
e
k
0
=
C
e
0
=
C
{\displaystyle 10=Ce^{k0}=Ce^{0}=C}
A
=
10
e
k
t
{\displaystyle A=10e^{kt}}
k
{\displaystyle k}
can be found since we know that after 2.898 years there will be 5 grams.
5
=
10
e
2.898
k
{\displaystyle 5=10e^{2.898k}}
k
=
ln
(
1
2
)
2.898
=
−
0.239
{\displaystyle k={\frac {\ln({\frac {1}{2}})}{2.898}}=-0.239}
We know have a complete formula, which we can use to calculate out answer.
A
=
10
e
−
0.239
t
{\displaystyle A=10e^{-0.239t}}
A
(
1
)
=
10
e
−
0.239
=
10
(
0.787
)
=
7.87
{\displaystyle A(1)=10e^{-0.239}=10(0.787)=7.87}
Our amount of Polunium-208 after 1 year is 7.87 grams.
Simple harmonic motion [ ]
A system which obeys Hooke's law , or
F
=
−
k
x
{\displaystyle F = -kx}
can be rewritten as a second-order differential equation.
Using Newton's 2nd Law,
∑
F
=
m
a
{\displaystyle \sum F=ma}
⟹
F
=
−
k
x
=
m
d
2
x
d
t
2
{\displaystyle \implies F=-kx=m{\frac {d^{2}x}{dt^{2}}}}
d
2
x
d
t
2
+
k
m
x
=
0
{\displaystyle \frac{d^2 x}{dt^2} + \frac{k}{m} x = 0}
This equation will have the characteristic equation
r
2
+
k
m
=
0
{\displaystyle r^2 + \frac{k}{m} = 0}
r
=
±
−
k
m
=
±
k
m
i
=
±
ω
i
{\displaystyle r = \pm \sqrt{-\tfrac{k}{m}} = \pm \sqrt{\tfrac{k}{m}} i = \pm \omega i}
The solution to the differential equation is
x
(
t
)
=
C
1
e
r
1
t
+
C
2
e
r
2
t
=
C
1
e
ω
i
t
+
C
2
e
−
ω
i
t
{\displaystyle x(t) = C_1 e^{r_1 t} + C_2 e^{r_2 t} = C_1 e^{\omega i t} + C_2 e^{-\omega i t}}
By using Euler's formula this can be written in the form
x
(
t
)
=
C
1
(
cos
(
ω
t
)
+
i
sin
(
ω
t
)
)
+
C
2
(
cos
(
ω
t
)
−
i
sin
(
ω
t
)
)
{\displaystyle x(t) = C_1 (\cos (\omega t) + i \sin(\omega t)) + C_2 (\cos (\omega t) - i \sin(\omega t))}
x
(
t
)
=
(
C
1
+
C
2
)
cos
(
ω
t
)
+
(
C
1
−
C
2
)
sin
(
ω
t
)
{\displaystyle x(t) = (C_1 + C_2) \cos (\omega t) + (C_1 - C_2) \sin (\omega t)}
x
(
t
)
=
C
3
cos
(
ω
t
)
+
C
4
sin
(
ω
t
)
{\displaystyle x(t) = C_3 \cos (\omega t) + C_4 \sin (\omega t)}
which, by trigonometric identities , can be written as
x
(
t
)
=
A
cos
(
ω
t
−
φ
)
{\displaystyle x(t) = A \cos (\omega t - \varphi)}
where
A
=
C
3
2
+
C
4
2
{\displaystyle A = \sqrt{C_3^{ \ 2} + C_4^{ \ 2}}}
and
tan
φ
=
C
4
C
3
{\displaystyle \tan \varphi = \tfrac{C_4}{C_3}}
. Systems which follow this equation are said to exhibit simple harmonic motion .