Difference equation tutorial: draft of part I
Dear friends of MHF
in the two and half years of my presence in MHF, I often noticed some difficulties in the treatment of difference equations, an important chapter of Discrete Maths that [may be...] is a little unfairly undervaluated. After a discussion about that with the staff, I decided to write a tutorial on the Difference equations and in next posts You can read the draft of Part I: general concepts about sequences and first order difference equations, which for size reason has been devided in three parts...
I will appreciate very much all the errors, omissions, modifications, suggestion and requests of clarification that You all will express about my work...
Kind regards
Re: Difference equation tutorial: draft of part I
Difference equation tutorial- Part I: general concepts about sequences and first order difference equations
By: Carlo Sabatini
1. Definitions
In mathematics there are various definitions of ‘sequence’ so that we adopt, among them, the most suitable with the purposes of this tutorial work. We define sequence a set of numbers each of them associated to a natural number n, supposing that the set of natural numbers includes the 0. Each term of a sequence a is written as
. In general we will consider the term ‘sequence’ and ‘discrete function’ as synonyms. Each term an can be real or complex, so that there are real or complex sequences. If nothing is specified a sequence has to be considered as a real sequence.
Like a ‘conventional’ function of real variable, a discrete function can be defined in explicit or implicit form. Defining a sequence in explicit form means to have a computational formula that permits for each n to compute the corresponding
. A simple example of sequence defined in explicit form is…
(1.1)
Defining a sequence in implicit form means to have an expression of the type…
(1.2)
... combined with the ‘initial conditions’…
(1.3)
An expression like the (1.2) combined with the initial conditions like the (1.3) is called recursive relation, or alternatively difference equation. The index k in (1.2) is the order of the difference equation. ‘Solving’ a difference equation means to find, given the (1.2) and (1.3), an expression of the
like (1.1). As we will see later, that is not always feasible or ‘comfortable’. The reason of the ‘dual name’ will be explained indetail in a successive section.
2. Some basic sequences
Now we define some ‘fundamental sequences’ that are commonly used practically in all branches of Mathematics. The first of them is the unit sample sequence, defined as…
(2.1)
The unit sample sequence
plays the same role of the ‘impulsive function’
in the continuous functions set but, and that is remarkable, it doesn’t suffer of any ‘complication’ in the definition for n=0.
The second ‘fundamental sequence’ [or, more exactly, ‘fundamental set of sequences’…] is the exponential sequence on base
the general term of which is usually written as
and defined by the recursive relation…
(2.2)
It is important to precise that
can be any real number, even negative and even 0,so that any ‘ambiguity’ in the definition of
doesn’t exist indiscrete mathematics. In particular the sequence
is different from the ‘all zero sequence’ and is
. A significant difference between continuous and discrete mathematics in in the fact that in the first the ‘exponential function’ has as base the number e, defined as…
^{n})
That is in continuous mathematics. In discrete mathematics any real number
can be the base of an ‘exponential sequence’ and don’t exist any particular ‘privilege’.
The last ‘fundamental sequence’ we go to define is the factorial sequence, the general term of which is written as
and defined by the recursive relation…
(2.3)
Also for factorials the definition (2.3) eliminates any ‘complication’ regarding
, sothat we can say that that is an important ‘common property’ of the three ‘fundamental sequences’ examined in this section.
3. Transforming a recursive relation into adifference equation and vice-versa
The reason of the ‘duality of the name’ is now explained starting from definition of first difference, second differenceand ‘difference of order k’. Given a sequence
we define as first difference the quantity…
(3.1)
… and second difference the quantity…
(3.2)
In general the difference of order k of a sequence is the quantity…
(3.3)
An useful property of the recursive relation written in the form (1.2) is the fact that it can be rewritten in term of differences as…
(3.4)
This possibility, as we will see in a successive section, may be very useful and an illustrative example is appropriate. The following second order recursive relation…
(3.5)
… is well known and, with the initial conditions
and
, it generates the ‘Fibonacci’s sequence’. Now with simple steps the (3.5) is transformed in the form (3.4) as…
(3.6)
In the successive sections we will use both the expression (1.2) and (3.4), simply taking into account which is more ‘comfortable’ and in both cases will use the term ‘difference equation’…
Re: Difference equation tutorial: draft of part I
4. First order difference equations: some particular cases
As illustrative example we start considering the first order recursive relation…
(4.1)
The values of the
are computable simply performing the elementary operation illustrated in (4.1) and we obtain
. Such type of solution is always possible of course but rarely is useful. Finding the explicit form of the sequence is ‘the best’ but, expecially for notlinear difference equations, often is an hard task. In many practical situations however someone can be interested to the convergence or divergence of the solution, i.e. , given a first order difference equation written in standard form…
(4.2)
… to find [if it exists…] the limit…
(4.3)
Looking at the (4.3) it is clear that the problem of convergence of the solution is the problem of convergence of the series in the second term. The necessary condition for the convergence of a series is well known: the general term must tend to 0 so that necessary condition is…
(4.4)
In order to obtain also sufficient conditions let suppose that we are in the particular case...
(4.5)
… so that f(*) is function only of
. In this case the condition (4.4) implies that, if the solution converges to a finite limit
, then it must be
. Now we suppose that the function f(*) for which is
and its derivative are continuous in an interval
containing
and in this interval f(*) has no more zeroes. We have three distinct cases…
a) in
is
and in this case
is called attractive fixed point…
b) in
is
and in this case
is called repulsive fixed point…
c) in
is
and this case requires a particular treatment and it will not examined here…
From (4.5) we can easily verify that, if f(*)has a zero in
, then the initial condition
will generate the ‘all
sequence’ no matter if
is an attractive or repulsive fixed point. If thatis not the case, then
can be the finite limit of the solution only if
is an attractive fixed point. The successive step is answering the question: well!... but when a solution does converge effectively to
?... A first sufficient condition is given by the…
Theorem 4.1- If
is anattractive fixed point and it exists an interval
wherefor any
is…
(4.6)
… and the initial value
, then the solution converges monotonically at
.
Demonstration- In this case the series (4.3),as consequence of the (4.6), has all the terms positive or negative, so that we can invoke the ratio test for convergence. The (4.6) guarantees also that is…
(4.7)
… so that the convergence of the solution to
is demonstrated.
A second condition is given by the…
Theorem 4.2- If
is anattractive fixed point and it exist an interval
wherefor any
is…
(4.8)
… and the initial value
, then the solution converges at
and the convergence is ‘oscillating’.
Demonstration- In this case the series (4.3),as consequence of (4.7), is with alternate terms and, because the
are decreasing and their limit if n tends to infinity is 0, the convergence to the solution to
is proved.
At this point the best way to proceed is to give some illustrative example and we will do that applying the theorems 4.1and 4.2 to a well popular procedure for solving nonlinear equations: the Newton's method. In the seventeenth century the British philosopher, physicist and mathematician [Sir] Isaac Newton proposed an iterative way to find the solution of an equation written in the form…
(4.9)
According to Newton, if a sequence defined by the difference equation…
(4.10)
… ‘started up’ by a certain initial value
has limit
, then
is solution of (4.9). Since we are in ‘historical context’, now we will apply the Newton's method going back more than four centuries before him. In the year 1225 the Italia nmathematician Leonardo Fibonacci studied the third order equation…
(4.11)
… and obtained the solution
, exact till to the last digit. Only three centuries later the Italian mathematicians Scipione del Ferro and Nicolò Tartaglia, independently one from the other, will discovery the solving procedure for the cubic equation, so that how Fibonacci obtained this remarkable result is still unknown. Now we try to apply the Newton's method to verify the solution of Fibonacci and first we compute…
(4.12)
… and then we start the Newton’s iterations(4.10) with the [not well meditated…] value
…




