TMV035 Analysis and Linear Algebra B, 2005

LECTURE 4.1

In this lecture we present analytic solution of differential equations. This covers AMBS Ch 35, 38, 39.

Analytic solution of differential equations

0.1. Introduction. In AMBS Ch 40 we construct a unique solution of the general system of ordinary differential equations:

u′(x) = f(x, u(x)), x ∈ [a, b],
u(a) = u_{a}.

This means that all (reasonable) differential equations can be solved. We also have an algorithm for the computation of the solutions. Some of these functions are so important that we give them names. For example,

u′(x) = u(x), x ≥ 0,
u(0) = 1,

the solution is called u(x) = exp(x); and

u′′(x) + u(x) = 0, x ≥ 0,
u(0) = u_{0}, u′(0) = u_{1},

the solution is u(x) = u_{0} cos(x) + u_{1} sin(x).

Sometimes we can express the solution of other initial-value problems as a combination of our elementary functions: polynomials, log, exp, cos, sin. We can only do this in some simple cases, in general we have to solve differential equations approximately on the computer.

We will obtain analytical solution formulas in the following four cases:

(1) linear equation of first order (with constant or variable coefficient);

(2) linear equation of second order with constant coefficients;

(3) systems of linear equations with constant coefficients (in ALA-C);

(4) separable nonlinear equation.

Note that cases 1, 2, 4 are scalar equations (only one equation) while 3 concerns systems of equations. It is important to recognize these types of equations and to know how to solve them.

1. Linear equations

1.1. Linear equation of first order. A linear equation of first order is of the form:

u′ + a(t)u = f(t).

Here u = u(t) is an unknown function of an independent variable t (we write t instead of x because the independent variable is often time). The equation is called homogeneous if f(t) ≡ 0 and nonhomogeneous otherwise. The differential operator Lu = u′ + a(t)u has constant coefficient if a(t) = a is constant and it has variable coefficient otherwise. The equation is said to be a linear equation, because the operator L is a linear operator:

L(αu + βv) = αLu + βLv, (α, β ∈ R, u = u(t), v = v(t))

i.e., it preserves linear combinations of functions. Check this!

Date: November 13, 2005, Stig Larsson, Mathematical Sciences, Chalmers University of Technology.

2 LECTURE 4.1

1.2. Constant coefficient, homogeneous equation.

u′(t) + au = 0, t ≥ 0,

u(0) = u_{0}.

We already know that the unique solution is u(t) = u_{0} exp(−at). 1.3. Variable coefficient, homogeneous equation.

u′(t) + a(t)u = 0, t ≥ 0,

u(0) = u_{0}.

Guess: u(t) = u_{0} exp(b(t)) where b is unknown. The initial condition gives:

u_{0} = u(0) = u_{0} exp(b(0)) ⟹ b(0) = 0.

The differential equation gives:

−a(t)u(t) = u′(t) = u_{0} exp(b(t))b′(t) = u(t)b′(t)

so that b′ = −a. Therefore b is given by b′(t) = −a(t), t ≥ 0,

b(0) = 0.

Fundamental theorem:

b(t) = b(0) − ∫_{0}^{t} a(s) ds = −A(t), A(t) = ∫_{0}^{t} a(s) ds.

Thus:

u(t) = u_{0} exp(−A(t)), A(t) = ∫_{0}^{t} a(s) ds.

1.4. Constant coefficient, inhomogeneous equation.

u′(t) + au = f(t), t ≥ 0,

u(0) = u_{0}.

Multiply by the integrating factor e^{at}:

e^{at}u′(t) + e^{at}au(t) = e^{at}f(t).

The left-hand side is an exact derivative:

\frac{d}{dt}(e^{at}u(t)) = e^{at}u′(t) + e^{at}au(t) = e^{at}f(t),

so we can integrate:

∫_{0}^{T} \frac{d}{dt}(e^{at}u(t)) dt = ∫_{0}^{T} e^{at}f(t) dt

