← Intuition and Continuity Sequence Limit of a sequence →

In mathematics, informally speaking, a sequence is an ordered list of objects (or events). Like a set, it contains members (also called elements, or terms). The number of ordered elements (possibly infinite) is called the length of the sequence. Unlike a set, order matters, and exactly the same elements can appear multiple times at different positions in the sequence. Most precisely, a sequence can be defined as a function whose domain is a countable totally ordered set, such as the natural numbers.

For example, {M, A, R, Y} is a sequence of letters with the letter 'M' first and 'Y' last. This sequence differs from {A, R, M, Y}. Also, notice that the sequence {1, 1, 2, 3, 5, 8}, which contains the number 1 at two different positions, is a valid sequence. Sequences can be finite, as in this example, or infinite, such as the sequence of all even positive integers {2, 4, 6,...}. Finite sequences are sometimes known as strings or words and infinite sequences as streams. The empty sequence { } is included in most notions of sequence, but may be excluded depending on the context.

An infinite sequence of real numbers (in blue). This sequence is neither increasing, nor decreasing, nor convergent, nor Cauchy. It is, however, bounded.

## 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 for which one might have many related objects. Sequences are also the basis for series, which are important in differential equations and analysis. Sequences can be studied simply as patterns, or for patterns, such as in the study of prime numbers.

There are a number of ways to denote a sequence, each of which is more useful for different types of sequences. One way to specify a sequence is to list the elements, such as in the examples of the first section. In this notation the first 4 odd numbers form the sequence {1,3,5,7}. This notation can be used for infinite sequences as well, leaving it to the reader to discover the pattern that links the elements of the sequence. For instance, the infinite sequence of positive odd integers can be written {1,3,5,7,...}. Other ways to denote a sequence are discussed after the examples.

### Important examples

A tiling with squares whose sides are successive Fibonacci numbers in length

There are many important integer sequences. The prime numbers are numbers that have no divisors but 1 and themselves. Taking these in their natural order gives the sequence {2,3,5,7,11,13,17,...}. The study of prime numbers has important applications for mathematics and specifically number theory.

The Fibonacci numbers are formed from the integer sequence whose elements are formed by taking the sum of the previous two elements. The first two elements are defined either as 0 and 1 or 1 and 1 giving the sequence {0,1,1,2,3,5,8,13,21,34,...}.

Other interesting sequences include the ban numbers, whose spellings do not contain a certain letter of the alphabet. For instance, the eban numbers (do not contain 'e') form the sequence {2,4,6,30,32,34,36,40,42,...}. Another sequence based on the English spelling of the letters is the one based on their number of letters {3,3,5,4,4,3,5,5,4,3,6,6,8,...}.

Other important examples of sequences include ones made up of rational numbers, real numbers, and complex numbers. The sequence {.9,.99,.999,.9999,...} approaches the number one. In fact, every real number can be written as the limit of a sequence of rational number. For instance, the number π can be written as the limit of a sequence {3,3.1,3.14,3.141,3.1415,...}. In fact, every real number can be written as an decimal. The decimal for π, however, does not have any pattern like the one for the sequence {0.9,0.99,...}.

### Indexing

In some cases, such as for the sequence {0,1,3,6,2,7,13,20,12,21,11,22,...}, the pattern may be difficult to discern. In this case the sequence can be obtained by starting with zero, and - if n is the position of the last element - adding n if the result is positive and not already in the list and otherwise subtracting n from the last term. This famous sequence is known as Recaman's sequence. In cases such as this, there are other notations that can be both more natural and more useful. In fact, a general sequence need not have any pattern at all, such as a sequence generated by the numbers shown on consecutive rolls of a fair die.

This section focuses on the notations used for sequences that are a map from a subset of the natural numbers. For generalizations to other countable index sets are the #Definition and basic properties|following section and below.

