Fact-checked by Grok 2 weeks ago

Disjoint union

In , the disjoint union of two sets A and B is a set-theoretic construction defined as the set of ordered pairs \{(a, 1) \mid a \in A\} \cup \{(b, 2) \mid b \in B\}, which combines all elements from A and B while tagging each with an identifier to ensure they remain distinguishable regardless of any potential overlap in the original sets. This operation preserves the additivity for finite sets, such that if A and B are finite, then the cardinality of their disjoint union equals |A| + |B|. For example, if A = \{1, 2\} and B = \{2, 3\}, the disjoint union includes (1,1), (2,1), (2,2), and (3,2), avoiding duplication of the shared element 2. The concept generalizes to a family of sets \{A_i\}_{i \in I} indexed by a set I, forming \bigsqcup_{i \in I} A_i = \bigcup_{i \in I} (A_i \times \{i\}), where elements are pairs (a, i) with a \in A_i. This ensures the images of the canonical injections A_i \hookrightarrow \bigsqcup_{i \in I} A_i are pairwise disjoint, making the disjoint union the unique (up to isomorphism) set satisfying the universal property that for any set X and family of functions f_i: A_i \to X, there exists a unique function \overline{f}: \bigsqcup_{i \in I} A_i \to X such that \overline{f} \circ \iota_i = f_i for each i. In the category of sets, the disjoint union is precisely the coproduct, serving as the categorical dual to the product. Beyond set theory, the disjoint union extends to other mathematical structures, such as topological spaces, where the disjoint union topology on \bigsqcup_{\alpha} X_{\alpha} equips the underlying set with the finest topology making each inclusion X_{\alpha} \hookrightarrow \bigsqcup_{\alpha} X_{\alpha} continuous; a subset is open if its intersection with each X_{\alpha} is open in X_{\alpha}. This construction is fundamental in algebraic topology for building spaces like wedges or suspensions and in measure theory for additivity over disjoint decompositions. In category theory more broadly, while the coproduct in the category of sets is disjoint, coproducts in other categories (e.g., pointed sets or groups) may involve additional identifications, such as the direct sum for abelian groups.

Introduction and Examples

Informal Description

The disjoint union provides a standard way to combine two or more sets, such as A and , into a single set in which elements originating from A remain distinguishable from those originating from , even if the sets share identical underlying elements. This approach ensures that the structure and provenance of each element are preserved during the merger, allowing for clear separation based on their source sets. In contrast to the ordinary of sets, which simply collects all unique elements and may inadvertently identify overlapping items without regard to their origins, the disjoint union addresses this issue by enforcing distinguishability, thereby maintaining the integrity of the individual sets' identities. This is particularly useful in scenarios where tracking element membership is essential to avoid unintended equivalences. The concept originated in with Georg Cantor's 1878 work, where he employed it to define operations on collections without presupposing that the sets were already disjoint.

Basic Example

Consider the sets A = \{1, 2\} and B = \{2, 3\}. Their ordinary is A \cup B = \{1, 2, 3\}, which contains only three elements because the shared value 2 is identified regardless of its origin. In contrast, the disjoint union A \sqcup B treats elements from A and B as distinct, even when they share the same value, resulting in a set with four elements that preserves about each element's source set. To compute A \sqcup B, tag each with an indicator of its originating set, such as "L" for from A and "R" for from B: the tagged version of A becomes \{(1, \text{L}), (2, \text{L})\}, and the tagged version of B becomes \{(2, \text{R}), (3, \text{R})\}. The disjoint is then the ordinary union of these tagged sets: A \sqcup B = \{(1, \text{L}), (2, \text{L})\} \cup \{(2, \text{R}), (3, \text{R})\} = \{(1, \text{L}), (2, \text{L}), (2, \text{R}), (3, \text{R})\}. Here, the two instances of 2 are now distinct—(2, \text{L}) represents the 2 from A, while (2, \text{R}) represents the 2 from B—ensuring no overlap or loss of provenance. This tagging approach builds on the basic intuition of distinguishability by explicitly marking origins to avoid conflating identical values from different sets. The following table illustrates the sets before and after the disjoint union:
Original SetsElements
A1, 2
B2, 3
A \cup B1, 2, 3 (3 elements)
A \sqcup B(1, L), (2, L), (2, R), (3, R) (4 elements)

Set-Theoretic Formalism

Tagged Union Construction