e^{aT} u(T) − e^{a0}u(0) = ∫_{0}^{T} e^{at}f(t) dt e^{aT} u(T) = u_{0} + ∫_{0}^{T} e^{at}f(t) dt u(T) = e^{−aT} u_{0} + ∫_{0}^{T} e^{−a(T −t)}f(t) dt

Finally replace t → s, T → t: u(t) = e^{−at}u_{0} + ∫_{0}^{t} e^{−a(t−s)}f(s) ds (1)

1.5. Variable coefficient, inhomogeneous equation.

u′(t) + a(t)u = f(t), t ≥ 0,
u(0) = u_{0}.

Multiply by the integrating factor e^{A(t)} with the primitive function A(t) = ∫_{0}^{t} a(s) ds:

e^{A(t)}u′(t) + e^{A(t)}a(t)u(t) = e^{A(t)}f(t).

The left-hand side is an exact derivative because De^{A(t)} = e^{A(t)}A′(t) = e^{A(t)}a(t):

\frac{d}{dt}(e^{A(t)}u(t)) = e^{A(t)}u′(t) + e^{A(t)}a(t)u(t) = e^{A(t)}f(t),

so we can integrate:

∫_{0}^{T} \frac{d}{dt}(e^{A(t)}u(t)) dt = ∫_{0}^{T} e^{A(t)}f(t) dt

e^{A(T)}u(T) − e^{A(0)}u(0) = ∫_{0}^{T} e^{A(t)}f(t) dt

e^{A(T)}u(T) = u_{0} + ∫_{0}^{T} e^{A(t)}f(t) dt

u(T) = e^{−A(T)}u_{0} + ∫_{0}^{T} e^{−A(T)+A(t)}f(t) dt

Finally: replace t → s, T → t

u(t) = e^{−A(t)}u_{0} + ∫_{0}^{t} e^{−A(t)+A(s)}f(s) ds

Summary. The linear equation of first order is solved by the method of integrating factor: multiply by the integrating factor e^{A(t)} with A(t) = ∫_{0}^{t} a(s) ds, and integrate.

1.6. Linear differential equation—second order—constant coefficients.

(2)  u′′ + a_{1}u′ + a_{0}u = f(t).

The equation is called homogeneous if f(t) ≡ 0 and nonhomogeneous otherwise. We assume that the differential operator Lu = u′′ + a_{1}u′ + a_{0}u has constant coefficients a_{1} and a_{0}. Check that the operator L is linear!

Variable coefficients: Linear differential equations of second order with variable coefficients u′′ + a_{1}(t)u′ + a_{0}(t)u = f(t), cannot be solved analytically, except in some special cases. One such case can be found in AMBS Ch 35.6. We do not discuss this here.

Homogeneous equation. See AMBS Ch 35.3–35.4. The homogeneous equation (2) may be written

(3)  D^{2}u + a_{1}Du + a_{0}u = 0,

or

P (D)u = 0,

where

P (r) = r^{2} + a_{1}r + a_{0}

is the characteristic polynomial of the equation. The characteristic equation P (r) = 0 has two roots r_{1} and r_{2}. Hence P (r) = (r − r_{1})(r − r_{2}). All solutions of equation (2) are obtained as linear combinations

(4)  \begin{matrix}u(t) = c_{1}e^{r_{1}t} + c_{2}e^{r_{2}t}, & if r_{1} ≠ r_{2}, \\ u(t) = (c_{1} + c_{2}t)e^{r_{1}t}, & if r_{1} = r_{2}, \end{matrix}

where c_{2}, c_{2} are arbitrary coefficients. The coefficients may be determined from an initial condition of the form

u(0) = u_{0}, u′(0) = u_{1}.

The formula (4) is called the general solution of homogeneous linear equation (3).

Proof. We write the equation as

P (D)u = (D − r_{1})(D − r_{2})u = 0

and solve two first order equations (D − r_{1})v = 0 and (D − r_{2})u = v. First we get

