Skip to main content
Home
Pimath

Menu EN

  • Home
  • ๐ŸŒ EN
    • ๐Ÿ‡ฎ๐Ÿ‡น IT
    • ๐Ÿ‡ช๐Ÿ‡ธ ES
    • ๐Ÿ‡ต๐Ÿ‡น PT
    • ๐Ÿ‡ซ๐Ÿ‡ท FR
    • ๐Ÿ‡ท๐Ÿ‡ด RO
  • ๐Ÿ‘จโ€๐ŸŽ“ About Me
  • ๐Ÿšง Theory & Exercises
User account menu
  • Log in

Breadcrumb

  1. Home

Set Operations: Union, Intersection, Difference, and Complement

Profile picture for user Pimath
By Pimath, 10 April, 2026

Set operations allow us to build new sets from given ones. The fundamental operations are the union, the intersection, the difference, the complement and the symmetric difference.

Alongside these operations, the Cartesian product also plays an important role. Unlike the others, it does not produce a set whose members are simply elements of the original sets, but rather a set of ordered pairs.

On this page we introduce the main set operations, give their formal definitions, work through a number of examples and collect the fundamental properties of the algebra of sets.


Contents

  • Sets and Membership
  • Union of Sets
  • Intersection of Sets
  • Difference of Sets
  • Complement of a Set
  • Symmetric Difference
  • Cartesian Product
  • Fundamental Properties of Set Operations
  • Venn Diagrams

Sets and Membership

Before introducing the set operations, let us recall a few basic notions. A set is a collection of objects, called its elements. The elements of a set are regarded as distinct: the order in which they are listed is immaterial, and a repeated element is counted only once.

To indicate that an element \(x\) belongs to a set \(A\), we write

\[ x \in A. \]

To indicate, on the other hand, that \(x\) does not belong to \(A\), we write

\[ x \notin A. \]

For instance, if

\[ A=\{1,2,3,4,5\}, \]

then

\[ 3\in A, \qquad 7\notin A. \]

Two sets are equal when they have exactly the same elements. For example,

\[ \{1,2,3\}=\{3,2,1\}. \]

This holds because, in a set, the order of the elements does not matter.

We shall also use the symbol \(\emptyset\) to denote the empty set, that is, the set containing no elements.

Finally, if every element of a set \(A\) also belongs to a set \(B\), we say that \(A\) is a subset of \(B\) and write

\[ A\subseteq B. \]

These notions allow us to define the main set operations with precision.

Union of Sets

Given two sets \(A\) and \(B\), the union of \(A\) and \(B\) is the set consisting of all elements that belong to at least one of the two sets.

The union of \(A\) and \(B\) is denoted by

\[ A\cup B. \]

Formally,

\[ A\cup B=\{x:x\in A \text{ or } x\in B\}. \]

The word โ€œorโ€ is to be understood in the inclusive sense: an element belongs to \(A\cup B\) if it belongs to \(A\), or to \(B\), or to both.

For instance, let

\[ A=\{1,2,3,4\}, \qquad B=\{3,4,5,6\}. \]

Then

\[ A\cup B=\{1,2,3,4,5,6\}. \]

The elements \(3\) and \(4\), although they belong to both sets, appear only once in the union. Indeed, a set takes no account of repetitions.

Properties of the union

The union of sets satisfies a number of fundamental properties.

  • Commutative property: \[ A\cup B=B\cup A. \]
  • Associative property: \[ (A\cup B)\cup C=A\cup(B\cup C). \]
  • Idempotent property: \[ A\cup A=A. \]
  • Identity element: \[ A\cup\emptyset=A. \]

The commutative property shows that the order of the sets has no effect on the union. The associative property, in turn, allows us to write the union of three sets unambiguously, omitting the parentheses:

\[ A\cup B\cup C. \]

Intersection of Sets

Given two sets \(A\) and \(B\), the intersection of \(A\) and \(B\) is the set consisting of all elements that belong simultaneously to both \(A\) and \(B\).

The intersection of \(A\) and \(B\) is denoted by

\[ A\cap B. \]

Formally,

\[ A\cap B=\{x:x\in A \text{ and } x\in B\}. \]

Thus an element belongs to \(A\cap B\) if and only if it belongs to both \(A\) and \(B\).

For instance, let

\[ A=\{1,2,3,4,5\}, \qquad B=\{3,4,5,6,7\}. \]

The elements common to the two sets are \(3\), \(4\) and \(5\). Hence

\[ A\cap B=\{3,4,5\}. \]

Disjoint sets

