Skip to content

Appendix A.1 Sets and Functions

A set is a collection of objects called elements.

Sets

A set is a collection of objects called elements.

If aa is an element of a set AA, we write

aA. a\in A.

If aa is not an element of AA, we write

aA. a\notin A.

Sets are fundamental throughout mathematics because nearly every mathematical structure can be described in terms of collections and relations between collections.

Examples include:

N={1,2,3,}, \mathbb{N}=\{1,2,3,\ldots\}, Z={,2,1,0,1,2,}, \mathbb{Z}=\{\ldots,-2,-1,0,1,2,\ldots\},

and finite sets such as

{2,3,5,7}. \{2,3,5,7\}.

Equality of Sets

Two sets are equal if they contain exactly the same elements.

Thus

A=B A=B

means:

xA    xB x\in A \iff x\in B

for every object xx.

Order does not matter in sets, and repeated elements are ignored.

For example,

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

Similarly,

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

Subsets

A set AA is a subset of BB if every element of AA belongs to BB.

We write

AB. A\subseteq B.

Thus

AB A\subseteq B

means:

xA    xB. x\in A \implies x\in B.

For example,

{2,3}{1,2,3,4}. \{2,3\}\subseteq\{1,2,3,4\}.

If

ABandAB, A\subseteq B \quad\text{and}\quad A\neq B,

then AA is called a proper subset of BB.

Empty Set

The empty set is the set containing no elements.

It is denoted by

. \varnothing.

The empty set is a subset of every set.

Indeed, the statement

x    xA x\in\varnothing \implies x\in A

is automatically true because there are no elements in \varnothing.

Union and Intersection

The union of two sets AA and BB is the set

AB={x:xA or xB}. A\cup B = \{x:x\in A \text{ or } x\in B\}.

The intersection is

AB={x:xA and xB}. A\cap B = \{x:x\in A \text{ and } x\in B\}.

For example, if

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

then

AB={1,2,3,4,5}, A\cup B=\{1,2,3,4,5\},

and

AB={3}. A\cap B=\{3\}.

Set Difference

The difference of sets is

AB={x:xA and xB}. A\setminus B = \{x:x\in A \text{ and } x\notin B\}.

For example,

{1,2,3,4}{2,4}={1,3}. \{1,2,3,4\}\setminus\{2,4\} = \{1,3\}.

Set difference removes elements belonging to the second set.

Cartesian Products

Given sets AA and BB, the Cartesian product is

A×B={(a,b):aA, bB}. A\times B = \{(a,b):a\in A,\ b\in B\}.

Its elements are ordered pairs.

For example,

{1,2}×{x,y}={(1,x),(1,y),(2,x),(2,y)}. \{1,2\}\times\{x,y\} = \{ (1,x), (1,y), (2,x), (2,y) \}.

Cartesian products are fundamental for defining coordinate systems, relations, and functions of several variables.

Functions

A function from a set AA to a set BB assigns to every element of AA exactly one element of BB.

We write

f:AB. f:A\to B.

If aAa\in A, then its image under ff is denoted

f(a). f(a).

The set AA is the domain of the function, and BB is the codomain.

Image and Preimage

The image of a subset

SA S\subseteq A

is

f(S)={f(x):xS}. f(S) = \{f(x):x\in S\}.

If

TB, T\subseteq B,

the preimage of TT is

f1(T)={xA:f(x)T}. f^{-1}(T) = \{x\in A:f(x)\in T\}.

Preimages are important because they behave well with unions and intersections.

Injective Functions

A function f:ABf:A\to B is injective if distinct inputs produce distinct outputs.

Formally,

f(a)=f(b)    a=b. f(a)=f(b) \implies a=b.

Equivalently,

ab    f(a)f(b). a\neq b \implies f(a)\neq f(b).

An injective function never identifies different elements.

For example,

f(n)=2n f(n)=2n

from Z\mathbb{Z} to Z\mathbb{Z} is injective.

Surjective Functions

A function f:ABf:A\to B is surjective if every element of BB occurs as an output.

Thus for every

bB, b\in B,

there exists

aA a\in A

such that

f(a)=b. f(a)=b.

For example,

f(n)=n3 f(n)=n^3

from R\mathbb{R} to R\mathbb{R} is surjective.

Bijective Functions

A function is bijective if it is both injective and surjective.

A bijection establishes a perfect correspondence between two sets.

If a bijection exists between AA and BB, the sets have the same cardinality.

For finite sets, this means they contain the same number of elements.

Composition of Functions

If

f:AB f:A\to B

and

g:BC, g:B\to C,

their composition is the function

gf:AC g\circ f:A\to C

defined by

(gf)(x)=g(f(x)). (g\circ f)(x)=g(f(x)).

Function composition is associative:

h(gf)=(hg)f. h\circ(g\circ f) = (h\circ g)\circ f.

Composition is one of the central operations throughout mathematics.

Identity Functions

For a set AA, the identity function is

idA:AA \operatorname{id}_A:A\to A

defined by

idA(x)=x. \operatorname{id}_A(x)=x.

It leaves every element unchanged.

Identity functions satisfy

fidA=f, f\circ\operatorname{id}_A=f,

and

idBf=f. \operatorname{id}_B\circ f=f.

Inverse Functions

A function

f:AB f:A\to B

has an inverse if there exists a function

g:BA g:B\to A

such that

g(f(a))=a g(f(a))=a

for all

aA, a\in A,

and

f(g(b))=b f(g(b))=b

for all

bB. b\in B.

A function has an inverse precisely when it is bijective.

Finite and Infinite Sets

A set is finite if its elements can be counted using a natural number.

Otherwise it is infinite.

The set

N \mathbb{N}

of natural numbers is infinite.

Infinite sets exhibit surprising behavior. For example, there exists a bijection between

N \mathbb{N}

and the even integers:

n2n. n\mapsto2n.

Thus an infinite set may have the same size as a proper subset of itself.

Countable Sets

A set is countable if it is finite or has a bijection with N\mathbb{N}.

Examples of countable sets include:

  • integers,
  • rational numbers,
  • algebraic numbers.

The rational numbers are countable despite being dense in the real line.

Uncountable Sets

A set is uncountable if it is not countable.

The real numbers form an uncountable set.

Cantor’s diagonal argument proves that no enumeration of real numbers can include them all.

Thus infinities come in different sizes.

Relations

A relation on a set AA is a subset of

A×A. A\times A.

Examples include:

  • equality,
  • divisibility,
  • congruence modulo nn,
  • order relations.

Relations are fundamental for defining algebraic and arithmetic structures.

Equivalence Relations

A relation \sim on AA is an equivalence relation if it is:

  1. reflexive,
  2. symmetric,
  3. transitive.

Congruence modulo nn is a basic example:

ab(modn). a\equiv b\pmod n.

Equivalence relations partition sets into equivalence classes.

These ideas appear constantly in algebra and number theory.

Conceptual Importance

Sets and functions form the language of modern mathematics.

Functions describe transformations and structure-preserving maps. Sets organize mathematical objects into collections suitable for rigorous reasoning.

Nearly every construction in number theory, algebra, geometry, and analysis depends ultimately on these foundational concepts.