# Subsequence

In mathematics, a **subsequence** is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements. For example, the sequence is a subsequence of . They should not be confused with substring which is a refinement of subsequence.

## Common subsequence

Given two sequences *X* and *Y*, a sequence *G* is said to be a *common subsequence* of *X* and *Y*, if *G* is a subsequence of both *X* and *Y*. For example, if

then a common subsequence of *X* and *Y* could be

This would *not* be the *longest common subsequence*, since *G* only has length 3, and the common subsequence has length 4. The longest common subsequence of *X* and *Y* is .

## Applications

Subsequences have applications to computer science,^{[1]} especially in the discipline of bioinformatics, where computers are used to compare, analyze, and store DNA strands.

Take two strands of DNA, say:

- ORG
_{1}=`ACGGTGTCGTGCTATGCTGATGCTGACTTATATGCTA`

and - ORG
_{2}=`CGTTCGGCTATCGTACGTTCTATTCTATGATTTCTAA`.

Subsequences are used to determine how similar the two strands of DNA are, using the DNA bases: adenine, guanine, cytosine and thymine.

## Theorems

- Every infinite sequence of real numbers has an infinite monotone subsequence (This is a lemma used in the proof of the Bolzano–Weierstrass theorem).
- Every bounded infinite sequence in
**R**^{n}has a convergent subsequence (This is the Bolzano–Weierstrass theorem). - For every integers
*r*and*s*, every finite sequence of length at least (*r*− 1)(*s*− 1) + 1 contains a monotonically increasing subsequence of length*r**or*a monotonically decreasing subsequence of length*s*(This is the Erdős–Szekeres theorem).

## See also

- Subsequential limit - the limit of some subsequence.
- Limit superior and limit inferior
- Longest increasing subsequence problem

## Notes

- ↑ In computer science,
*string*is often used as a synonym for*sequence*, but it is important to note that*substring*and*subsequence*are not synonyms. Substrings are*consecutive*parts of a string, while subsequences need not be. This means that a substring of a string is always a subsequence of the string, but a subsequence of a string is not always a substring of the string, see: {{#invoke:citation/CS1|citation |CitationClass=book }}

*This article incorporates material from subsequence on PlanetMath, which is licensed under the Creative Commons Attribution/Share-Alike License.*