… and for greater value on n the result in 12 digit remains the same. The convergence is very fast and in only four iterations we have obtained the result of Fibonacci. Regarding the
we observe that for n=0 the sequence increases and for greater n the sequence is decreasing. That is not a surprise if we observe the diagram of f(x) as in the figure…
http://digilander.libero.it/luposabatini/MHF136.bmp
fig. 4.1
In the figure the ‘black line’ is
, the ‘blue line’ is
and the ‘red line’ is
. If we observe with care the figure we note that for
in the region
we are in the condition of theorem 4.2 and the convergence is oscillating and for
in the region
we are in the condition of theorem 4.1 and the convergence is monotonic and that is true for all possible values of [tex]a_{0}. In other words the Newton's method, applied to the Fibonacci’s equation, always converges no matter which is
. Unfortunately not always that is true, as we will see in next example.
We want to apply the Newton's method to the equation…
(4.13)
Of course we know that
is a solution of (4.13), but what we are interested for is to verify the convergence of the method. First we compute f(x) with (4.10)…
(4.14)
...and then we observe the diagram of f(x)…
http://digilander.libero.it/luposabatini/MHF55.bmp
fig. 4.2
Also in this case the is the ‘black line’ is f(x), the ‘blue line’ is
and the ‘red line’ is
. For
where
we are in the conditions of theorem 4.2 and the Newton’s sequence will converge to the attractive fixed point
with oscillations. For
or
the convergence criterions of the theorem 4.1 or 4.2 aren’t satisfied and the Newton’s sequence will diverge. Before to proceed to the next section it is useful to apply the procedure now described to a very popular biological mathematical model: the inhibited growth model. According to this model, the population of a bacteria colonial grows according to the solution of the difference equation…
(4.15)
… where
is the ‘natural’ bacteria grow rate, i.e. the grow rate without any constraint, and M is the maximum number of bacteria that the ‘environmental resources’ can permit. If we ‘normalize’ the independent variable to M the f(x) in this case is…
(4.16)
Using the described procedure we can identify two ‘critical values’ of the constant
. For
f(x) is illustrated in fig. 4.3…
http://digilander.libero.it/luposabatini/MHF139.bmp
fig. 4.3
As in the previous cases the ‘black line’ isf(x), the ‘blue line’ is
and the ‘red line’ is
. For
we are in the conditions of theorem 4.1 and the sequence will converge to the attractive fixed point
‘monotonically increasing’. The same is for
. For
f(x) is illustrated infig. 4.4…
http://digilander.libero.it/luposabatini/MHF140.bmp
fig. 4.4
Again the ‘black line’ is f(x), the ‘blue line’ is
and the ‘red line’ is
. For
we are in the conditions of theorem 4.2 and the sequence will converge to the attractive fixed point
‘oscillating’. The same is for
. For
the solution of the difference equation (4.15) will diverge no matter which is
…
Re: Difference equation tutorial: draft of part I
5. Linear first order difference equations
Now we will have a look at the difference equation…
(5.1)
Here
is a linear function of the
so that the (5.1) is a linear difference equation. Of course the
and the
are in general discrete functions of n. Proceeding in ‘direct way’ from the initial value
we find…



