Section 10.1 Functions
So let’s try to strip the idea of a function back as far as we can to make it both simpler and more general. First of all, we should escape from the idea that functions are restricted to have numbers are inputs and outputs; those of you with some programming experience will find this quite natural.
The following is a perfectly good function:
- Give me the name of a day of the week 129 .
- I return to you the first letter of that word.
Now this is still quite algorithmic, but we have escaped from the tyranny of numbers — small steps first. The function takes inputs from the set
\begin{align*}
A &= \set{ \text{Sunday}, \text{Monday}, \text{Tuesday}, \text{Wednesday}, \text{Thursday}, \text{Friday}, \text{Saturday}}
\end{align*}
and maps them to outputs in the set
\begin{align*}
B &= \set{F, M, S, T, W}
\end{align*}
We can summarise what is happening here by drawing a diagram that illustrates the inputs and outputs.
This is fine when the set of inputs is small, but will clearly become more and more painful as the set of inputs becomes larger. It is also still a quite algorithmic way of thinking about functions, but we can reduce the idea down further:
Take an element of set \(A\) and do something to it to get an element of set \(B\text{.}\)
So we can summarise the function above by the pairs of inputs and outputs:
\begin{align*}
\Big\{ (\text{Sunday}, S), \amp (\text{Monday}, M), (\text{Tuesday}, T), (\text{Wednesday}, W),\\
\amp (\text{Thursday}, T), (\text{Friday}, F), (\text{Saturday},S) \Big\}
\end{align*}
So the set of ordered pairs of inputs and outputs is a subset of \(A \times B\) — so it is a relation. However, its not just any relation — that is too general. We have extra conditions that a relation must satisfy in order to be a function.
- We know that a function can only give one output for a given input. That is, if \(f(a)=b_1\) and \(f(a)=b_2\) then we must have \(b_1=b_2\text{.}\) We can also express this in terms of relations:\begin{gather*} ( (a,b_1) \in R \land (a,b_2) \in R ) \implies b_1=b_2 \end{gather*}
- Also everything in the input set has to have an output. That is\begin{gather*} \forall a \in A, \exists b \in B \text{ so that } f(a)=b. \end{gather*}Notice that this does not say that we have to reach everything in the output set — rather it just says that every input has to be “legal”; it results in some element in the output set.
Armed with these ideas we can define our new and more abstract idea of a function.
Written in correct — ie. Australian — English. The author might be biased in this assessment.