{
  "id": "subsequence",
  "title": "Subsequence",
  "lang": "en",
  "source_lang": "en",
  "summary": "A subsequence is a sequence formed by selecting terms of another sequence in their original order, without requiring the selected terms to be consecutive.",
  "category": "mathematics",
  "subcategory": "discrete-logic",
  "type": "concept",
  "aliases": [],
  "generated_at": "2026-11-05",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/subsequence/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/subsequence/",
      "json": "https://aiwiki.page/zh/subsequence.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "A subsequence is a sequence obtained from another sequence by retaining selected terms in their original order. Terms may be skipped, but their order cannot be changed. In mathematical analysis, subsequences are used to study convergence, oscillation, and compactness. In computer science and combinatorics, finite subsequences describe order-preserving selections from strings, lists, and other ordered data."
    },
    {
      "heading": "Definition and notation",
      "text": "Let \\((x_n)_{n\\geq 1}\\) be a sequence with values in a set \\(X\\). An infinite subsequence has the form\n\n\\[(x_{n_k})_{k\\geq 1},\\]\n\nwhere\n\n\\[n_1<n_2<n_3<\\cdots\\]\n\nare positive integers. The indices must be strictly increasing. Consequently, \\(n_k\\geq k\\) and \\(n_k\\to\\infty\\).\n\nEquivalently, regarding a sequence as a function \\(x:\\mathbb{N}\\to X\\), a subsequence is the composition \\(x\\circ\\phi\\), where \\(\\phi:\\mathbb{N}\\to\\mathbb{N}\\) is strictly increasing. Such an indexing function is necessarily an injective function, although injectivity alone is insufficient: it would permit reordering.\n\nFor example, from\n\n\\[x_n=\\frac{1}{n},\\]\n\nselecting the even indices produces\n\n\\[x_{2k}=\\frac{1}{2k},\\]\n\nwhile selecting square indices produces\n\n\\[x_{k^2}=\\frac{1}{k^2}.\\]\n\nThe selected positions must be distinct; the selected values need not be. A sequence containing infinitely many occurrences of the same value has a constant subsequence.\n\nFor a finite sequence \\((x_1,\\ldots,x_n)\\), a subsequence of length \\(r\\) is\n\n\\[(x_{i_1},\\ldots,x_{i_r}), \\qquad 1\\leq i_1<\\cdots<i_r\\leq n.\\]\n\nThe empty sequence is usually permitted as a finite subsequence. Every sequence is a subsequence of itself, and a subsequence of a subsequence is again a subsequence of the original sequence."
    },
    {
      "heading": "Distinction from related concepts",
      "text": "A subsequence differs from several other kinds of selection or rearrangement.\n\n- Subset: A subset records membership, not positions or order. The sequences \\((a,b,a)\\) and \\((a,a,b)\\) have the same set of values but generally have different subsequences.\n- Contiguous segment: A contiguous segment retains consecutive positions. In string terminology, this is a substring. Every substring is a subsequence, but not every subsequence is a substring. For example, “ace” is a subsequence of “abcde” but not a substring.\n- Rearrangement: A rearrangement changes the order of terms, typically through a permutation of the indices. A subsequence preserves order.\n- Subseries: A subseries of an infinite series is formed by retaining selected summands and summing them in their original order. Its selected summands form a subsequence of the original sequence of summands, but the resulting partial sums are generally not a subsequence of the original partial sums.\n\nIn analysis, “subsequence” usually means an infinite subsequence unless stated otherwise. In finite combinatorics and algorithms, it commonly means a finite one."
    },
    {
      "heading": "Subsequences and convergence",
      "text": "Inheritance of a limit\n\nIf a sequence converges to \\(L\\), every subsequence converges to the same \\(L\\). In a metric space with distance \\(d\\), the definition of a limit gives\n\n\\[x_n\\to L \\quad\\Longrightarrow\\quad x_{n_k}\\to L.\\]\n\nIndeed, for every \\(\\varepsilon>0\\), all sufficiently late terms satisfy \\(d(x_n,L)<\\varepsilon\\). Since \\(n_k\\to\\infty\\), all sufficiently late terms of the subsequence satisfy the same inequality.\n\nDeleting finitely many initial terms therefore does not affect convergence or the limit.\n\nThe converse fails if only one convergent subsequence is known. For example,\n\n\\[x_n=(-1)^n\\]\n\ndoes not converge, although\n\n\\[x_{2k}=1 \\qquad\\text{and}\\qquad x_{2k-1}=-1\\]\n\nare convergent subsequences. In a metric space, two subsequences with different limits prove that the original sequence diverges.\n\nSubsequential limits\n\nA subsequential limit is a point that is the limit of some subsequence. In a metric space, \\(L\\) is a subsequential limit of \\((x_n)\\) exactly when every open ball centered at \\(L\\) contains \\(x_n\\) for infinitely many indices \\(n\\).\n\nThe reference to indices matters. A constant sequence has a subsequential limit even though its set of values contains only one point. Thus, a subsequential limit is not necessarily an accumulation point of the set of distinct sequence values.\n\nA bounded sequence of real numbers converges if and only if it has exactly one subsequential limit. Boundedness cannot simply be omitted: the sequence defined by\n\n\\[x_{2k}=0, \\qquad x_{2k-1}=k\\]\n\nhas \\(0\\) as its only finite subsequential limit but does not converge in \\(\\mathbb{R}\\).\n\nA more general criterion, valid in metric spaces, is:\n\nA sequence converges to \\(L\\) if and only if every subsequence has a further subsequence converging to \\(L\\).\n\nIf the original sequence fails to converge to \\(L\\), some \\(\\varepsilon>0\\) allows a subsequence whose terms all remain at distance at least \\(\\varepsilon\\) from \\(L\\). No further subsequence of that sequence can converge to \\(L\\)."
    },
    {
      "heading": "Existence of convergent subsequences",
      "text": "The Bolzano–Weierstrass theorem states that every bounded sequence in finite-dimensional Euclidean space has a convergent subsequence. The original sequence need not converge: boundedness guarantees that some order-preserving selection does.\n\nFor real sequences, a standard proof uses the fact that every real sequence has a monotone subsequence. If the original sequence is bounded, that monotone subsequence is bounded and therefore convergent.\n\nThe finite-dimensional assumption is essential. In an infinite-dimensional Hilbert space, an infinite orthonormal sequence is bounded, but the distance between any two distinct terms is \\(\\sqrt{2}\\). It therefore has no subsequence converging in norm.\n\nA related fact concerns a Cauchy sequence: if it has a subsequence converging to \\(L\\), then the entire sequence converges to \\(L\\). The Cauchy condition forces all sufficiently late terms to lie close to the late terms of the convergent subsequence.\n\nSequential compactness\n\nA space is sequentially compact if every sequence in it has a subsequence converging to a point of the space.\n\nIn metric spaces, sequential compactness is equivalent to being a compact space. Consequently, every sequence in a closed, bounded subset of \\(\\mathbb{R}^d\\) has a subsequence converging within that subset.\n\nFor a general topological space, compactness and sequential compactness need not be equivalent. Sequences alone do not capture every aspect of general topology; nets and filters provide broader notions of convergence."
    },
    {
      "heading": "Subsequences in probability",
      "text": "Subsequences also relate different modes of convergence of random variables. If\n\n\\[X_n\\xrightarrow{\\mathbb{P}}X,\\]\n\nmeaning that \\(X_n\\) converges to \\(X\\) in probability, then there is a subsequence satisfying\n\n\\[X_{n_k}\\to X \\quad\\text{almost surely}.\\]\n\nThe full sequence need not converge almost surely. The selection can be made so that probabilities of suitably defined error events are summable, which ensures that only finitely many of those events occur almost surely.\n\nMore precisely, convergence in probability is equivalent to the statement that every subsequence has a further subsequence converging almost surely to the same random variable \\(X\\). The existence of just one almost surely convergent subsequence is not sufficient."
    },
    {
      "heading": "Finite subsequences and algorithms",
      "text": "For a sequence of length \\(n\\), there are \\(2^n\\) choices of positions to retain, including the empty choice. There are\n\n\\[\\binom{n}{r}\\]\n\nchoices retaining exactly \\(r\\) positions, where the expression is a binomial coefficient. Different choices may yield identical value sequences when entries repeat. Thus, \\(2^n\\) counts selections of positions, not necessarily distinct resulting sequences.\n\nSeveral important computational problems concern subsequences:\n\n- Subsequence testing: Determining whether one sequence is a subsequence of another. A left-to-right scan that matches each required term to its earliest available occurrence solves the problem in linear time.\n- Longest common subsequence: Finding a longest sequence that is a subsequence of each of two given sequences. A standard dynamic-programming algorithm uses \\(O(mn)\\) time for input lengths \\(m\\) and \\(n\\).\n- Longest increasing subsequence: Finding a longest strictly increasing subsequence of an ordered sequence. Standard comparison-based algorithms solve this problem in \\(O(n\\log n)\\) time.\n\nThese running times use big-O notation and assume constant-time comparisons of individual entries. Applications include file comparison, sequence alignment, and identifying order-preserving patterns in data. For increasing-subsequence problems, distinguishing strictly increasing from nondecreasing is essential, since repeated values are treated differently."
    }
  ],
  "links": [
    "sequence",
    "mathematical-analysis",
    "computer-science",
    "combinatorics",
    "mathematical-function",
    "injective-function",
    "subset",
    "permutation",
    "infinite-series",
    "metric-space",
    "limit",
    "real-number",
    "bolzano-weierstrass-theorem",
    "euclidean-space",
    "hilbert-space",
    "cauchy-sequence",
    "compact-space",
    "topological-space",
    "random-variable",
    "convergence-in-probability",
    "almost-surely",
    "binomial-coefficient",
    "big-o-notation"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}