In , the tagged union construction defines the disjoint union of two sets A and B, denoted A \sqcup B, as the set (A \times \{0\}) \cup (B \times \{1\}), consisting of all ordered pairs (a, 0) for a \in A and (b, 1) for b \in B. The original sets are embedded into this union via injections i_A: A \to A \sqcup B defined by a \mapsto (a, 0) and i_B: B \to A \sqcup B defined by b \mapsto (b, 1); these mappings are injective because distinct elements in A (or B) produce distinct pairs due to the uniqueness of ordered pairs in . Disjointness follows directly from the construction: the sets A \times \{0\} and B \times \{1\} have no elements in common, as any supposed shared element (x, 0) = (y, 1) would require $0 = 1, which is impossible. As a result, the cardinality of the disjoint union is the sum of the individual cardinalities, |A \sqcup B| = [|A|](/page/Cardinality) + [|B|](/page/Cardinality). For the basic example of sets \{1,2\} and \{2,3\}, this tags the shared element 2 as (2, 0) and (2, 1) to ensure distinguishability.

Algebraic Properties

The disjoint union operation on sets, denoted A \sqcup B, is associative up to canonical isomorphism. Specifically, for sets A, B, and C, the disjoint union (A \sqcup B) \sqcup C is isomorphic to A \sqcup (B \sqcup C) via a bijection that recursively adjusts tags: elements tagged from the left-associative structure are remapped by incrementing the tag index appropriately to match the right-associative tagging. This isomorphism preserves the set structure and follows from the tagged construction of the disjoint union. The operation is also commutative up to isomorphism: A \sqcup B \cong B \sqcup A, achieved by a bijection that swaps the tags assigned to elements of A and B. This property ensures that the order of combining sets does not affect the resulting structure, up to relabeling of the distinguishing tags. The empty set \emptyset serves as a neutral element for the disjoint union: A \sqcup \emptyset \cong A via the identity map on A, as the empty set contributes no elements or tags. This extends to iterated finite or infinite disjoint unions, where adjoining empty sets leaves the union unchanged up to isomorphism. In the context of cardinal arithmetic, where the cardinality of the disjoint union corresponds to cardinal addition, the zero cardinal acts analogously as an identity. The disjoint union is compatible with set functions in a bifunctorial manner. Given functions f: A \to C and g: B \to D, there exists a unique induced function \overline{(f,g)}: A \sqcup B \to C \sqcup D defined by \overline{(f,g)}(a,0) = (f(a),0) for a \in A and \overline{(f,g)}(b,1) = (g(b),1) for b \in B, where 0 and 1 are the distinguishing tags. This construction ensures that the disjoint union respects the categorical structure of the category of sets.

Categorical Framework

Coproduct Interpretation

In , the disjoint union provides a fundamental example of a within the , Set, where objects are sets and morphisms are functions between them. The of two sets A and B, denoted A \sqcup B, is their disjoint union, equipped with injection morphisms i_A: A \to A \sqcup B and i_B: B \to A \sqcup B. These injections embed A and B into A \sqcup B such that their images are disjoint, ensuring no overlap between elements originating from A and those from B. This structure is characterized by a illustrating the injections i_A and i_B. For any set Z and any pair of f: A \to Z, g: B \to Z, there exists a h: A \sqcup B \to Z such that the following diagram commutes: \begin{CD} A @>f>> Z \\ @V i_A VV @VV id_Z V \\ A \sqcup B @>h>> Z \\ @A i_B AA @AA id_Z A \\ B @>g>> Z \end{CD} Here, h \circ i_A = f and h \circ i_B = g, with h factoring the pair (f, g) uniquely through the coproduct. The set-theoretic formalism of the tagged union construction realizes this coproduct concretely in Set, where elements of A \sqcup B are pairs (a, \text{tag}_A) or (b, \text{tag}_B) with distinct tags ensuring disjointness, thereby confirming the disjoint union as the categorical coproduct in this context.

Universal Property

The universal property of the disjoint union characterizes it as the coproduct in a category. Specifically, for objects A and B in a category \mathcal{C}, their coproduct A \sqcup B is equipped with morphisms (injections) i_A: A \to A \sqcup B and i_B: B \to A \sqcup B such that for any object Z in \mathcal{C} and any morphisms f: A \to Z, g: B \to Z, there exists a unique morphism h: A \sqcup B \to Z satisfying h \circ i_A = f and h \circ i_B = g. In the category of sets \mathbf{Set}, where the coproduct is realized as the disjoint union, the proof proceeds by explicit construction. The injections embed A and B into disjoint subsets of A \sqcup B, typically via tagging elements as pairs (a, 0) for a \in A and (b, 1) for b \in B. The unique morphism h is then defined piecewise: h((a, 0)) = f(a) and h((b, 1)) = g(b). This satisfies the required commutativity, and uniqueness follows because every element of A \sqcup B lies in exactly one tagged component, ensuring h is fully determined by its action on the images of i_A and i_B. This property generalizes to any category admitting coproducts, where the disjoint union (or its categorical analogue) satisfies the same mediating morphism condition without reference to underlying set structures.