Two sets \(A\) and \(B\) are said to be disjoint if they have no elements in common, that is, if their intersection is the empty set:

\[ A\cap B=\emptyset. \]

For instance, if

\[ A=\{1,3,5\}, \qquad B=\{2,4,6\}, \]

then

\[ A\cap B=\emptyset. \]

Indeed, no element of \(A\) also belongs to \(B\).

Properties of the intersection

The intersection of sets satisfies properties analogous to those of the union.

  • Commutative property: \[ A\cap B=B\cap A. \]
  • Associative property: \[ (A\cap B)\cap C=A\cap(B\cap C). \]
  • Idempotent property: \[ A\cap A=A. \]
  • Absorbing element: \[ A\cap\emptyset=\emptyset. \]

The commutative property shows that the order of the sets has no effect on the intersection. The associative property, in turn, allows us to write the intersection of three sets unambiguously, omitting the parentheses:

\[ A\cap B\cap C. \]

Difference of Sets

Given two sets \(A\) and \(B\), the difference of \(A\) and \(B\) is the set consisting of all elements that belong to \(A\) but do not belong to \(B\).

The difference of \(A\) and \(B\) is denoted by

\[ A\setminus B. \]

Formally,

\[ A\setminus B=\{x:x\in A \text{ and } x\notin B\}. \]

Thus an element belongs to \(A\setminus B\) if and only if it belongs to the first set and not to the second.

For instance, let

\[ A=\{1,2,3,4,5\}, \qquad B=\{3,4,5,6\}. \]

The elements of \(A\) that do not belong to \(B\) are \(1\) and \(2\). Hence

\[ A\setminus B=\{1,2\}. \]

Conversely, the only element of \(B\) that does not belong to \(A\) is \(6\). Thus

\[ B\setminus A=\{6\}. \]

The difference is not commutative

In general, the difference of sets is not commutative. Indeed, interchanging the order of the sets may change the result:

\[ A\setminus B\neq B\setminus A. \]

In the previous example we obtained, in fact,

\[ A\setminus B=\{1,2\}, \qquad B\setminus A=\{6\}. \]

This shows that, in the set difference, the first set plays a different role from the second: \(A\setminus B\) contains what remains of \(A\) once the elements that also belong to \(B\) have been removed.

Special cases

For every set \(A\), the following properties hold:

  1. \[ A\setminus\emptyset=A. \]
  2. \[ A\setminus A=\emptyset. \]
  3. \[ \emptyset\setminus A=\emptyset. \]

The first property states that removing the elements of the empty set from \(A\) leaves \(A\) unchanged. The second states that removing from \(A\) all the elements of \(A\) leaves no element behind. The third states that no element can be obtained from the empty set by taking a difference.

Complement of a Set

To define the complement of a set, we must fix a universal set, that is, a set \(U\) within which we are working.

If \(A\) is a subset of \(U\), the complement of \(A\) relative to \(U\) is the set consisting of all elements of \(U\) that do not belong to \(A\).

The complement of \(A\) is often denoted by

\[ A^c. \]

Formally,

\[ A^c=U\setminus A=\{x\in U:x\notin A\}. \]

Thus an element belongs to \(A^c\) if and only if it belongs to the universal set \(U\) but not to \(A\).

For instance, let

\[ U=\{1,2,3,4,5,6,7,8,9,10\} \]

and let

\[ A=\{2,4,6,8,10\}. \]

Then the complement of \(A\) relative to \(U\) is

\[ A^c=\{1,3,5,7,9\}. \]

Indeed, \(A^c\) contains all and only those elements of \(U\) that do not belong to \(A\).

Dependence on the universal set

The complement of a set depends not only on the set \(A\) but also on the chosen universal set \(U\).

For example, if

\[ A=\{2,4,6\} \]

and we take as universal set

\[ U=\{1,2,3,4,5,6\}, \]

then

\[ A^c=\{1,3,5\}. \]

If instead we take as universal set

\[ V=\{1,2,3,4,5,6,7,8\}, \]

then the complement of \(A\) relative to \(V\) is

\[ V\setminus A=\{1,3,5,7,8\}. \]

For this reason, whenever one speaks of a complement, the universal set must be clear from the context or stated explicitly.

Properties of the complement

If \(A\subseteq U\), then the following properties hold:

  1. \[ A\cup A^c=U. \]
  2. \[ A\cap A^c=\emptyset. \]
  3. \[ (A^c)^c=A. \]
  4. \[ \emptyset^c=U. \]
  5. \[ U^c=\emptyset. \]