(D − r_{1})v = 0 ⟹ v(t) = Ae^{r_{1}t}, A = v(0).

Then the other equation

(D − r_{2})u(t) = v(t) = Ae^{r_{1}t}

is solved by multiplying by integrating factor e^{−r_{2}t}, see (1),

u(t) = Be^{r_{2}t} + e^{r_{2}t} ∫_{0}^{t} e^{−r_{2}s}v(s) ds { B = u(0) }

= Be^{r_{2}t} + Ae^{r_{2}t} ∫_{0}^{t} e^{(r_{1}−r_{2})s)} ds

= Be^{r_{2}t} + \begin{cases}A\frac{e^{r_{1}t} − e^{r_{2}t}}{r_{1} − r_{2}} , & r_{1} ≠ r_{2} \\ Ate^{r_{2}t}, & r_{1} = r_{2} \end{cases}

= \begin{cases}c_{1}e^{r_{1}t} + c_{1}e^{r_{1}t}, & r_{1} ≠ r_{2}, \\ (c_{1} + c_{2}t)e^{r_{1}t}, & r_{1} = r_{2}. \end{cases}

□

Example 1. We solve

u′′ + u′ − 12u = 0; u(0) = u_{0}, u′(0) = u_{1}.

The equation is written (D^{2} − D − 12)u = 0 and the characteristic equation is r^{2} + r − 12 = 0 with roots r_{1} = 3, r_{2} = −4. The general solution is

u(t) = c_{1}e^{3t} + c_{2}e^{−4t}

with the derivative

u′(t) = 3c_{1}e^{3t} − 4c_{2}e^{−4t}.

The initial condition gives

u_{0} = u(0) = c_{1} + c_{2}
u_{1} = u′(0) = 3c_{1} − 4c_{2}

which implies c_{1} = (4u_{0} + u_{1})/7, c_{2} = (3u_{0} − u_{1})/7. The solution is

u(t) = \frac{4u_{0} + u_{1}}{7} e^{3t} + \frac{3u_{0} − u_{1}}{7} e^{−4t}.

Complex roots. If the characteristic polynomial P (r) has real coefficients, then its roots are either real numbers or a pair of conjugate complex numbers, see AMBS Ch 22.11. In the latter case we have r_{1} = α + iω and r_{2} = α − iω and the solution (4) becomes (see AMBS Ch 33.2 for the definition of exp(z) with a complex variable z)

u(t) = c_{1}e^{(α+iω)t} + c_{2}e^{(α−iω)t}
= e^{αt}(c_{1}e^{iωt} + c_{2}e^{−iωt})
= e^{αt}(c_{1}( cos(ωt) + i sin(ωt)) + c_{2}( cos(ωt) − i sin(ωt)))
= e^{αt}(d_{1} cos(ωt) + d_{2} sin(ωt)),

with d_{1} = c_{1} + c_{2}, d_{2} = i(c_{1} − c_{2}).

Nonhomogeneous equation. See AMBS Ch 35.5. The solution of the nonhomogeneous equation P (D)u = f(t) is given by

(5)  u(t) = u_{h}(t) + u_{p}(t),

where u_{h} is the general solution (4) of the corresponding homogeneous equation, i.e., P (D)u_{h} = 0, and u_{p} is a particular solution of the nonhomogeneous equation, i.e., P (D)u_{p} = f(t).

Proof: If u is given by (5), then Lu = L(u_{h} +u_{p}) = Lu_{h} +Lu_{p} = 0+f = f, so that u solves the nonhomogeneous equation. On the other hand: if u_{p} is a particular solution and u is any other solution of the nonhomogeneous equation, then L(u − u_{p}) = Lu − Lu_{p} = f − f = 0, i.e., u − u_{p} solves the homogeneous equation. Thus u − u_{p} = u_{h}, which is (5).

A particular solution can sometimes be found by guess-work: we make an Ansatz for u_{p} of the same form as f.

