Sequence
In mathematics, a sequence is a collection of objects possibly with repetition, that come in a specified order. Like a set, it contains members. Unlike a set, the same elements can appear multiple times at different positions in a sequence, and unlike a set, the order does matter. The notion of a sequence can be generalized to an indexed family, defined as a function from an arbitrary index set.
For example, is a sequence of letters with the letter "M" first and "Y" last. This sequence differs from. Also, the sequence, which contains the number 1 at two different positions, is a valid sequence. Sequences can be finite, as in these examples, or infinite, such as the sequence of even positive integers, meaning that each element is twice the value of its position.
The length of a finite sequence is defined as the number of elements in the sequence. The position of an element in a sequence is its rank or index; it is the natural number for which the element is the image. The first element has index 0 or 1, depending on the context or a specific convention. In mathematical analysis, a sequence is often denoted by letters in the form of, and, where the subscript n refers to the nth element of the sequence; for example, the nth element of the Fibonacci sequence ' is generally denoted as '.
In computing and computer science, finite sequences are usually called strings, words or lists, with the specific technical term chosen depending on the type of object the sequence enumerates and the different ways to represent the sequence in computer memory. Infinite sequences are called streams.
The empty sequence is included in most notions of sequence. It may be excluded depending on the context.
Examples and notation
A sequence can be thought of as a list of elements with a particular order. Sequences are useful in a number of mathematical disciplines for studying functions, spaces, and other mathematical structures using the [|convergence] properties of sequences. In particular, sequences are the basis for series, which are important in differential equations and analysis. Sequences are also of interest in their own right, and can be studied as patterns or puzzles, such as in the study of prime numbers.There are a number of ways to denote a sequence, some of which are more useful for specific types of sequences. One way to specify a sequence is to list all its elements. For example, the first four odd numbers form the sequence. This notation is used for infinite sequences as well. For instance, the infinite sequence of positive odd integers is written as. Because notating sequences with ellipsis leads to ambiguity, listing is most useful for customary infinite sequences which can be easily recognized from their first few elements. Other ways of denoting a sequence are discussed after the examples.
Examples
The prime numbers are the natural numbers greater than 1 that have no divisors but 1 and themselves. Taking these in their natural order gives the sequence. The prime numbers are widely used in mathematics, particularly in number theory where many results related to them exist.The Fibonacci numbers comprise the integer sequence in which each element is the sum of the previous two elements. The first two elements are either 0 and 1 or 1 and 1 so that the sequence is.
Other examples of sequences include those made up of rational numbers, real numbers and complex numbers. The sequence, for instance, approaches the number 1. In fact, every real number can be written as the limit of a sequence of rational numbers. As another example, pi| is the limit of the sequence, which is increasing. A related sequence is the sequence of decimal digits of, that is,. Unlike the preceding sequence, this sequence does not have any pattern that is easily discernible by inspection.
Other examples are sequences of functions, whose elements are functions instead of numbers.
The On-Line Encyclopedia of Integer Sequences comprises a large list of examples of integer sequences.
Indexing
Other notations can be useful for sequences whose pattern cannot be easily guessed or for sequences that do not have a pattern such as the digits of pi|. One such notation is to write down a general formula for computing the nth term as a function of n, enclose it in parentheses, and include a subscript indicating the set of values that n can take. For example, in this notation the sequence of even numbers could be written as. The sequence of squares could be written as. The variable n is called an index, and the set of values that it can take is called the index set.It is often useful to combine this notation with the technique of treating the elements of a sequence as individual variables. This yields expressions like, which denotes a sequence whose nth element is given by the variable. For example:
One can consider multiple sequences at the same time by using different variables; e.g. could be a different sequence than. One can even consider a sequence of sequences: denotes a sequence whose mth term is the sequence.
An alternative to writing the domain of a sequence in the subscript is to indicate the range of values that the index can take by listing its highest and lowest legal values. For example, the notation denotes the ten-term sequence of squares. The limits and are allowed, but they do not represent valid values for the index, only the supremum or infimum of such values, respectively. For example, the sequence is the same as the sequence, and does not contain an additional term "at infinity". The sequence is a bi-infinite sequence, and can also be written as.
In cases where the set of indexing numbers is understood, the subscripts and superscripts are often left off. That is, one simply writes for an arbitrary sequence. Often, the index k is understood to run from 1 to ∞. However, sequences are frequently indexed starting from zero, as in
In some cases, the elements of the sequence are related naturally to a sequence of integers whose pattern can be easily inferred. In these cases, the index set may be implied by a listing of the first few abstract elements. For instance, the sequence of squares of odd numbers could be denoted in any of the following ways.
Defining a sequence by recursion
Sequences whose elements are related to the previous elements in a straightforward way are often defined using recursion. This is in contrast to the definition of sequences of elements as functions of their positions.To define a sequence by recursion, one needs a rule, called recurrence relation to construct each element in terms of the ones before it. In addition, enough initial elements must be provided so that all subsequent elements of the sequence can be computed by successive applications of the recurrence relation.
The Fibonacci sequence is a simple classical example, defined by the recurrence relation
with initial terms and. From this, a simple computation shows that the first ten terms of this sequence are 0, 1, 1, 2, 3, 5, 8, 13, 21, and 34.
A complicated example of a sequence defined by a recurrence relation is Recamán's sequence, defined by the recurrence relation
with initial term
A linear recurrence with constant coefficients is a recurrence relation of the form
where are constants. There is a general method for expressing the general term of such a sequence as a function of ; see Linear recurrence. In the case of the Fibonacci sequence, one has and the resulting function of is given by Binet's formula.
A holonomic sequence is a sequence defined by a recurrence relation of the form
where are polynomials in. For most holonomic sequences, there is no explicit formula for expressing as a function of. Nevertheless, holonomic sequences play an important role in various areas of mathematics. For example, many special functions have a Taylor series whose sequence of coefficients is holonomic. The use of the recurrence relation allows a fast computation of values of such special functions.
Not all sequences can be specified by a recurrence relation. An example is the sequence of prime numbers in their natural order.
Formal definition and basic properties
Definition
Formally, a sequence can be defined as a function whose domain is an interval of integers. The elements of the domain are the positions or indices of the elements in the sequence, while the values taken by the function are the elements of the sequence. The interval can be finite or infinite; thus, this definition covers several different uses of the word "sequence", including one-sided infinite sequences, bi-infinite sequences, and finite sequences. In some contexts, the codomain of the sequence is fixed by context, for example by requiring it to be the set of real numbers, the set of complex numbers, or a topological space.Although sequences are a type of function, they are usually distinguished notationally from functions in that the input is written as a subscript rather than in parentheses, that is, rather than. There are terminological differences as well: the value of a sequence at the lowest input is called the "first element" of the sequence, the value at the second smallest input is called the "second element", etc. Also, while a function abstracted from its input is usually denoted by a single letter, a sequence abstracted from its input is usually written by a notation such as, or just as Here is the domain, or index set, of the sequence.