Tuples are usually written by listing the elements within parentheses "( )" and separated by commas; for example, (2, 7, 4, 1, 7) denotes a 5-tuple.
[a] An n-tuple can be formally defined as the image of a function that has the set of the n first natural numbers as its domain.
[2] Many programming languages offer an alternative to tuples, known as record types, featuring unordered elements accessed by label.
[3] A few programming languages combine ordered tuple product types and unordered record types into a single construct, as in C structs and Haskell records.
Relational databases may formally identify their rows (records) as tuples.
Tuples also occur in relational algebra; when programming the semantic web with the Resource Description Framework (RDF); in linguistics;[4] and in philosophy.
[5] The term originated as an abstraction of the sequence: single, couple/double, triple, quadruple, quintuple, sextuple, septuple, octuple, ..., n‑tuple, ..., where the prefixes are taken from the Latin names of the numerals.
may be identified with the (surjective) function with domain and with codomain that is defined at
is the function defined by in which case the equality necessarily holds.
Functions are commonly identified with their graphs, which is a certain set of ordered pairs.
can be defined as: Another way of modeling tuples in set theory is as nested ordered pairs.
This approach assumes that the notion of ordered pair has already been defined.
This definition can be applied recursively to the (n − 1)-tuple: Thus, for example: A variant of this definition starts "peeling off" elements from the other end: This definition can be applied recursively: Thus, for example: Using Kuratowski's representation for an ordered pair, the second definition above can be reformulated in terms of pure set theory: In this formulation: In discrete mathematics, especially combinatorics and finite probability theory, n-tuples arise in the context of various counting problems and are treated more informally as ordered lists of length n.[7] n-tuples whose entries come from a set of m elements are also called arrangements with repetition, permutations of a multiset and, in some non-English literature, variations with repetition.
Formally: and the projections are term constructors: The tuple with labeled elements used in the relational model has a record type.