Example 2. u′′ − u′ − 2u = t. Here f(t) = t is a polynomial of degree 1 and we make the Ansatz u_{p}(t) = At + B, i.e., a polynomial of degree 1. Substitution into the equation gives −A − 2(At + B) = t. Identification of coefficients gives A = −\frac{1}{2}, B = \frac{1}{4}, so that u_{p}(t) = \frac{1}{4} − \frac{1}{2}t. The general solution of the homogeneous equation is u_{h}(t) = c_{1}e^{−t} + c_{2}e^{2t}. Hence we get

u(t) = u_{h}(t) + u_{p}(t) = c_{1}e^{−t} + c_{2}e^{2t} + \frac{1}{4} − \frac{1}{2}t.

Re-writing as a system of first order equations. By setting w_{1} = u, w_{2} = u′, w = [\begin{matrix}w_{1} \\ w_{2} \end{matrix}], we

can re-write (2) as a system of first order equations

w′(t) = Aw(t) + F (t); w(0) = w_{0},

where

w_{0} = [\begin{matrix}u_{0} \\ u_{1} \end{matrix}] , A = [\begin{matrix}0 & 1 \\ −a_{0} & −a_{1} \end{matrix}] , F (t) = [\begin{matrix}0 \\ f(t) \end{matrix}] .

To see this we compute

w′ = [\begin{matrix}u′ \\ u′′ \end{matrix}] = [\begin{matrix}u′ \\ −a_{0}u − a_{1}u′ + f(t) \end{matrix}] = [\begin{matrix}w_{2} \\ −a_{0}w_{1} − a_{1}w_{2} + f(t) \end{matrix}] = [\begin{matrix}0 & 1 \\ −a_{0} & −a_{1} \end{matrix}] [\begin{matrix}w_{1} \\ w_{2} \end{matrix}] + [\begin{matrix}0 \\ f(t) \end{matrix}] .

It is necessary to do this re-writing before we can use our Matlab programs to solve (2).

2.3 System of linear differential equations of first order.

Constant coefficients—homogeneous equations. We finally mention

(6)  \begin{matrix}u′ + Au = 0, t > 0, \\ u(0) = u_{0}, \end{matrix}

where u(t), u_{0} ∈ R^{d}, and A ∈ R^{d×d} is a constant matrix of coefficients. This kind of system will studied by means of eigenvalues and eigenvectors in the following course ALA-C.

2. Nonlinear equation

The only kind of nonlinear equation that we solve analytically is the so-called separable equation.

2.1. Separable equation. A nonlinear differential equation

u′(x) = f(x, u(x))

is called separable if f(x, u) = h(x)k(u). It is called autonomous if f(x, u) = k(u). Of course, an autonomous equation is separable. Separable equations can sometimes be solved by integration. Let us write it in the form:

u′(x) = \frac{h(x)}{g(u(x))}, x ∈ [a, b], \{it is convenient to write k(u) = \frac{1}{g(u)}\}

u(a) = u_{a}.

We separate the variables:

g(u(x))u′(x) = h(x).

We now assume that we can find primitive functions G and H for g and h. Then the left-hand side is an exact derivative:

\frac{d}{dx}G(u(x)) = g(u(x))u′(x) = h(x) = \frac{d}{dx}H(x)

and we can integrate:

[G(u(x))]_{x=a}^{y} = [H(x)]_{x=a}^{y}
G(u(y)) − G(u_{a}) = H(y) − H(a)
G(u(x)) = G(u_{a}) + H(x) − H(a).

We then solve for u(x) if we can. This means that we must find an inverse function to G, i.e., u(x) = G^{−1}(G(u_{a}) + H(x) − H(a)).

This calculation is easier to remember if we write it as follows:

g(u)\frac{du}{dx} = h(x)

g(u) du = h(x) dx

∫_{u=u_{a}}^{u(y)} g(u) du = ∫_{x=a}^{y} h(x) dx

[G(u)]_{u=u_{a}}^{u(y)} = [H(x)]_{x=a}^{y}

