Set Operations

Introduction

Sets are the fundamental building blocks of mathematics. A set is a well-defined collection of distinct objects, called elements or members. Set operations allow us to combine, compare, and manipulate sets to form new sets. These operations—union, intersection, complement, and difference—provide the algebraic structure underlying probability theory, logic, database queries, and virtually every branch of mathematics.

Understanding set operations is essential for working with probability (where events are sets of outcomes), logic (where propositions correspond to sets), and computer science (where data structures often represent sets). The laws governing set operations mirror the laws of logic and Boolean algebra.

This page develops the fundamental set operations, establishes their properties through algebraic laws, and illustrates their applications through examples and Venn diagrams.

Basic Notation

Sets are typically denoted by capital letters (A,B,C A comma B comma C) and elements by lowercase letters (a,b,x a comma b comma x). The notation x∈A x is a member of A means x x is an element of A A, while x∉A x is not a member of A means x x is not an element of A A.

Sets can be specified by listing elements in braces: A={1,2,3,4,5} A equals the set 1 comma 2 comma 3 comma 4 comma 5 or by set-builder notation: A={x:x is a positive integer less than 6} A equals the set of all x such that x is a positive integer less than 6.

The empty set, denoted ∅ empty set or {} the empty set, contains no elements. The universal set U U contains all elements under consideration in a given context.

Union

The union of sets A A and B B, written A∪B A union B, is the set of elements that belong to A A or B B (or both):

A∪B={x:x∈A or x∈B} A union B equals the set of all x such that x is a member of A or x is a member of B

The word or is inclusive: elements in both sets are included in the union.

Example

If A={1,2,3,4} A equals the set 1 comma 2 comma 3 comma 4 and B={3,4,5,6} B equals the set 3 comma 4 comma 5 comma 6, then:

A∪B={1,2,3,4,5,6} A union B equals the set 1 comma 2 comma 3 comma 4 comma 5 comma 6

Note that elements 3 3 and 4 4 appear in both A A and B B but are listed only once in the union, since sets contain distinct elements.

Intersection

The intersection of sets A A and B B, written A∩B A intersection B, is the set of elements that belong to both A A and B B:

A∩B={x:x∈A and x∈B} A intersection B equals the set of all x such that x is a member of A and x is a member of B

The intersection contains only elements common to both sets.

Example

With A={1,2,3,4} A equals the set 1 comma 2 comma 3 comma 4 and B={3,4,5,6} B equals the set 3 comma 4 comma 5 comma 6:

A∩B={3,4} A intersection B equals the set 3 comma 4

Disjoint Sets

Two sets are disjoint (or mutually exclusive) if they have no elements in common, meaning A∩B=∅ A intersection B equals empty set. For example, {1,2} the set 1 comma 2 and {3,4} the set 3 comma 4 are disjoint.

Complement

The complement of set A A, written Ac A to the c-th power or A′ A prime, is the set of all elements in the universal set U U that are not in A A:

Ac={x∈U:x∉A} A to the c-th power equals the set of all x in U such that x is not a member of A

The complement depends on the universal set. If U={1,2,3,4,5,6,7,8,9,10} U equals the set 1 comma 2 comma 3 comma 4 comma 5 comma 6 comma 7 comma 8 comma 9 comma 10 and A={2,4,6,8,10} A equals the set 2 comma 4 comma 6 comma 8 comma 10, then Ac={1,3,5,7,9} A to the c-th power equals the set 1 comma 3 comma 5 comma 7 comma 9.

Properties of Complement

  • (Ac)c=A A to the c-th power to the c-th power equals A (double complement)

  • A∪Ac=U A union A to the c-th power equals U (a set and its complement cover everything)

  • A∩Ac=∅ A intersection A to the c-th power equals empty set (a set and its complement share nothing)

  • ∅c=U empty set to the c-th power equals U and Uc=∅ U to the c-th power equals empty set

Set Difference

The difference of A A and B B, written A−B A minus B or A∖B A set minus B, is the set of elements in A A but not in B B:

A−B={x:x∈A and x∉B}=A∩Bc A minus B equals the set of all x such that x is a member of A and x is not a member of B equals A intersection B to the c-th power

Unlike union and intersection, set difference is not commutative: A−B≠B−A A minus B is not equal to B minus A in general.

Example

With A={1,2,3,4} A equals the set 1 comma 2 comma 3 comma 4 and B={3,4,5,6} B equals the set 3 comma 4 comma 5 comma 6:

