CSCE 235
Handout
18: Sequences and Recursions
Assigned April 2nd,
2002
Sequences
Sequences are
functions! They are simply a type of
functions that look a bit different from what we are used to. But they are an important family of
functions. Basically, a sequence is a
function whose domain is the set of natural numbers, N. Thus, a sequence on N is a function
that has a specified value for each integer
N. The values can
be real.
It has been traditional
in mathematics to denote a sequence by a letter such as s and to denote
its value at n as
rather than
. We frequently
call
the nth
term of the sequence. It is often
convenient to denote the sequence itself by
or
or
.
Consider the sequence
where
. This is the
sequence (0, 1, 4, 9, 16, …). This is
also the function within domain N whose value at each n is
. The set of
values is {0, 1, 4, 9, 16, …} =
. Note the difference
between a sequence and a set! A
sequence (1, -1, 1, -1, 1, -1, …) has a set of values { 1, -1 }.
Recursive Definitions
We say that a sequence is defined recursively provided:
(B) some finite set of values, usually the first one or first few, are specified,
(R) the remaining values of the sequence are defined in terms of previous values of the sequence. A formula which does this is called a recursion formula or relation.
Application
of Recursive Definitions
Now the useful part: how we can use this wonderful idea of recursion! We see that the values of the terms in a recursively defined sequence can be computed in two ways:
(a)
An iterative calculation finds
by computing all of
the values
first, so they are
available to use in computing
. To calculate
FACT(73), for instance, we would first calculate FACT(k) for k =
1, 2, …, 72, even though we might have no interest in these preliminary values
themselves.
(b) A recursive
calculation finds the value of
by looking to see
which terms
depends on, then
which terms those terms depend on, and so on.
It may turn out that the value of
only depends on the
values of a relatively small set of its predecessors, in which case the other
previous terms can be ignored!
Recursion
Relations
Sequences that are defined by recursion appear frequently in mathematics and science, and there are several techniques for obtaining explicit formulas for them. Here we have one theorem to solve recursion relations of the form
.
Here a and b
are constants, and it is assumed that the two initial values
and
have been
specified. We will assume that a
is not 0, and b is not 0. It is
convenient to ignore the specified values of
and
until later. In view of the special cases we’ve examined,
it is reasonable to hope that some solutions have the form
for some constant c. This hope, if true, would force
![]()
Dividing by
would then give
, or
. In other words, if
for all n,
then r must be a solution of the quadratic equation
, which is called the characteristic equation (or
characteristic polynomial) of the recursion relation.
(a) if
the characteristic equation has distinct solutions (characteristic roots)
and
, then
(1)
for
certain constants
and
. If
and
(the initial
conditions) are specified, the constants can be determined by setting n
= 0 and n = 1 in (1) and solving the two equations for
and
.
(b) if the characteristic equation has only one solution r then
(2)
for
certain constants
and
. As in (a),
and
can be determined if
and
are specified.
The non-recursive equation is the solution. Remember that the above theorem applies to only a specific case of recursion: linear and second order. It is second order because it depends only on two immediately preceding terms. It is linear because of the first power.
What a wonderful idea! We are able to express a recursion as a non-recursive equation. That is an elegant approach to analyze computationally intensive designs. Remember that in general recursions are expensive to compute! So if we can express a sequence in a non-recursive equation, the design becomes more efficient. This is analogical to our discussions in Induction.
Based on (Ross and
Wright 1988) and (Goodaire and Parmenter 2002).