Extensions and Variants

Disjoint Union in Topology

In topology, the disjoint union of two topological spaces (X, \tau_X) and (Y, \tau_Y) is constructed as the set-theoretic disjoint union X \sqcup Y = (X \times \{0\}) \cup (Y \times \{1\}), equipped with the disjoint union topology. This topology consists of all subsets of the form \bigcup (U_i \times \{i\}), where i \in \{0,1\} and each U_i is open in the corresponding space (i.e., U_0 \in \tau_X or U_1 \in \tau_Y); more precisely, the open sets are those that intersect X \times \{0\} in an open subset of X and Y \times \{1\} in an open subset of Y. This ensures that the topology on each component remains unchanged, with no "interaction" between the spaces—open sets cannot mix points from X and Y in a way that would require continuity across components. A key property of the disjoint union topology is that it makes X \sqcup Y the categorical coproduct of X and Y in the category \mathbf{Top} of topological spaces and continuous maps. Specifically, for any topological space Z and continuous maps f: X \to Z, g: Y \to Z, there exists a unique continuous map h: X \sqcup Y \to Z such that h|_X = f and h|_Y = g, induced by the inclusions of X and Y into the disjoint union. This coproduct structure aligns with the general categorical interpretation but specializes to continuous functions, preserving the openness of sets within each disjoint component without additional topological glue. For a example, consider the disjoint union of two copies of the real line \mathbb{R}, denoted \mathbb{R}_1 \sqcup \mathbb{R}_2, where \mathbb{R}_1 = \mathbb{R} \times \{1\} and \mathbb{R}_2 = \mathbb{R} \times \{2\} with the topologies inherited from the topology on \mathbb{R}. Open sets in this space are unions of open intervals from each copy, such as (a,b) \times \{1\} \cup (c,d) \times \{2\}, resulting in two parallel, separate "axes" that are topologically disconnected from one another—points from different copies cannot be connected by continuous paths within the space.

Disjoint Union Types in Computing

In typed programming languages such as and , a disjoint union type, often termed a sum type or , enables the representation of values that belong to one of several mutually exclusive types, with explicit tags to distinguish constructors and enforce at . This construction mirrors the from , where elements from different sets are paired with identifiers to avoid overlap. For instance, a disjoint union of types A and B, denoted A + B, permits values constructed as either a tagged element from A or from B, preventing unsafe unions that could lead to runtime errors in less strict languages. Key properties of disjoint union types include support for exhaustive , which requires handling all possible variants to ensure completeness, and their interpretation as in the category of types, where morphisms respect the disjoint structure. In practice, this exhaustiveness is checked by the : unhandled cases trigger , promoting robust error handling and reducing . The property ensures that functions on the can be defined by specifying behavior for each tagged component separately, facilitating modular code. A representative example is the Either type in , which defines a binary disjoint union. The type is declared as:
haskell
data Either a b = Left a | Right b
Construction involves applying Left to a value of type a or Right to a value of type b; for deconstruction, pattern matching via the either function or case expressions exhausts the possibilities:
haskell
either :: (a -> c) -> (b -> c) -> Either a b -> c
either leftCase rightCase (Left a)  = leftCase a
either leftCase rightCase (Right b) = rightCase b
This usage is conventional for error handling, with Left signaling failure and Right success, ensuring type-safe propagation of results. In , enums serve as disjoint unions, allowing variants with associated data. Consider an enum for network messages:
rust
enum IpAddrKind {
    V4,
    V6,
}
Or a more expressive variant with payloads:
rust
enum [Message](/page/Message) {
    Quit,
    Move { x: i32, y: i32 },
    Write([String](/page/String)),
}
Deconstruction occurs through match expressions, which the compiler verifies for exhaustiveness:
rust
let msg = Message::Write(String::from("hello"));
match msg {
    Message::Quit => println!("Quit"),
    Message::Move { x, y } => println!("Move to x: {}, y: {}", x, y),
    Message::Write(text) => println!("Write: {}", text),
}
This pattern matching guarantees all cases are covered, aligning with the type's disjoint nature and enabling safe handling of variant-specific logic.