The terms of a sequence are commonly denoted by a single variable, say ${\displaystyle a_{n}}$, where the n indicates the nth element of the sequence. This has the advantage of allowing us to easily speak abstractly about sequences and to distinguish two sequences, such as by using ${\displaystyle b_{n}}$ for the typical element of a different sequence, while still easily recording each separate element and its position in a simple manner. In this notation the symbols correspond as in the following list.

{\displaystyle {\begin{aligned}a_{1}&\leftrightarrow &{\text{ 1st element}}\\a_{2}&\leftrightarrow &{\text{ 2nd element }}\\\vdots &&\vdots \\a_{n-1}&\leftrightarrow &{\text{ (n-1)th element}}\\a_{n}&\leftrightarrow &{\text{ nth element}}\\a_{n+1}&\leftrightarrow &{\text{ (n+1)th element}}\\\vdots &&\vdots \end{aligned}}}

In this notation we could easily specify the sequence of the first 10 square numbers by writing ${\displaystyle \{a_{1},a_{2},...,a_{10}\}}$ such that ${\displaystyle a_{k}=k^{2}}$ for all k. This represents the sequence {1,4,9,...100}. This notation is often simplified further as

${\displaystyle \{a_{k}\}_{k=1}^{10}}$ with ${\displaystyle a_{k}=k^{2}}$.

Here the subscript {k=1} and superscript 10 together tell us that the elements of this sequence are the ${\displaystyle a_{k}}$ such that ${\displaystyle k=1,2,...,10}$. In other language, the values that k takes on are such that k is in the set {1,2,3,...,10}, and the elements of the sequence take on the natural order of the elements in the set given by 2<3 implies ${\displaystyle a_{2}}$ comes before ${\displaystyle a_{3}}$. The set of values that the index can take on is called the index set. In the last example the indexing set was {1,2,3,...,10}.

Sequences can be indexed beginning and ending from any integer. The infinity symbol is often used as the superscript to indicated the sequence including all integer k-values starting with a certain one. The sequence of all positive squares is then denoted

${\displaystyle \{a_{k}\}_{k=1}^{\infty }}$ with ${\displaystyle a_{k}=k^{2}}$.

In cases where the set of indexing numbers is understood, such as in analysis, the subscripts and superscripts are often left off. That is, one simply writes ${\displaystyle {a_{k}}}$ for an arbitrary sequence. In analysis k would be understood to run from 1 to ${\displaystyle \infty }$.

Sequences are often indexed starting from zero, as in

${\displaystyle \{a_{k}\}_{k=0}^{\infty }=\{a_{0},a_{1},a_{2},...\}}$.

In some cases the elements of the sequence might be naturally in another way. For instance, the sequence of squares of even and odd numbers|odd numbers could be denoted in any of the following ways.

${\displaystyle \{1,9,25,...\}}$
${\displaystyle \{a_{1},a_{3},a_{5},...\}}$ with ${\displaystyle a_{k}=k^{2}}$
${\displaystyle \{a_{2k-1}\}_{k=1}^{\infty }}$ with ${\displaystyle a_{k}=k^{2}}$
${\displaystyle \{a_{k}\}_{k=1}^{\infty }}$ with ${\displaystyle a_{k}=(2k-1)^{2}}$
${\displaystyle \{(2k-1)^{2}\}_{k=1}^{\infty }}$

Moreover, in the subscripts and superscripts could have been left off in the second, fourth, and fifth notations in the last line if the indexing set was understood to be the natural numbers.

Finally, sequences can most generally be denoted by writing a set inclusion in the subscript, such as in

${\displaystyle \{a_{k}\}_{k\in \mathbb {N} }}$

where ${\displaystyle \mathbb {N} }$ denotes the natural numbers. This would denote the same set as ${\displaystyle \{a_{k}\}_{0}^{\infty }}$. Here ${\displaystyle \mathbb {N} }$ is the indexing set.

In the last equation we have not specified the elements ${\displaystyle a_{k}}$. In this way we can consider any sequence written in this form. That is, indexing allows us to consider sequences in the abstract. This is useful for defining properties of sequences in terms of abstract elements of an arbitrary sequence.