A−B={1,2} A minus B equals the set 1 comma 2 and B−A={5,6} B minus A equals the set 5 comma 6

Symmetric Difference

The symmetric difference of A A and B B, written A⁢△⁢B A white up pointing triangle B or A⊕B A circled plus B, is the set of elements in exactly one of the two sets:

A⁢△⁢B=(A−B)∪(B−A)=(A∪B)−(A∩B) A white up pointing triangle B equals open paren A minus B close paren union open paren B minus A close paren equals open paren A union B close paren minus open paren A intersection B close paren

The symmetric difference is commutative and associative. It corresponds to the exclusive or (XOR) operation in logic.

Algebraic Laws

Set operations satisfy many algebraic laws analogous to those for numbers or logical operations.

Commutative Laws

A∪B=B∪A A union B equals B union A and A∩B=B∩A A intersection B equals B intersection A

Associative Laws

(A∪B)∪C=A∪(B∪C) open paren A union B close paren union C equals A union open paren B union C close paren and (A∩B)∩C=A∩(B∩C) open paren A intersection B close paren intersection C equals A intersection open paren B intersection C close paren

Distributive Laws

A∪(B∩C)=(A∪B)∩(A∪C) A union open paren B intersection C close paren equals open paren A union B close paren intersection open paren A union C close paren

A∩(B∪C)=(A∩B)∪(A∩C) A intersection open paren B union C close paren equals open paren A intersection B close paren union open paren A intersection C close paren

Both distributive laws hold for sets, unlike for ordinary arithmetic where only one direction works.

De Morgans Laws

De Morgans laws describe how complements interact with union and intersection:

(A∪B)c=Ac∩Bc open paren A union B close paren to the c-th power equals A to the c-th power intersection B to the c-th power

(A∩B)c=Ac∪Bc open paren A intersection B close paren to the c-th power equals A to the c-th power union B to the c-th power

In words: the complement of a union is the intersection of complements, and the complement of an intersection is the union of complements.

Identity Laws

A∪∅=A A union empty set equals A and A∩U=A A intersection U equals A

Domination Laws

A∪U=U A union U equals U and A∩∅=∅ A intersection empty set equals empty set

Idempotent Laws

A∪A=A A union A equals A and A∩A=A A intersection A equals A

Absorption Laws

A∪(A∩B)=A A union open paren A intersection B close paren equals A and A∩(A∪B)=A A intersection open paren A union B close paren equals A

Subsets and Equality

Set A A is a subset of B B, written A⊆B A subset of or equal to B, if every element of A A is also an element of B B. Formally:

A⊆B⟺(∀x)⁢(x∈A⟹x∈B) A subset of or equal to B long left right double arrow open paren for all x close paren times open paren x is a member of A long right double arrow x is a member of B close paren

Two sets are equal if and only if each is a subset of the other: A=B A equals B iff A⊆B A subset of or equal to B and B⊆A B subset of or equal to A.

A A is a proper subset of B B, written A⊂B A subset of B, if A⊆B A subset of or equal to B and A≠B A is not equal to B.

Connection to Probability

In probability theory, events are sets of outcomes. The probability axioms use set operations:

P⁢(A∪B)=P⁡(A)+P⁡(B)−P⁢(A∩B) P times open paren A union B close paren equals P of A plus P of B minus P times open paren A intersection B close paren (inclusion-exclusion)

P⁡(Ac)=1−P⁡(A) P of open paren A to the c-th power close paren equals 1 minus P of A

If A∩B=∅ A intersection B equals empty set, then P⁢(A∪B)=P⁡(A)+P⁡(B) P times open paren A union B close paren equals P of A plus P of B

Connection to Logic

Set operations correspond directly to logical operations:

Union (∪ union) corresponds to OR (∨ or)

Intersection (∩ intersection) corresponds to AND (∧ and)

Complement (∁) open paren complement close paren corresponds to NOT (¬) open paren not close paren

De Morgan's laws for sets are equivalent to De Morgan's laws for logic. This correspondence is the foundation of Boolean algebra.

Summary

The fundamental set operations are:

  • Union A∪B A union B: elements in A A or B B (or both)

  • Intersection A∩B A intersection B: elements in both A A and B B

  • Complement Ac A to the c-th power: elements not in A A

  • Difference A−B A minus B: elements in A A but not in B B

  • Symmetric difference A⁢△⁢B A white up pointing triangle B: elements in exactly one set

These operations satisfy commutative, associative, distributive, and De Morgan's laws, forming an algebraic structure that underlies probability theory, logic, and computer science.