{
  "id": "tuple",
  "title": "Tuple",
  "lang": "en",
  "source_lang": "en",
  "summary": "A tuple is an ordered collection of entries, distinguished by their positions, that provides a basic representation of coordinates, function inputs, relations, and structured data.",
  "category": "mathematics",
  "subcategory": "discrete-logic",
  "type": "concept",
  "aliases": [
    "Ordered tuple",
    "n-tuple",
    "Ordered n-tuple"
  ],
  "generated_at": "2026-11-04",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/tuple/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/tuple/",
      "json": "https://aiwiki.page/zh/tuple.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "A tuple is an ordered collection of entries in which each entry occupies a specified position. In mathematics, a tuple usually has a finite length: an \\(n\\)-tuple contains exactly \\(n\\) entries and is written \\((a_1,\\ldots,a_n)\\). Entries may repeat and need not be objects of the same kind. Unlike a set, a tuple retains both the order of its entries and the number of times each entry occurs. Tuples are used to describe coordinates, inputs to functions, elements of products, and structured data in computer science."
    },
    {
      "heading": "Definition and notation",
      "text": "For a nonnegative integer \\(n\\), an \\(n\\)-tuple has the form\n\n\\[(a_1,a_2,\\ldots,a_n).\\]\n\nThe objects \\(a_i\\) are called its entries, components, or coordinates, and \\(n\\) is its length. In the context of operations and relations, the number of argument positions is often called the arity.\n\nTwo tuples are equal precisely when they have the same length and corresponding entries are equal:\n\n\\[(a_1,\\ldots,a_n)=(b_1,\\ldots,b_n) \\quad\\Longleftrightarrow\\quad a_i=b_i\\text{ for every }i\\in\\{1,\\ldots,n\\}.\\]\n\nThus,\n\n\\[(2,5)\\ne(5,2), \\qquad (2,2,5)\\ne(2,5).\\]\n\nBy contrast, the sets \\(\\{2,5\\}\\), \\(\\{5,2\\}\\), and \\(\\{2,2,5\\}\\) are equal.\n\nCommon special cases are:\n\n- A 0-tuple, or empty tuple, written \\(()\\), has no entries.\n- A 1-tuple, or singleton tuple, contains one entry.\n- A 2-tuple is an ordered pair.\n- A 3-tuple is an ordered triple.\n\nThe notation \\((a)\\) can be ambiguous because parentheses also serve to group expressions. Some contexts therefore write a singleton tuple as \\((a,)\\). Angle brackets, such as \\(\\langle a_1,\\ldots,a_n\\rangle\\), are another common convention.\n\nA tuple may itself contain tuples. The object \\(((a,b),c)\\) has two top-level entries, whereas \\((a,b,c)\\) has three. They can be related by a natural correspondence, but they are not automatically identical."
    },
    {
      "heading": "Formal constructions",
      "text": "Tuples as functions\n\nA uniform formal definition treats an \\(n\\)-tuple as a function whose domain is a fixed set of \\(n\\) positions. For example, with\n\n\\[I_n=\\{1,\\ldots,n\\},\\]\n\na tuple with entries in a set \\(A\\) is a function\n\n\\[t:I_n\\to A, \\qquad t(i)=a_i.\\]\n\nThis definition makes equality componentwise and distinguishes repeated entries by their positions. Zero-based indexing, using \\(\\{0,\\ldots,n-1\\}\\), provides an equivalent convention.\n\nWhen \\(n=0\\), the indexing set is the empty set. There is exactly one function from the empty set into any given set, so this construction provides a unique empty tuple. The empty tuple and the empty set play different conceptual roles, even when a particular set-theoretic encoding represents them by the same object.\n\nTuples built from ordered pairs\n\nIn set theory, tuples can also be constructed recursively from ordered pairs. One common encoding begins with the Kuratowski ordered pair:\n\n\\[(a,b)=\\bigl\\{\\{a\\},\\{a,b\\}\\bigr\\}.\\]\n\nThis construction ensures the defining equality property of ordered pairs:\n\n\\[(a,b)=(c,d)\\quad\\Longleftrightarrow\\quad a=c\\text{ and }b=d.\\]\n\nLonger tuples may then be encoded by nesting pairs, for example,\n\n\\[(a,b,c)\\ \\text{by}\\ ((a,b),c).\\]\n\nOther constructions nest in the opposite direction or build tuples by repeatedly adjoining entries to an empty tuple.\n\nThese encodings are not literally the same sets. They also require suitable conventions if objects of different lengths must always remain distinct. In ordinary mathematics, the essential properties are position, length, and componentwise equality, rather than the internal details of an encoding."
    },
    {
      "heading": "Cartesian products",
      "text": "Tuples are the elements of a Cartesian product. For sets \\(A_1,\\ldots,A_n\\),\n\n\\[A_1\\times\\cdots\\times A_n = \\{(a_1,\\ldots,a_n):a_i\\in A_i\\text{ for every }i\\}.\\]\n\nThe component sets may differ. For example,\n\n\\[(3,\\text{“blue”})\\in \\{1,2,3\\}\\times\\{\\text{“red”},\\text{“blue”}\\}.\\]\n\nWhen every component set is the same set \\(A\\), the product is denoted \\(A^n\\). If \\(A\\) is finite and contains \\(m\\) elements, then\n\n\\[|A^n|=m^n.\\]\n\nMore generally, for finite component sets,\n\n\\[|A_1\\times\\cdots\\times A_n| =\\prod_{i=1}^{n}|A_i|.\\]\n\nThe product of zero sets is conventionally a singleton whose sole element is the empty tuple. Consequently, \\(A^0=\\{()\\}\\), including when \\(A\\) is empty.\n\nEach position determines a coordinate projection:\n\n\\[\\pi_i:A_1\\times\\cdots\\times A_n\\to A_i, \\qquad \\pi_i(a_1,\\ldots,a_n)=a_i.\\]\n\nProjections formalize the operation of selecting an entry."
    },
    {
      "heading": "Tuples, sequences, and indexed families",
      "text": "A finite sequence can be modeled as a tuple, and the terms often overlap. Their emphasis differs: “tuple” commonly stresses a fixed number of positions, while “sequence” commonly stresses successive indexing, potentially without a finite endpoint.\n\nInfinite tuples are also used. A countably infinite tuple can be represented as\n\n\\[(a_1,a_2,a_3,\\ldots).\\]\n\nMore generally, an indexed family \\((a_i)_{i\\in I}\\) assigns an entry to every index in a set \\(I\\). Its entries may belong to different sets \\(A_i\\), in which case it is an element of the indexed product\n\n\\[\\prod_{i\\in I}A_i.\\]\n\nAn arbitrary index set need not have an order. In this broader setting, the essential feature is that each entry has a specified index, not that all entries form a linear succession."
    },
    {
      "heading": "Mathematical applications",
      "text": "Coordinates and vectors\n\nA point in Euclidean space \\(\\mathbb{R}^n\\) is represented by an \\(n\\)-tuple of real numbers. For example, \\((2,-1,4)\\) specifies a point in three-dimensional space relative to a chosen Cartesian coordinate system.\n\nTuples also represent vectors. With componentwise addition and scalar multiplication, \\(\\mathbb{R}^n\\) forms a vector space:\n\n\\[(a_1,\\ldots,a_n)+(b_1,\\ldots,b_n) =(a_1+b_1,\\ldots,a_n+b_n).\\]\n\nHowever, an arbitrary tuple is not automatically a vector: vector operations require suitable underlying algebraic structure.\n\nAn abstract vector acquires a coordinate tuple after a basis is chosen. Changing the basis generally changes the tuple without changing the vector.\n\nFunctions and relations\n\nA function of several variables may be written\n\n\\[f:A_1\\times\\cdots\\times A_n\\to B.\\]\n\nThe familiar expression \\(f(a_1,\\ldots,a_n)\\) treats the tuple \\((a_1,\\ldots,a_n)\\) as an input from the product domain.\n\nAn \\(n\\)-ary relation on a set \\(A\\) is a subset of \\(A^n\\). A binary relation, for example, is a set of ordered pairs. Tuples therefore provide a common language for both function arguments and relational statements.\n\nProbability\n\nGiven random variables \\(X_1,\\ldots,X_n\\), the tuple\n\n\\[(X_1,\\ldots,X_n)\\]\n\nforms a random vector when the components are real-valued. Its joint probability distribution describes probabilities involving the components together. The order identifies which random variable occupies each coordinate."
    },
    {
      "heading": "Tuples in computing",
      "text": "Programming languages use tuples to group a fixed number of values into one structured object. Typical uses include returning several results from a function, representing coordinate records, and collecting values of different types.\n\nA tuple type is commonly modeled as a product type. For example, a type consisting of an integer paired with a string has two positions with different permitted value types. Tuple operations often include indexing, construction, and unpacking into separate variables.\n\nImplementation rules vary by language. Python tuples are immutable as containers, although an entry may refer to a mutable object. Immutability is therefore not an intrinsic property of the mathematical concept, nor does it necessarily mean that everything accessible through a tuple is unchangeable.\n\nIn the relational model of databases, a tuple represents a row. Formally, database tuples are often modeled as mappings from attribute names to values rather than as position-indexed lists. Attribute identity then matters, while the displayed order of columns is not part of the logical meaning of the row."
    }
  ],
  "links": [
    "mathematics",
    "set-mathematics",
    "computer-science",
    "integer",
    "ordered-pair",
    "mathematical-function",
    "empty-set",
    "set-theory",
    "cartesian-product",
    "sequence",
    "euclidean-space",
    "real-number",
    "cartesian-coordinate-system",
    "vector-space",
    "basis-linear-algebra",
    "subset",
    "binary-relation",
    "random-variable",
    "joint-probability-distribution"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}