### Defining a sequence and recursion

In the section above, sequences could be identified by giving a rule that specifies the nth element of the sequence, such as ${\displaystyle a_{k}=k^{2}}$. Not all sequences can be defined by a rule in the form of an equation, and some can be quite complicated. For example, the sequence of prime numbers can be defined as the set of prime numbers in their natural order. This gives the sequence {2,3,5,7,11,13,17,...}. Sequence definition for a single sequence such as the prime number sequence should not be confused with the #Definition and basic properties#Definition|definition of a sequence as a mathematical concept.

Sequences such as the Fibonacci sequence are most easily defined using recursion. This is done by specifying a rule to construct each consecutive term in the sequence in terms of the ones before it. In addition, enough initial elements must be specified so that new elements of the sequence can be specified by the rule. The Fibonacci sequence can be defined using a rule along with two initial elements.

${\displaystyle a_{n}=a_{n-1}+a_{n-2}}$, with ${\displaystyle a_{0}=0}$, ${\displaystyle a_{1}=1}$.

The first 10 terms of this sequence are 0,1,1,2,3,5,8,13,21, and 34. A more complicated example of a sequence that is defined recursively is Recaman's sequence, considered at the beginning of this section. We can define Recaman's sequence by

${\displaystyle a_{0}=0}$ and ${\displaystyle a_{n}=a_{n-1}+n}$ if the result is positive and not already in the list. Otherwise, ${\displaystyle a_{n}=a_{n-1}-n}$.

This beginning of this sequence is {0,1,3,6,2,7,13,20,12,21,11,22,...}.

## Definition and basic properties

There are many different notions of sequences in mathematics, some of which (e.g., exact sequence) are not covered by the definitions and notations introduced below.

### Definition

A sequence is usually defined as a function (mathematics)|function whose domain is a countable totally ordered set, although in many disciplines the domain is restricted, such as to the natural numbers. In real analysis a sequence is a function from a subset of the natural numbers to the real numbers. In other words, a sequence is a map ${\displaystyle f(n):\mathbb {N} \to \mathbb {R} }$. To recover our earlier notation we might identify ${\displaystyle a_{n}=f(n)}$ ${\displaystyle \forall n}$ or just write ${\displaystyle a_{n}:\mathbb {N} \to \mathbb {R} }$.

In complex analysis sequences are defined as maps from the natural numbers to the complex numbers (${\displaystyle \mathbb {C} }$). In topology, sequences are often defined as functions from a subset of the natural numbers to a topological space. Sequences are an important concept for studying functions and, in topology, topological spaces. An important generalization of sequences, called a net (mathematics)|net, is to functions from a (possibly uncountable) directed set to a topological space.

### Finite and infinite

The length of a sequence is defined as the number of terms in the sequence.

A sequence of a finite length n is also called an n-tuple. Finite sequences include the empty sequence {} that has no elements.

Normally, the term infinite sequence refers to a sequence which is infinite in one direction, and finite in the other—the sequence has a first element, but no final element (a singly infinite sequence). A sequence that is infinite in both directions—it has neither a first nor a final element-is called a bi-infinite sequence, two-way infinite sequence, or doubly infinite sequence. For instance, a function from all integers into a set, such as the sequence of all even integers { … , -4, -2, 0, 2, 4, 6, 8… }, is bi-infinite. This sequence could be denoted ${\displaystyle \{2n\}_{n=-\infty }^{\infty }}$.

### Increasing and decreasing

A sequence is said to be monotone function|monotonically increasing if each term is greater than or equal to the one before it. For a sequence ${\displaystyle \{a_{n}\}_{n=1}^{\infty }}$ this can be written as ${\displaystyle a_{n}\leq a_{n+1}}$ ${\displaystyle \forall n\geq 1}$. If each consecutive term is strictly greater than (>) the previous term then the sequence is called strictly monotonically increasing. A sequence is monotonically decreasing if each consecutive term is less than or equal to the previous one, and strictly monotonically decreasing if each is strictly less than the previous. If a sequence is either increasing or decreasing it is called a monotone sequence. This is a special case of the more general notion of a monotonic function.