...
Now if we set
, the solution can be written as…
(5.2)
As we said before, such result is not always full satisfactory and, when possible, an explicit solution as function of n is preferable. That is feasible in a large quantity of cases and we can start describing the simplest one: the case
. So that the difference equation is in the form…
(5.3)
As for linear differential equations, a linear difference equation written as the (5.3) is called homogeneous and in this the coefficients are constant. The solution is immediately derived from (5.2)…
(5.4)
This case is very simple but is of fundamental importance for the solution of more complex difference equations. The next step is to set case
and
, so that the difference equation is…
(5.5)
As for linear differential equations, a linear difference equation written as the (5.5) is called nonhomogeneous. The solution is derived from (5.2) in a way a little more complex respect to the previous case…
(5.6)
The (5.6) allows us to arrive to another important analogy between difference equations and differential equations: the solution of a nonhomogeneous difference equation is the sum of the solution of the homogeneous equation and ‘another term’ which doesn’t depend from the ‘initial value’ a… and the same is true also for higher order linear difference equations.
Now we perform a further step setting
,
and
, so that the difference equation is…
(5.7)
The solution, as derived from (5.2), is…
(5.8)
… and immediately we observe that it is a polynomial. The Horner method to compute a polynomial using only addictions and multiplications is based on the difference equation (5.7).
Proceeding with examples more and more complex we now examine the difference equation…
(5.9)
In (5.2) we have…
... and for all n is
, so that the solution is…
(5.10)
… and for n ‘large enough’ is…
As in the previous case the difference equation (5.9) permits the practical computation of
using only addictions and multiplications. With proper modifications in (5.9) a similar procedure is allowable for sin x, cos x, sinh x, cosh x, etc…, and in most cases it is a more convenient way to compute these functions respect to the ‘standard’ series expansion. Also for functions that can represented as ‘infinite product’ this type of approach can be very useful, as in the following example: let consider the linear homogeneous difference equation…
(5.11)
Here the
are all 0, so that from (5.2) we derive…
(5.12)
… and is…
(5.13)
In general the effective computation of a numerical ‘finite or infinite’ sum can be reduced to the solution of a first order difference equation in the form…
(5.14)
… that is the general expression (5.1) where all the
are 0. An useful preliminary is the definition of the following function…
(5.15)
… where c is a constant that for the moment is left undefined. From (5.15) we derive immediately the ‘fundamental identity’…

