# The Unapologetic Mathematician

## Sets and functions

I’m soon going to need to really use the notion of a function, and I want to make sure that I lay the groundwork properly. This is also a good place to mention a few things about sets.

For most of my purposes, a naïve concept of sets will suffice. A set is a collection of objects, called the elements of the set. In formal treatments of set theory, the elements are themselves sets. In fact, everything in sight is “really” a set. This sort of foundationalist approach, though, tends to obscure the real structure of mathematical theories, so I’ll avoid talking about formal set theory unless it’s absolutely necessary. What we’ll need from set theory are a few operations on sets.

• Specification: If we have a set $X$ and some statement $p$ that can be unambiguously determined true or false for each element of $X$, there is a set containing exactly those elements of $X$ so that $p$ is true. We write this set as $\{x\in X|p(x)\}$, read “the set of those elements $x$ of $X$ such that $p$ is true of $x$“.
• Intersection: This is actually a special case of specification. For our statement we use “ $x$ is an element of the set $Y$“. This gives us the set of all elements in both $X$ and $Y$, and we write this set $X\cap Y$. In practice, we will allow intersections not just of two sets, but of any number of sets — even infinitely many.
• Union: For any two sets $X$ and $Y$ there is a set containing any element in either $X$ or $Y$. We write this set as $X\cup Y$. As for intersection, we will allow unions of any collection of sets.
• Cartesian product: For any two sets $X$ and $Y$ there is the set of ordered pairs $(x,y)$, where $x$ is an element of $X$ and $y$ is an element of $Y$. We write this set $X\times Y$. Again, we allow Cartesian products of any number of sets, though only a finite number at a time here.
• Empty set: While not a “construction”, per se, the empty set is something important to pay attention to. This is, predictably enough, the set containing no elements at all. We write it $\varnothing$.
• Subset: If every element of $Y$ is also an element of $X$ we say $Y$ is a subset of $X$ — written $Y\subseteq X$. Note that specification gives us a subset of $X$.
• Power set: For any set $X$ we have the set of all subsets of $X$. We write this set ${\rm P}(X)$.

I may have forgotten some, but I will mention those (and add them here) if I realize it later.

Anyhow, a function is basically a rule that assigns to each element of one set an element of another. Formally, we need to specify a “domain” set $X$ and a “codomain” set $Y$ (the codomain is often called the “range”). For every element $x$ of the domain, there is a uniquely specified element $f(x)$ in the codomain. Often there is some sort of calculational method to determine the value of the function, but a simple lookup table will suffice. We write $f:X\rightarrow Y$ to specify a function with domain $X$ and codomain $Y$.

There are a few properties a function may have that are worth mentioning here. Every function assigns a value in its codomain to every element in its domain. If every element in the codomain is the value of the function at some element of the domain we say that the function is “onto” or a “surjection”. Every function assigns only one value to every element in the domain. If no element in the codomain is the value of the function at more than one element of the domain, we say that the function is “one-to-one” or an “injection”. If both of these properties hold, we say the function is a “bijection”.

Let’s consider four sets: $A=\{{\rm a},{\rm b},{\rm c}\}$, $M=\{{\rm foo},{\rm bar}\}$, $N=\{1, 2, 3\}$, $V=\{w,x,y,z\}$. We use these to define a number of examples of functions.

• $f:N\rightarrow M$, with $f(1)={\rm foo}$, $f(2)={\rm bar}$, and $f(3)={\rm foo}$. This function is surjective, but not injective.
• $g:N\rightarrow V$, with $g(1)=y$, $g(2)=x$, $g(3)=z$. This function is injective, but not surjective.
• $h:A\rightarrow N$, with $h({\rm a})=2$, $h({\rm b})=3$, $h({\rm c})=3$. This function is neither injective nor surjective.
• $k:A\rightarrow A$, with $k({\rm a})={\rm c}$, $k({\rm b})={\rm b}$, $k({\rm c})={\rm a}$. This function is bijective.

February 8, 2007 Posted by | Fundamentals | 12 Comments