Sets & Functions

Introduction

A set is an unordered collection of elements. It can be finite or infinite and the order of the elements does not matter. Repeated elements in the set are only listed once. A set can also be empty.

The ‘cardinality’ of a set is defined as the number of elements in that set. It has the notation A|A|. The cardinality of the empty set is 0.

There are also different sets that can be created by combining other sets in some way:

  • Union ABA \cup B
  • Intersection ABA \cap B
  • Difference ABA − B
  • Complement Aˉ\bar{A}
  • Subset BAB \subseteq A

Ordered pairs

An ordered pair is a set (a,b)(a,b) that contains two elements where the order they are in does matter. An example of this you might have seen before is 2-dimensional coordinates.

Cartesian product

This is sometimes also called the ‘cross product’ of two sets. It is a set of ordered pairs.

A×B=(a,b)aAbBA \times B = \\{(a,b) | a \in A \land b \in B\\}

The order that the sets are crossed in matters as the first element of each ordered pair comes from the first set and the second from the second set.

Functions

Assume AA and BB are non-empty sets. ff is a function from AA to BB if ff assigns to each element of AA a unique element of BB. This is written as f(a)=bf(a) = b if ff assigns bb to aa. If this is the case then we would write f:ABf: A \to B where AA is called the domain and BB is called the codomain.

There are a few different types of functions you need to know:

  • Identity functions
    f:AAf: A \to A where each element maps to itself.

  • Injective functions
    f:ABf: A \to B is injective iff ,a,cA,(if f(a)=f(c),,then a=c)\\, \forall a,c \in A \\, (\text{if } f(a) = f(c), \\, \text{then } a = c).

  • Surjective functions
    f:ABf: A \to B is surjective iff ,bB,,aA,(f(a)=b)\\, \forall b \in B \\,\\, \exists a \in A \\, (f(a) = b).

  • Bijections
    f:ABf: A \to B is a bijection iff it is both injective and surjective.

Function composition

The composition of two functions is itself a function:

Let f:BCf: B \to C and g:ABg: A \to B. The composition function fg:ACf \circ g: A \to C is (fg)(a)=f(g(a)){(f \circ g)(a)} = {f(g(a))}

From this, there are a few other mathematical facts we can derive:

  • The composition of two injective functions is an injective function.
  • The composition of two surjective functions is a surjective function.
  • The composition of two bijections is a bijection.

Inverse functions

If f:ABf: A \to B is a bijection, then the inverse of ff, written as f1:BAf^{−1}: B \to A is f1(b)=af^{−1}(b) = a iff f(a)=bf(a) = b.

Inverse function

The inverse of an identity function is itself and the composition of any given function with its inverse is an identity function.

Subsets

A subset is a set of elements, BB, whose elements are also elements of a larger set, AA. It has the notation BAB \subset A. The empty set is also a subset of every set.

Power sets

A power set is a set of elements, P(A)P(A), which contains every possible subset of another set, AA. Since the empty set is a subset of every set, it is also in the power set.

The cardinality of a power set, P(A)|P(A)|, is given by 2A2^{|A|}.

Partition of a set

A partition of a set AA is a collection of disjoint, non-empty subsets that have AA as their union. The collection of subsets AiAA_i \subset A with iIi \in I (where II is an index set) forms a partition of AA iff:

  • Ai,/=iIA_i \mathrlap{\\,/}{=} \empty \qquad \qquad \forall i \in I
  • AiAj=i,/=jIA_i \cap A_j = \empty \qquad \forall i \mathrlap{\\,/}{=} j \in I
  • iIAi=A{\bigcup}_{i \in I} A_i = A