Skip to main content

PLP: An introduction to mathematical proof

Section 10.2 A more abstract definition

Definition 10.2.1.

Let \(A, B\) be non-empty sets.
  • A function from \(A\) to \(B\text{,}\) written \(f: A \to B\) is a non-empty subset of \(A \times B\) with two further properties
    • for every \(a \in A\) there is some \(b \in B\) so that \((a,b) \in f\text{.}\)
    • if \((a,b) \in f\) and \((a,c) \in f\) then \(b=c\text{.}\)
  • In this context we call the set \(A\) the domain of \(f\text{,}\) and the set \(B\) is called the co-domain.
  • If \((a,b) \in f\) then we write \(f(a) = b\text{,}\) and we call \(b\) the image of \(a\text{.}\) We also sometimes say that \(f\) maps \(a\) to \(b\text{.}\) With this notation the above two conditions are written as
    • for every \(a \in A\) there is some \(b \in B\) so that \(f(a)=b\text{.}\)
    • if \(f(a)=b\) and \(f(a)=c\) then \(b=c\text{.}\)
  • We can further refine the co-domain to be exactly the set of elements of \(B\) that are mapped to by something in \(A\text{;}\) this set is called the range:
    \begin{align*} \mathrm{rng} f &= \set{b \in B \;|\; \exists a \in A \st f(a) = b} \end{align*}
Some things to note
  • The condition that if \(f(a) = b\) and \(f(a) = c\) then \(b=c\) just means that the function is well defined. If we apply the function to a given element then we only get 1 result. You might know this from high-school as the “vertical line test” — ie a graph-sketch corresponds to a function provided every vertical line intersects the graph once or not at all.
  • Two functions \(f,g:A \to B\) are equal when \(f(a) = g(a)\) for all \(a \in A\text{.}\)
  • The range is not (necessarily) the same as the co-domain. The range is always a subset of the co-domain. For example
    \begin{align*} f: \mathbb{R} \to \mathbb{R} && f(x) = x^2 \end{align*}
    has domain \(\mathbb{R}\text{,}\) co-domain \(\mathbb{R}\) and range \([0,\infty)\text{.}\) We make the distinction between the two because sometimes it is really hard to write the range, but it is usually very easy to write the co-domain. We must be able to apply \(f\) to every single \(a \in A\text{,}\) but we don’t have to arrive at every \(b \in B\text{.}\)
The term “function” only entered mathematics around the 17th century with Leibniz concurrent with the development of calculus and analytical geometry (such as the study of curves in the plane). Before this notions of dependent and independent variables that we are used to when studying \(y=f(x)\) were not so well formalised. Arguably there was some work in this direction around the 12th-14th centuries by mathematicians such as Sharaf al-Din al-Tusi (who developed systematic method for numerical approximation of the roots of cubic polynomials) and Nicole Oresme (who first proved that the harmonic series diverges). Around the 19th century developments in mathematics required more general notions of functions and mathematicians, such as Dirichlet, Dedekind and Cantor, pushed away from the notion of a function as a formula and towards more general definitions such as the one above.
Once we have this more general idea of a function, we need ways to represent it. A very natural way (once Descartes introduced it — though it was also developed concurrently by Fermat and much earlier by Oresme) is to plot the function as a curve in the plane. Each point on the curve represents a pair of coordinates \((x,y)\) so that \(y=f(x)\text{.}\) With this more general idea of a function we might try drawing something like we did above for the days-of-the-week example. That is, we might draw two sets of elements and edges between them to indicate that the function applied to that element in the first set gives the corresponding element in the second.
We could also just explicitly write out the mapping. So, for example, if the sets in the first of these functions are
\begin{equation*} A = \set{1,2,3,4,5} \qquad B = \set{a,b,c,d} \end{equation*}
then the function can be written as
\begin{equation*} f = \set{ (1,b), (2,d), (3,b), (4,a), (5,d)} \end{equation*}
Both these approaches are reasonably practical when the domain and co-domain of the function are small, but is really not going to work as soon as they get a little bigger.

Example 10.2.2.

Consider the sets
\begin{align*} f &= \set{ (x,y) \in \mathbb{Z}\times \mathbb{Z} \so 3x+2y=0}\\ g &= \set{ (x,y) \in \mathbb{Z}\times \mathbb{Z} \so 3x+y=0}. \end{align*}
Both are subsets of \(\mathbb{Z} \times \mathbb{Z}\) and so are (by definition) relations on \(\mathbb{Z}\text{.}\) Only one is a function from \(\mathbb{Z}\) to \(\mathbb{Z}\text{.}\)
In order for \(f\) to be a function it has to satisfy two conditions:
  • For every \(x\) in the domain, there must be a \(y\) in the co-domain so that \(f(x)=y \text{,}\) and
  • If \(f(x)=y\) and \(f(x)=z\) then \(y=z\text{.}\)
The first of these fails, since if we set \(x=1\text{,}\) then there is no integer \(y\) so that \(3+2y=0\text{.}\) Indeed we require \(y=-\frac{3}{2}\text{.}\) The second condition is satisfied, because if \(f(x)=y\) and \(f(x)=z\text{,}\) then we know that
\begin{equation*} 3x + 2y = 0 \qquad \text{and} \qquad 3x+2z = 0 \end{equation*}
then subtract one equation from the other to get
\begin{equation*} 2y-2z = 0 \end{equation*}
and so \(y=z\text{.}\)
The relation \(g\) satisfies both conditions:
  • Let \(x\) be any integer, then we can set \(y=-3x \in \mathbb{Z}\) and \(3x+y=0\) as required.
  • The second condition is satisfied by the same argument we used for \(f\text{.}\)
The co-domain of \(g\) is the set of integers, but its range \(\set{n \in \mathbb{Z} \text{ so that } 3|n}\text{.}\)