The terms nondecreasing and nonincreasing are often used in place of increasing and decreasing in order to avoid any possible confusion with strictly increasing and strictly decreasing, respectively.

### Bounded

If the sequence of real numbers ${\displaystyle \{a_{n}\}}$ is such that all the terms, after a certain one, are less than some real number M, then the sequence is said to be bounded from above. In less words, this means ${\displaystyle a_{n}\leq M}$${\displaystyle \forall n>N}$ for some pair M and N. Any such M is called an upper bound. Likewise, if, for some real m ${\displaystyle a_{n}\geq m}$ for all n greater than some N, then the sequence is bounded from below and any such m is called a lower bound. If a sequence is both bounded from above and bounded from below then the sequence is said to be bounded.

### Other types of sequences

A subsequence of a given sequence is a sequence formed from the given sequence by deleting some of the elements without disturbing the relative positions of the remaining elements. For instance, the sequence of positive even integers {2,4,6,...} is a subsequence of the positive integers {1,2,3,...}. Notice that after the deletion of some elements the position of other elements does change. However, the relative positions are preserved.

Some other types of sequences that are easy to define include:

• An integer sequence is a sequence whose terms are integers.
• A polynomial sequence is a sequence whose terms are polynomials.
• A positive integer sequence is multiplicative if f(xy) = f(x)f(y) for all x,y such that x and y are coprime.

## Limits and convergence

File:Converging Sequence.png|thumb|The plot of a Cauchy sequence (mathematics)|sequence ${\displaystyle (x_{n}),}$ shown in blue, as ${\displaystyle x_{n}}$ versus ${\displaystyle n}$. Visually we can see that the sequence is converging to some limit. In the real numbers every Cauchy sequence converges (has a limit).