References

  1. [1]
    None
    ### Summary of Disjoint Union from Set Theory Review
  2. [2]
    [PDF] Big unions
    172 —. Page 6. Disjoint unions. Definition 90 The disjoint union A ⊎ B of two sets A and B is the set. A ⊎ B = ({1} × A ...
  3. [3]
    [PDF] On the construction of new topological spaces from existing ones
    Disjoint unions. Given sets A and B, their disjoint union is the set A ` B whose elements are elements of exactly one of A or B.
  4. [4]
    Disjoint Union -- from Wolfram MathWorld
    The disjoint union combines all distinct elements of two sets, retaining original set membership as a distinguishing characteristic.
  5. [5]
    [PDF] Set Theory - UC Berkeley math
    Oct 8, 2021 · Then |X|+|Y | is defined to be the cardinality of X t Y , the disjoint union of X and Y 15. ... An important problem in the history of set theory ...
  6. [6]
    Earliest Uses of Symbols of Set Theory and Logic - MacTutor
    Aristotle used letters around 300 BC. Peano used ∩, ∪ in 1888, and ε for membership in 1889. Most symbols were introduced between 1880 and 1920.
  7. [7]
    disjoint union - PlanetMath.org
    Mar 22, 2013 · For example, in the category of pointed sets, the coproduct is the disjoint union with the distinguished points identified. In the category ...
  8. [8]
    [PDF] Set Theory in Computer Science A Gentle Introduction to ...
    Aug 11, 2013 · Yet another very useful construction is the disjoint union of an I-indexed set A = {Ai}i∈I , which is denoted Li∈I Ai, or just L A. It is ...
  9. [9]
    coproduct in nLab
    Apr 10, 2025 · The notion of coproduct is a generalization to arbitrary categories of the notion of disjoint union in the category Set.
  10. [10]
    Coproduct -- from Wolfram MathWorld
    The categorical notion which is dual to product. The coproduct of a family {X_i}_(i in I) of objects of a category is an object C=coproduct_(i in I)X_i.
  11. [11]
    None
    Below is a merged response summarizing the information on "disjoint union" across various segments of Enderton’s *Elements of Set Theory* (1977), based on the provided summaries. To retain all details in a dense and organized manner, I will use a table in CSV format for key information, followed by a narrative summary that integrates the remaining context. The response includes all properties (e.g., associativity, commutativity, identity, maps), definitions, locations, and useful URLs as mentioned.
  12. [12]
    [PDF] Chapter 2 - The category of sets - MIT OpenCourseWare
    The universal property of coproducts says the following. Any time we have a function X ر A and a function Y ر A, we get a unique function X \ Y ر A. For ...
  13. [13]
    [PDF] The Category of Sets - Princeton University
    Oct 16, 2016 · Intuitively speaking, the coproduct X q Y is the disjoint union of the sets. X and Y . ... One distinctive feature of the category of sets is its ...
  14. [14]
    [PDF] Mathematics 551 Algebra Fall 2006 Colimits and limits of Functors ...
    We showed in class that the disjoint union of sets together with the inclusions of each set into the disjoint union is the coproduct in the category of sets. 4.
  15. [15]
    [PDF] maclane-categories.pdf - MIT Mathematics
    ... Categories for the working mathematician/Saunders Mac Lane. -. 2nd ed. p. cm ... universal construction, that of direct and inverse limit, and that of ...
  16. [16]
    [PDF] On the construction of new topological spaces from existing ones
    “Attaching” a point just means taking a disjoint union. A vast library of topological spaces can be constructed by repeatedly attaching cells in various ...
  17. [17]
    [PDF] Lecture notes - UChicago Math
    Jul 12, 2023 · In Top, the coproduct is given by the disjoint union of spaces with the disjoint union topology, while the product is given by the cartesian ...
  18. [18]
    [PDF] 1 Manifolds
    the Hausdorff assumption, we would have examples such as the following: take the disjoint union R1 tR2 of two copies of the real line, and form the quotient ...
  19. [19]
    [PDF] Lecture Notes on Sum Types
    Sep 21, 2018 · 2 Disjoint Sums. Type theory is an open-ended enterprise: we are always looking to capture types of data, modes of computation, properties of ...
  20. [20]
    [PDF] 510: Programming Languages Product and Sum Types - cs.Princeton
    The type τ1+τ2is the disjoint union of τ1 and τ2 . • Values of each type τ1and τ2 are included within it. • Elements are tagged with inl or inr to.<|control11|><|separator|>
  21. [21]
    Enumerations - The Rust Reference
    An enumeration, also referred to as an enum, is a simultaneous definition of a nominal enumerated type as well as a set of constructors.
  22. [22]
    Enums and Pattern Matching - The Rust Programming Language
    Enums allow you to define a type by enumerating its possible variants. First we'll define and use an enum to show how an enum can encode meaning along with data ...
  23. [23]
    Data.Either - Hackage - Haskell.org
    The Either type represents values with two possibilities: either Left a or Right b. Left is used for errors, Right for correct values.
  24. [24]
    Defining an Enum - The Rust Programming Language
    Enums give you a way of saying a value is one of a possible set of values. For example, we may want to say that Rectangle is one of a set of possible shapes.