… that is…
(5.16)
The ‘fundamental identity’ (5.16) remember a property of the so called factorial function, defined as…
(5.17)
Integrating by parts (5.17) we arrive to write…
(5.18)
Now deriving (5.18) we obtain…
… so that is…
(5.19)
It is easy to verify that the expressions (5.16) and (5.19) are ‘formally identical’ and that permits us to conclude that is…
(5.20)
The (5.20) permits us to find the value of the constant c in (5.15). Starting from the ‘infinite product expansion’ of the factorial function with little efforts we can obtain the following McLaurin expansion, valid for |x|<1…
(5.21)
… where
is the so called ‘Riemann Zeta function’ …
(5.22)
… and
is the so called ‘Euler’s constant’…
(5.23)
Deriving the (5.21) we obtain…
(5.24)
… and comparing (5.15),(5.20) and (5.24) we conclude that the constant term in (5.15) and (5.24) must be the same and that in (5.15) is
.
Now if we set in (5.16) x=n, we discover that
satisfies the difference equation…
(5.25)
… the solution of which is…
(5.26)
If we remember the definition of the Euler’s constant, it is easy to see that for n ‘large enough’ is…
(5.27)
… and a ‘visible proof’ of that is illustrated in figure…
http://digilander.libero.it/luposabatini/MHF138.bmp
fig. 5.1
Although the term is used for more functions, we call the
we have defined in the last lines digamma function and now we illustrate in two examples how tom use its properties for the computation of finite or infinite sums. The first is the computation of…
(5.28)
… for any value of n and t. If in (5.16) we set x=k+t-1 we obtain…
… so that the (5.28) can be treated as a telescopic sum and obtain…
(5.29)
The second is the computation of the ‘infinite sum’…
(5.30)
… for any value of a and b. Writing the n-th partial sum of (5.30) taking into account (5.29) we have…
\ (k+b)}= \frac{1}{b-a}\ \sum_{k=1}^{n}(\frac{1}{k+a}-\frac{1}{k+b})= )
(5.31)
A consequence of (5.27) is…
... so that we arrive to write…
(5.32)
Of course the field of linear first order difference equation is much wider, but our scope is only to supply some solving method. To acquire more material the reader can consult the specialized literature.
6. Nonlinear first order difference equations
If a nonlinear first order is written in the form (4.5), then ’almost always’ the procedure illustrated in section 4 shows the general character of the solution. If not, then the solving procedure, if it exist, must be found ‘case by case’. One possibility is the variable change as in the following example…
(6.1)
… where the
are function of n. In this case the variable change
conducts to the difference equation…
(6.2)
… which is linear, so that the procedures of the section 5 can be applied.