One of the most important properties of a sequence is convergence. Informally, a sequence converges if it has a limit. Continuing informally, a (#Doubly infinite|singly-infinite) sequence has a limit if it approaches some value L, called the limit, as n becomes very large. That is, for an abstract sequence ${\displaystyle \{a_{n}\}}$ (with n running from 1 to infinity understood) the value of the an's approaches L as n approaches infinity, denoted

${\displaystyle \lim _{n\to \infty }a_{n}=L.}$

More precisely, the sequence converges if there exists a limit, L, such that we can make the remaining an's as close to L as we want by making n large enough.

We also consider two other cases. If the an's get arbitrarily large as n approaches infinity then we write ${\displaystyle \lim _{n\to \infty }a_{n}=\infty }$. In this case we say that the sequence ${\displaystyle \{a_{n}\}}$ diverges, or that it converges to infinity. If the an's become arbitrarily "large" negative numbers (large in magnitude) as n goes to positive infinity then we write ${\displaystyle \lim _{n\to \infty }a_{n}=-\infty }$ and say that the sequence diverges or converges to minus infinity.

### Definition of convergence

We first consider only sequences that can be written as ${\displaystyle \{a_{n}\}_{n=1}^{\infty }}$ with ${\displaystyle a_{n}\in \mathbb {R} }$ and write ${\displaystyle \{a_{n}\}}$ with the indexing set understood as ${\displaystyle \mathbb {N} }$. That is, we only consider sequences that are maps from the natural numbers to the real numbers - the sequences most often considered in real analysis. The generalizations to other types of sequences are considered in the following section and the main page limit of a sequence.

Let ${\displaystyle \{a_{n}\}}$ be a sequence. In words, the sequence ${\displaystyle \{a_{n}\}}$ is said to converge if there exists a number L such that no matter how close we want the an to be to L (say ε-close where ε>0), we can find a natural number N such that all terms {aN,aN,...} are that close to L (within ε of L). [1] This is often written more compactly using symbols. For instance,

${\displaystyle {\text{for all }}\epsilon >0,{\text{ there exists a natural number N such that }}L-\epsilon

In even more compact notation

${\displaystyle \forall \epsilon >0,\exists N\in \mathbb {N} {\text{ s.t. }}\forall n\geq N,|a_{n}-L|<\epsilon .}$

The difference in the definitions of convergence for (one-sided) sequences in complex analysis and metric spaces is that the absolute value <math<|a_n-L|[/itex] is interpreted as the distance in the complex plane (${\displaystyle {\sqrt {z^{*}z}}}$), and the distance under the appropriate metric, respectively.

### Applications and important results

Important results for convergence and limits of (one-sided) sequences of real numbers include the following. Note that these equalities are all true at least when both sides exist. For a discussion of when the existence of the limit on one side implies the existence of the the other see a real analysis text.

• The limit of a sequence is unique.
• ${\displaystyle \lim _{n\to \infty }(a_{n}\pm b_{n})=\lim _{n\to \infty }a_{n}\pm \lim _{n\to \infty }b_{n}}$
• ${\displaystyle \lim _{n\to \infty }ca_{n}=c\lim _{n\to \infty }a_{n}}$
• ${\displaystyle \lim _{n\to \infty }(a_{n}b_{n})=(\lim _{n\to \infty }a_{n})(\lim _{n\to \infty }b_{n})}$
• ${\displaystyle \lim _{n\to \infty }{\frac {a_{n}}{b_{n}}}={\frac {\lim _{n\to \infty }a_{n}}{\lim _{n\to \infty }b_{n}}}}$ provided ${\displaystyle \lim _{n\to \infty }b_{n}\neq 0}$
• ${\displaystyle \lim _{n\to \infty }a_{n}^{p}=\left[\lim _{n\to \infty }a_{n}\right]^{p}}$
• If ${\displaystyle a_{n}\leq b_{n}}$ for all n greater than some N, then ${\displaystyle \lim _{n\to \infty }a_{n}\leq \lim _{n\to \infty }b_{n}}$
• (Squeeze Theorem) If ${\displaystyle a_{n}\leq c_{n}\leq b_{n}}$ for all n>N, and ${\displaystyle \lim _{n\to \infty }a_{n}=L=\lim _{n\to \infty }b_{n}}$, then ${\displaystyle \lim _{n\to \infty }b_{n}=L}$.
• If a sequence is #Bounded|bounded and #Increasing and decreasing|monotonic then it is convergent.
• A sequence is convergent if and only if every subsequence is convergent.

### Cauchy sequences

sequence ${\displaystyle (x_{n}),}$ shown in blue, as ${\displaystyle x_{n}}$ versus ${\displaystyle n}$. Visually, we see that the sequence appears to be converging to some limit as the terms in the sequence become closer together. In the real numbers every Cauchy sequence converges to some limit.

A Cauchy sequence is a sequence whose terms become arbitrarily close together as n gets very large. The notion of a Cauchy sequence is important in the study of sequences in metric spaces, and, in particular, in real analysis. One particularly important result in real analysis is Cauchy characterization of convergence for sequences:

A sequence is convergent if and only if it is Cauchy.

## Series

The sum of the first n terms of a (one-sided) sequence forms the nth term in a sequence called a series (mathematics)|series. That is, the series of the sequence {an} is the sequence {Sn} given by

{\displaystyle {\begin{aligned}S_{1}&=&a_{1}&&&\\S_{2}&=&a_{1}&+a_{2}&&\\S_{3}&=&a_{1}&+a_{2}&+a_{3}&\\\vdots &&\vdots &&&\\S_{n}&=&a_{1}&+a_{2}&+a_{3}&+...\\\vdots &&\vdots &&&\end{aligned}}}.

We can also write the nth term of the the series as

${\displaystyle S_{N}=\sum _{n=1}^{N}a_{n}.}$

Then the concepts used to talk about sequences, such as convergence, carry over to series (the sequence of partial sums) and the properties can be characterized as properties of the underlying sequences (such as {an} in the last example). The limit, if it exists, of an infinite series (the series created from an infinite sequence) is written as

${\displaystyle \lim _{n\to \infty }=\sum _{n=1}^{\infty }a_{n}.}$

For more details and results, see series (mathematics)|series.

## Use in other fields of mathematics

### Vectors

Sequences over a field may also be viewed as Vector (geometric)|vectors in a vector space. Specifically, the set of F-valued sequences (where F is a field (mathematics)|field) is a function space (in fact, a product space) of F-valued functions over the set of natural numbers.

### Ordinal-indexed sequence

An Order_topology#Ordinal-indexed_sequences|ordinal-indexed sequence is a generalization of a sequence. If α is a limit ordinal and X is a set, an α-indexed sequence of elements of X is a function from α to X. In this terminology an ω-indexed sequence is an ordinary sequence.

### Sequences and automata

Automata or finite state machines can typically be thought of as directed graphs, with edges labeled using some specific alphabet, Σ. Most familiar types of automata transition from state to state by reading input letters from Σ, following edges with matching labels; the ordered input for such an automaton forms a sequence called a word (or input word). The sequence of states encountered by the automaton when processing a word is called a run. A nondeterministic automaton may have unlabeled or duplicate out-edges for any state, giving more than one successor for some input letter. This is typically thought of as producing multiple possible runs for a given word, each being a sequence of single states, rather than producing a single run that is a sequence of sets of states; however, 'run' is occasionally used to mean the latter.

### Analysis

In mathematical analysis, when talking about sequences, one will generally consider sequences of the form

${\displaystyle {x_{1},x_{2},x_{3},\dots }{\text{ or }}{x_{0},x_{1},x_{2},\dots }\,}$

which is to say, infinite sequences of elements indexed by natural numbers.

It may be convenient to have the sequence start with an index different from 1 or 0. For example, the sequence defined by xn = 1/logarithm|log(n) would be defined only for n ≥ 2. When talking about such infinite sequences, it is usually sufficient (and does not change much for most considerations) to assume that the members of the sequence are defined at least for all indices large enough, that is, greater than some given N.

The most elementary type of sequences are numerical ones, that is, sequences of real or complex numbers. This type can be generalized to sequences of elements of some vector space. In analysis, the vector spaces considered are often function spaces. Even more generally, one can study sequences with elements in some topological space.

If S is endowed with a topology, then it becomes possible to consider convergence of an infinite sequence in S. Such considerations involve the concept of the limit of a sequence.

If A is a set, the free monoid over A (denoted A*) is a monoid containing all the finite sequences (or strings) of zero or more elements drawn from A, with the binary operation of concatenation. The free semigroup A+ is the subsemigroup of A* containing all elements except the empty sequence.

### Infinite sequences in theoretical computer science

Infinite sequences of numerical digits (or characters) drawn from a finite alphabet are of particular interest in theoretical computer science. They are often referred to simply as sequences or streams, as opposed to finite strings. Infinite binary sequences, for instance, are infinite sequences of bits (characters drawn from the alphabet {0,1}). The set C = {0, 1} of all infinite, binary sequences is sometimes called the Cantor space.

An infinite binary sequence can represent a formal language (a set of strings) by setting the n th bit of the sequence to 1 if and only if the n th string (in shortlex order) is in the language. Therefore, the study of complexity classes, which are sets of languages, may be regarded as studying sets of infinite sequences.

An infinite sequence drawn from the alphabet {0, 1, ..., b−1} may also represent a real number expressed in the base-b positional number system. This equivalence is often used to bring the techniques of real analysis to bear on complexity classes.

In particular, the term sequence space usually refers to a linear subspace of the set of all possible infinite sequences with elements in ${\displaystyle \mathbb {C} }$