{
  "id": "set-builder-notation",
  "title": "Set-builder Notation",
  "lang": "en",
  "source_lang": "en",
  "summary": "Set-builder notation specifies a set by describing the conditions its elements satisfy, rather than listing those elements individually.",
  "category": "mathematics",
  "subcategory": "discrete-logic",
  "type": "concept",
  "aliases": [
    "Set comprehension notation",
    "Set abstraction notation"
  ],
  "generated_at": "2026-11-05",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/set-builder-notation/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/set-builder-notation/",
      "json": "https://aiwiki.page/zh/set-builder-notation.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "Set-builder notation is a mathematical notation for defining a set through a condition that identifies its elements. A typical expression is\n\n\\[\\{x\\in A\\mid P(x)\\},\\]\n\nread as “the set of all \\(x\\) in \\(A\\) such that \\(P(x)\\).” Here \\(A\\) supplies the domain from which elements are selected, and \\(P(x)\\) states the condition they must satisfy. The notation is used throughout mathematics to describe finite and infinite sets, express relationships, and construct mathematical objects. In axiomatic set theory, its use is subject to rules governing which collections exist as sets."
    },
    {
      "heading": "Basic syntax and meaning",
      "text": "The expression\n\n\\[B=\\{x\\in A\\mid P(x)\\}\\]\n\ndefines the subset of \\(A\\) consisting exactly of the elements for which \\(P(x)\\) holds. Its meaning can be expressed by the membership equivalence\n\n\\[y\\in B \\quad\\Longleftrightarrow\\quad y\\in A\\ \\text{and}\\ P(y).\\]\n\nThe main components are:\n\n- Braces \\(\\{\\ \\}\\), indicating a set.\n- A variable, such as \\(x\\), representing a possible element.\n- A domain, such as \\(A\\), specifying the available elements.\n- A condition, such as \\(P(x)\\), determining which elements are included.\n\nA colon often replaces the vertical bar:\n\n\\[\\{x\\in A:P(x)\\}.\\]\n\nBoth separators mean “such that.” Conditions may be written in mathematical symbols, ordinary language, or a combination of the two.\n\nFor example,\n\n\\[\\{n\\in\\mathbb Z\\mid -2\\le n\\le 2\\} =\\{-2,-1,0,1,2\\},\\]\n\nwhere \\(\\mathbb Z\\) denotes the integers. The expression on the left uses set-builder notation; the expression on the right uses roster notation, which explicitly lists the elements.\n\nAn infinite set can be specified just as directly:\n\n\\[\\{n\\in\\mathbb Z\\mid n>0\\}.\\]\n\nUnlike a list ending in an ellipsis, this description states an exact membership rule without requiring the reader to infer a pattern."
    },
    {
      "heading": "The role of the domain",
      "text": "The domain is part of the definition, not merely a stylistic addition. The same condition can select different sets from different domains. For example,\n\n\\[\\{x\\in\\mathbb R\\mid x^2=2\\} =\\{-\\sqrt2,\\sqrt2\\},\\]\n\nwhereas\n\n\\[\\{x\\in\\mathbb Q\\mid x^2=2\\} =\\varnothing.\\]\n\nHere \\(\\mathbb R\\) denotes the real numbers, \\(\\mathbb Q\\) the rational numbers, and \\(\\varnothing\\) the empty set.\n\nWhen the domain is already clear, it may be omitted:\n\n\\[\\{x\\mid x>0\\}.\\]\n\nSuch an expression relies on context. It could describe positive real numbers, positive integers, or another collection in which an ordering is understood. Explicitly stating the domain avoids this ambiguity.\n\nDefinitions can also depend on parameters. For a real parameter \\(a\\),\n\n\\[S_a=\\{x\\in\\mathbb R\\mid x>a\\}\\]\n\ndefines a family of sets, one for each value of \\(a\\)."
    },
    {
      "heading": "Selection and image forms",
      "text": "Two closely related forms of set-builder notation are common.\n\nSelecting elements\n\nThe selection form\n\n\\[\\{x\\in A\\mid P(x)\\}\\]\n\nretains those elements of \\(A\\) satisfying a condition. For example,\n\n\\[\\{n\\in\\mathbb Z\\mid n=2k\\text{ for some }k\\in\\mathbb Z\\}\\]\n\nis the set of even integers.\n\nConditions may involve several requirements:\n\n\\[\\{x\\in\\mathbb R\\mid x\\ge 0\\text{ and }x^2<9\\}.\\]\n\nThis set consists of the real numbers from \\(0\\), inclusive, to \\(3\\), exclusive.\n\nCollecting values of an expression\n\nThe image form\n\n\\[\\{f(x)\\mid x\\in A\\}\\]\n\ncollects the values of a function \\(f\\) as its input ranges over \\(A\\). It is the image \\(f[A]\\), also commonly written \\(f(A)\\).\n\nFor example,\n\n\\[\\{n^2\\mid n\\in\\mathbb Z\\} =\\{0,1,4,9,16,\\ldots\\}.\\]\n\nIts membership rule is\n\n\\[y\\in\\{n^2\\mid n\\in\\mathbb Z\\} \\quad\\Longleftrightarrow\\quad \\exists n\\in\\mathbb Z\\;(y=n^2).\\]\n\nSelection and transformation can be combined:\n\n\\[\\{f(x)\\mid x\\in A,\\ P(x)\\}.\\]\n\nThis first restricts the inputs to those satisfying \\(P\\), then collects their function values.\n\nThe distinction between the two forms matters:\n\n\\[\\{x\\in\\mathbb Z\\mid x^2<4\\}=\\{-1,0,1\\},\\]\n\nbut\n\n\\[\\{x^2\\mid x\\in\\mathbb Z,\\ x^2<4\\}=\\{0,1\\}.\\]\n\nThe first set contains selected inputs; the second contains their squares."
    },
    {
      "heading": "Variables, scope, and logical conditions",
      "text": "Set-builder notation binds the variables over which it ranges. Renaming a bound variable does not change the resulting set:\n\n\\[\\{x\\in A\\mid P(x)\\} = \\{t\\in A\\mid P(t)\\},\\]\n\nprovided the renaming does not change the meaning of other variables.\n\nBy contrast, in\n\n\\[\\{x\\in\\mathbb R\\mid x>a\\},\\]\n\n\\(x\\) is bound by the construction, while \\(a\\) is a free parameter.\n\nConditions may use the quantifiers and connectives of first-order logic. For example,\n\n\\[\\{n\\in\\mathbb Z\\mid \\exists k\\in\\mathbb Z,\\ n=2k\\}\\]\n\nuses existential quantification to define the even integers. Conjunction, disjunction, and negation allow more elaborate membership conditions.\n\nSeveral variables may be used to construct tuples. For sets \\(A\\) and \\(B\\),\n\n\\[\\{(a,b)\\mid a\\in A,\\ b\\in B\\}\\]\n\nis their Cartesian product. Its elements are ordered pairs, not the individual entries of those pairs.\n\nA binary relation can be specified by restricting such pairs:\n\n\\[R=\\{(m,n)\\in\\mathbb Z\\times\\mathbb Z\\mid m<n\\}.\\]"
    },
    {
      "heading": "Order and repeated values",
      "text": "Set-builder notation describes a set, not a sequence or a multiset. Consequently:\n\n- The order in which possible elements are considered is irrelevant.\n- Repeated occurrences of the same value do not create additional elements.\n\nFor example,\n\n\\[\\{n^2\\mid n\\in\\{-2,-1,0,1,2\\}\\} =\\{0,1,4\\}.\\]\n\nAlthough both \\(2\\) and \\(-2\\) produce \\(4\\), the resulting set contains \\(4\\) only once. Thus the number of inputs need not equal the cardinality of the resulting image set.\n\nLikewise, different conditions can define the same set. What matters is whether they yield exactly the same members, not whether their written descriptions are identical."
    },
    {
      "heading": "Common applications",
      "text": "Set-builder notation provides concise definitions across mathematical subjects.\n\nSolution sets. An equation can be associated with the set of all values satisfying it:\n\n\\[S=\\{x\\in\\mathbb R\\mid x^2-5x+6=0\\}=\\{2,3\\}.\\]\n\nFunction graphs. The graph of a function \\(f:A\\to B\\) is\n\n\\[\\{(x,f(x))\\mid x\\in A\\}.\\]\n\nPower sets. The power set of \\(A\\) is\n\n\\[\\mathcal P(A)=\\{B\\mid B\\subseteq A\\}.\\]\n\nThis expression denotes a set whose elements are themselves sets.\n\nOptimization. A feasible set can be described by constraints:\n\n\\[F=\\{x\\in\\mathbb R^n\\mid g_i(x)\\le 0 \\text{ for }i=1,\\ldots,m\\}.\\]\n\nProbability. An event may be expressed as a subset of a sample space:\n\n\\[\\{\\omega\\in\\Omega\\mid X(\\omega)>a\\}.\\]\n\nIn a formal probability model, this subset must also belong to the model’s designated collection of measurable events."
    },
    {
      "heading": "Foundational restrictions",
      "text": "A meaningful condition does not automatically determine a set. Unrestricted comprehension—the principle that every condition defines a set of all objects satisfying it—leads to contradictions.\n\nThe standard example is Russell’s paradox. If\n\n\\[R=\\{x\\mid x\\notin x\\}\\]\n\nwere a set, its defining condition would imply\n\n\\[R\\in R\\quad\\Longleftrightarrow\\quad R\\notin R,\\]\n\na contradiction.\n\nIn Zermelo–Fraenkel set theory, the axiom schema of separation instead permits selection from an already existing set:\n\n\\[\\{x\\in A\\mid P(x)\\}.\\]\n\nMore precisely, each allowed formula \\(P\\), with suitable parameters, determines a subset of \\(A\\). Separation does not provide a universal set from which every conceivable collection can be selected.\n\nImage constructions such as\n\n\\[\\{f(x)\\mid x\\in A\\}\\]\n\nare supported by the axiom schema of replacement when the defining rule assigns exactly one output to each input. Other constructions rely on additional axioms; for example, the existence of \\(\\mathcal P(A)\\) is supplied by the power set axiom.\n\nSet-builder notation therefore describes membership conditions, but the surrounding mathematical theory determines whether the collection described exists as a set."
    }
  ],
  "links": [
    "set-mathematics",
    "set-theory",
    "subset",
    "integer",
    "real-number",
    "rational-number",
    "empty-set",
    "mathematical-function",
    "image-of-a-function",
    "first-order-logic",
    "cartesian-product",
    "ordered-pair",
    "binary-relation",
    "cardinality",
    "equation",
    "graph-of-a-function",
    "power-set",
    "feasible-set",
    "event-probability",
    "russells-paradox",
    "zermelo-fraenkel-set-theory"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}