The first property states that every element of the universe belongs either to \(A\) or to its complement. The second states that no element can belong simultaneously to \(A\) and to the complement of \(A\).

Symmetric Difference

Given two sets \(A\) and \(B\), the symmetric difference of \(A\) and \(B\) is the set consisting of the elements that belong to \(A\) or to \(B\), but not to both.

The symmetric difference of \(A\) and \(B\) is denoted by

\[ A\triangle B. \]

Formally,

\[ A\triangle B=(A\setminus B)\cup(B\setminus A). \]

Equivalently, one may write

\[ A\triangle B=(A\cup B)\setminus(A\cap B). \]

This second formula shows that the symmetric difference is obtained by taking the union of \(A\) and \(B\) and discarding the elements common to both sets.

For instance, let

\[ A=\{1,2,3,4\}, \qquad B=\{3,4,5,6\}. \]

The elements that belong to \(A\) but not to \(B\) are \(1\) and \(2\), while those that belong to \(B\) but not to \(A\) are \(5\) and \(6\). Hence

\[ A\triangle B=\{1,2,5,6\}. \]

The elements \(3\) and \(4\), being common to both sets, do not belong to the symmetric difference.

Properties of the symmetric difference

The symmetric difference satisfies a number of fundamental properties.

  • Commutative property: \[ A\triangle B=B\triangle A. \]
  • Associative property: \[ (A\triangle B)\triangle C=A\triangle(B\triangle C). \]
  • Identity element: \[ A\triangle\emptyset=A. \]
  • Symmetric difference of a set with itself: \[ A\triangle A=\emptyset. \]

The commutative property follows from the fact that, in the symmetric difference, it does not matter which of the two sets contains the element; all that matters is that the element belong to exactly one of them.

The property \(A\triangle A=\emptyset\), on the other hand, expresses the fact that every element of \(A\) belongs to both of the sets under consideration, so that no element belongs to just one of them.

Cartesian Product

The operations considered so far produce sets whose elements are again elements of the original sets, or of the fixed universal set. The Cartesian product is of a different nature: it produces a set of ordered pairs.

Given two sets \(A\) and \(B\), the Cartesian product of \(A\) and \(B\) is the set of all ordered pairs \((a,b)\) whose first element belongs to \(A\) and whose second element belongs to \(B\).

The Cartesian product of \(A\) and \(B\) is denoted by

\[ A\times B. \]

Formally,

\[ A\times B=\{(a,b):a\in A \text{ and } b\in B\}. \]

Thus, to form \(A\times B\), each element of \(A\) is paired with every element of \(B\), with due regard for the order within the pair.

For instance, let

\[ A=\{1,2\}, \qquad B=\{3,4,5\}. \]

Then

\[ A\times B=\{(1,3),(1,4),(1,5),(2,3),(2,4),(2,5)\}. \]

In each pair, the first element comes from \(A\) and the second from \(B\).

Ordered pairs

In the Cartesian product, the order of the elements within a pair is essential. In general,

\[ (a,b)\neq(b,a). \]

For example,

\[ (1,3)\neq(3,1). \]

Consequently, the Cartesian product is in general not commutative:

\[ A\times B\neq B\times A. \]

Indeed, \(A\times B\) consists of pairs whose first element belongs to \(A\) and whose second belongs to \(B\), whereas \(B\times A\) consists of pairs whose first element belongs to \(B\) and whose second to \(A\).

The Cartesian product and the Cartesian plane

A fundamental example of a Cartesian product is

\[ \mathbb{R}\times\mathbb{R}. \]

This set consists of all ordered pairs \((x,y)\) in which \(x\) and \(y\) are real numbers:

\[ \mathbb{R}\times\mathbb{R}=\{(x,y):x\in\mathbb{R} \text{ and } y\in\mathbb{R}\}. \]

The set \(\mathbb{R}\times\mathbb{R}\) is also denoted by \(\mathbb{R}^2\) and represents the Cartesian plane.

Properties of the Cartesian product

The Cartesian product satisfies several useful properties.

  • Product with the empty set: \[ A\times\emptyset=\emptyset, \qquad \emptyset\times A=\emptyset. \]
  • Distributivity over union: \[ A\times(B\cup C)=(A\times B)\cup(A\times C). \]
  • Distributivity over intersection: \[ A\times(B\cap C)=(A\times B)\cap(A\times C). \]

If \(A\) and \(B\) are finite sets, then the number of elements of the Cartesian product is given by

\[ |A\times B|=|A|\cdot |B|. \]

Indeed, for each element of \(A\) one can form as many pairs as there are elements in \(B\).