G(u(y)) − G(u_{a}) = H(y) − H(a)

G(u(x)) = G(u_{a}) + H(x) − H(a).

This only works in simple cases. What can go wrong? We cannot find primitive functions for g and h, or we cannot solve for u(x) in the last step.

Example.

u′(x) = u(x)
u(0) = u_{0}

The equation is separable:

∫_{u_{0}}^{u(y)} \frac{du}{u} = ∫_{0}^{y} dx

log (|\frac{u(y)}{u_{0}} |) = y

We can solve for u(y) by taking the exponential:

|\frac{u(y)}{u_{0}} | = exp(y)

|u(y)| = |u_{0}| exp(y)

u(y) = ±u_{0} exp(y) = u_{0} exp(y) {must be + by taking y = 0}

Example.

u′(t) = ku^{3}(t), t > 0,
u(0) = u_{0}

The equation is separable:

\frac{1}{u^{3}} \frac{du}{dt} = k

∫_{u_{0}}^{u(T)} \frac{du}{u^{3}} = ∫_{0}^{T} k dt

[\frac{u^{−2}}{−2} ]_{u_{0}}^{u(T)} = kT

\frac{1}{u(T)^{2}} = \frac{1}{u_{0}^{2}} − 2kT

We can easily solve for u(T):

u(T) = ±\sqrt{\frac{u_{0}^{2}}{1 − 2kT u_{0}^{2}}} = ±\frac{u_{0}}{\sqrt{1 − 2kT u_{0}^{2}}} = \frac{u_{0}}{\sqrt{1 − 2kT u_{0}^{2}}} , T < \frac{1}{2ku_{0}^{2}} ,

where we decided about the plus sign by taking T = 0. Therefore:

u(t) = \frac{u_{0}}{\sqrt{1 − 2kT u_{0}^{2}}} , for 0 ≤ t < \frac{1}{2ku_{0}^{2}} .

Example. The logistic equation. We know that u′ = ku (k > 0) leads to exponential growth: u(t) = u_{0}e^{kt}. In real-world problems the exponential growth is usually broken when u becomes large. One simple way of modelling this is to replace the rate ku by ku(1 − u/M) for some large number M. This means that the rate is ≈ ku when u is small but the rate is ≈ 0 when u approaches M. We thus consider

u′ = ku(1 − u/M), t > 0,
u(0) = u_{0}

The equation is separable:

\frac{1}{u(1 − u/M)} \frac{du}{dt} = k

∫_{u_{0}}^{u(T)} \frac{du}{u(1 − u/M)} = k ∫_{0}^{T} k dt

Partial fractions:

\frac{1}{u(1 − u/M)} = \frac{M}{u(M − u)} = \frac{1}{u} − \frac{1}{u − M}

8 LECTURE 4.1

Now we can integrate:

∫_{u_{0}}^{u(T)} (\frac{1}{u} − \frac{1}{u − M} ) du = kT

[ log(|u|) − log(|u − M|)]_{u_{0}}^{u(T)} = kT

log (|\frac{u(T)}{M − u(T)} \frac{M − u_{0}}{u_{0}} |) = kT

|\frac{u(T)}{M − u(T)} \frac{M − u_{0}}{u_{0}} | = e^{kT}

|\frac{u(T)}{M − u(T)}| = |\frac{u_{0}}{M − u_{0}} |e^{kT}

\frac{u(T)}{M − u(T)} = ±\frac{u_{0}}{M − u_{0}} e^{kT}

\frac{u(T)}{M − u(T)} = \frac{u_{0}}{M − u_{0}} e^{kT}

where we decided about the plus sign by taking T = 0. We solve for u(t):

u(t) = \frac{Mu_{0}}{u_{0} + (M − u_{0})e^{−kt}}

Notice that e^{−kt} → 0 as t → ∞ so that

u(t) → \frac{Mu_{0}}{u_{0} + 0} = M as t → ∞

/stig