Fundamental Properties of Set Operations

Set operations satisfy a number of fundamental properties. These properties allow us to transform and simplify set-theoretic expressions, much as the properties of arithmetic operations do for numbers.

Throughout this section we assume that \(A\), \(B\) and \(C\) are sets contained in one and the same universal set \(U\).

Properties of union and intersection

PropertyUnionIntersection
Commutative\(A \cup B = B \cup A\)\(A \cap B = B \cap A\)
Associative\((A \cup B) \cup C = A \cup (B \cup C)\)\((A \cap B) \cap C = A \cap (B \cap C)\)
Idempotent\(A \cup A = A\)\(A \cap A = A\)
Identity element\(A \cup \varnothing = A\)\(A \cap U = A\)
Absorbing element\(A \cup U = U\)\(A \cap \varnothing = \varnothing\)

The table reveals an important symmetry: many properties of the union have a corresponding property for the intersection. This correspondence is known as the duality between union and intersection.

Distributive properties

Union and intersection are also linked by the distributive properties:

\[ A\cup(B\cap C)=(A\cup B)\cap(A\cup C). \]

\[ A\cap(B\cup C)=(A\cap B)\cup(A\cap C). \]

The first formula expresses the distributivity of union over intersection. The second expresses the distributivity of intersection over union.

Absorption laws

The following absorption laws also hold:

\[ A\cup(A\cap B)=A. \]

\[ A\cap(A\cup B)=A. \]

The first identity states that adjoining to \(A\) a part already contained in \(A\) does not change the set. The second states that intersecting \(A\) with a set that certainly contains \(A\) leaves \(A\) unchanged.

Laws of the complement

The complement satisfies the following properties:

\[ A\cup A^c=U. \]

\[ A\cap A^c=\emptyset. \]

\[ (A^c)^c=A. \]

Moreover, De Morgan's laws hold:

\[ (A\cup B)^c=A^c\cap B^c. \]

\[ (A\cap B)^c=A^c\cup B^c. \]

De Morgan's laws show how taking complements turns union into intersection and intersection into union.

Taken together, these properties constitute the basic rules of the algebra of sets and are essential for working rigorously with set-theoretic expressions.

Venn Diagrams

Venn diagrams are graphical representations used to visualise sets and set operations.

In a Venn diagram, the universal set \(U\) is usually represented by a rectangle, while the sets contained in \(U\) are represented by closed regions, often circles or ovals.

Venn diagrams

For two sets \(A\) and \(B\), the regions of the diagram make it possible to picture the main operations at a glance:

  • \(A\cup B\) corresponds to the region made up of the elements belonging to at least one of the two sets;
  • \(A\cap B\) corresponds to the region common to \(A\) and \(B\);
  • \(A\setminus B\) corresponds to the part of \(A\) that does not belong to \(B\);
  • \(A^c\) corresponds to the part of the universe \(U\) lying outside \(A\);
  • \(A\triangle B\) corresponds to the part of the union \(A\cup B\) that does not belong to the intersection \(A\cap B\).

Venn diagrams are particularly useful for grasping the meaning of set operations and for checking certain properties visually, such as De Morgan's laws:

\[ (A\cup B)^c=A^c\cap B^c, \qquad (A\cap B)^c=A^c\cup B^c. \]

A diagram, however, is no substitute for a formal proof. To prove an identity between sets, the most rigorous method consists in showing that every element of the first set also belongs to the second, and conversely.

For example, to prove an equality of the form

\[ X=Y, \]

one may proceed by establishing the two inclusions

\[ X\subseteq Y \qquad \text{and} \qquad Y\subseteq X. \]

In this way the argument relies not on the figure but on the definitions of the sets and operations involved.


Set operations make it possible to describe fundamental relationships between collections of objects with precision. The union gathers the elements belonging to at least one of the sets considered; the intersection singles out the common elements; the difference selects the elements belonging to one set but not to another; the complement depends on the universal set; and the symmetric difference collects the elements belonging to only one of the two sets.

The Cartesian product, by contrast, introduces an operation of a different nature, since it builds sets of ordered pairs. In this way it becomes possible to describe relations, correspondences and more elaborate structures.

These notions form a fundamental part of the language of mathematics and underlie many later topics, from logic to combinatorics, from algebra to functions.

Step-by-Step Practice Problems โžค

Your feedback is important to us! Leave a comment and help us improve this content. Thank you!

Feedback

Support us by liking the page:
Or, share:

Tags

  • Algebra

Support us by liking the page:
Or, share:

Copyright ยฉ 2026 | Pimath | All Rights Reserved