Functions
Contents
1Questions and Answers 2Invertible functions 3Numerical functions 4Functions with more arguments1Questions and Answers
Given two sets and , a function from to is a rule that selects for each element of exactly one element of . The mathematical notation says that is a function from to . The element that is selected for is called the value of the argument and is written as . Note that are variables here that are placeholders for concrete sets and concrete elements of these sets.
For example, if is the set of countries in the world and is the set of cities in the world, then we can consider the function that selects for each country its capital. The value of the argument Austria is Vienna,
We can also think of as questions in a quiz, and as answers. Then a function provides an answer for every question . Our example function above provides the answer to every question of the form What is the capital of country ?
In this example, there are elements of (for example, Zurich) that are not selected for any , so there may be answers that will never be given. That’s ok. The only thing we require is that for every question, there is an answer. We also allow that several questions have the same answer. As an example, consider the function corresponding to the question What is the first letter of country ’s name? This gives the same answer A for Austria, or Australia, or Albania, or....
A boolean function is a function . Such a function can be defined by a value table with just two rows, for example
Let and . How many different functions are there?
The mathematician creates another theorem out of this.
Let . Let be a set with elements and a set with elements. There are functions .
2Invertible functions
Suppose we are given the answer and want to know what the question was. If there is always a single question that leads to a given answer , then this defines a function that we call the inverse of : For every answer , is then the single question with answer . We can think of as the function that “undoes" : if we compute , we get back for every question , so nothing happened. Indeed, takes us from the question to the answer , and takes us from the answer back to the question .
Let’s look at this for the function corresponding to questions of the form What is the capital of country ? If we are given the answer Vienna, we know that the question was Austria. Similarly, for every answer that is actually the capital of some country , we know the question (namely ). But if the answer is Zurich, we cannot find a question with this answer. So the function is not invertible. But it becomes invertible if we say that is not the set of all cities in the world but only the set of all capitals in the world.
Let’s consider the function corresponding to the question What is the first letter of country ’s name? This function is not invertible, even if we say that is only the set of letters that occur as first letter of some country’s name. Indeed, if the answer was A, we can’t tell whether the question was Austria, or Australia, or Albania, or....
Even without remembering several countries whose names start with A, we would have known that the function just considered cannot be invertible. After all, there are only 26 letters, but (much) more than 26 countries in the world, so it is inevitable that several country names start with the same letter. This is known as the pigeon‐hole principle, and in function language, it can be stated as follows.
Let and be finite sets such that has fewer elements than . Then for every function , there are two different arguments and with the same value . As a consequence, no function is invertible.
There is a fun fact based on the pigeon‐hole principle: you can find two people in Zurich with exactly the same number of hairs. This is due to the fact that a human (according to various sources, and adding a safety margin) has never more than hairs. Hence, among roughly people in Zurich, there must certainly be two with the same number of hairs. Unfortunately, the pigeon‐hole principle does not tell us how to find them.
A variant of the pigeon‐hole principle shows that is also not invertible if has more elements than . Indeed, if there are less questions than answers, then some answer will never be given and hence is not invertible. This is what happened to Zurich in the country capitals example above. But again, we do not need to remember the capital status of Zurich to make the argument (many people get that status wrong, anyway). We simply need to know that there are (many) more cities in the world than countries, so it is inevitable that some cities are not capitals.
The upshot is that can only be invertible if and actually have the same number of elements. The following picture summarizes the situation.
Recall from Exercise 1 that there are four boolean functions . Which of them are invertible?
Actually, if is a finite set, we can always think of a function as a (possibly large) table, and in this table view, it is quite easy to see when a function is invertible. Consider the case where . The function
Hence, for an invertible function, the right column just lists all the elements of , in some order. Also, the inverse is very easy to construct from the table, by simply interchanging the two columns (instead of going from questions to answers, we now go from answers to questions). This means, the inverse of the previous function is
In contrast,
From Exercise 5 we know that the function
From above, we know that the function with , given by the table
Let and . How many different invertible functions are there?
Let . How many different invertible functions are there?
You will not be surprized that there is a general theorem behind this:
Let and a set with elements. Then there are invertible functions .
The expression is known as the factorial and it denotes the product of the numbers between and . For example, and .
3Numerical functions
If and are sets of numbers, we can visualize in a coordinate system with ‐ and ‐axes. You know this from high school where you have looked at numerical functions such as , or .
Let us do a simpler example. Recall that is the set of real numbers and set Our function is defined by
On the ‐axis, we have the arguments (questions), and on the ‐axis the values (answers). For example, question has answer , and for question the answer is . We can summarize these question/answer pairs in form of the points (2‐tuples) and .
The fat line is the graph of , the set of all points of the form . Hence, for every question on the ‐axis, the height of the graph at gives us the answer .
The fact that is a function can also be seen by looking at the graph. We know that for every question , there is a single answer . This means, whenever we draw a vertical line (dashed) at some value on the X‐axis, then this line intersects the graph of in a single point :
Is this particular function invertible? To check this formally, we must consider any possible real number and see whether we can find a unique such that . If it exists, such a number must satisfy
But we can also tell directly from the picture that is invertible, meaning that for every answer , there is a single question with this answer. Namely, whenever we draw a horizontal line at some , this line intersects the graph of in a single point at which (by definition of the graph), or as we can write, once we know that is invertible.
We can even get the graph of the inverse function from the picture. Indeed, when we find from via the horizontal line at , we do the same as when we find from via the vertical line at —only the roles of ‐ and ‐axis are interchanged. Hence, when we simply mirror the picture at the diagonal (dotted), we obtain the graph of !
The function is an affine function, and the mathematician immediately sees a theorem at the horizon that discusses all affine functions at once, using variables.
Let such that and consider the function defined by
and see whether we can find a unique such that . If it exists, such a number must satisfy
We must consider any possible real numberThe condition is needed so that we can divide by in the proof. If , the function is indeed not invertible. In this case we have , so every question has the same answer .
Let’s look at some non‐invertible numerical function. We define by , the absolute value of . This is the value that we get from by ignoring the sign. For example, and . This function is immediately seen to be non‐invertible. For starters, there is no question that leads to a negative answer. But even for a positive answer such as , there are two possible questions, namely and . If we look at this in a coordinate system, we can graphically see what is going on:
If we draw a (dashed) horizontal line at some negative , it does not intersect the graph of at all; such a corresponds to an answer that is never given. If we draw a horizontal line at some positive , it intersects the graph of twice; this corresponds to the case where we have two questions leading to answer . Only for , there is a single question .
We could “fix” to make it invertible by defining , where is the set of nonnegative real numbers. Then would “live” only in the upper right square of the coordinate system, and there it is invertible. Indeed, for every nonnegative answer , there is only one nonnegative question, namely itself. This “fix” works because just outputs the input for . In general, a function with for all is called identity and is always invertible, with .
Recall that is the set of all natural numbers. Let be the set of positive natural numbers. Which of the following are invertible functions ?
This is related to famous Hilbert’s Hotel, a hotel with infinitely many rooms numbered . Some evening, a new guest arrives without a reservation. Unfortunately, the hotel is fully booked, i.e. there are infinitely many guests already, and all rooms are taken. Fortunately, the clerk can solve the problem by simply asking every guest to move to the room one number higher: the guest in room moves to room , the one in room moves to room , and so on. This frees up room which can then be given to the new guest.
In some sense, the sets and have the same size. Actually, in a very precise sense. We simply define two infinite sets and to be of the same size whenever there is an invertible function . The following exercise shows that even the sets and have the same size, although it rather looks like might have twice the size of .
Let be the set of natural numbers and recall that is the set of integers. Consider the function defined by
Recall that is the set of nonnegative real numbers, and the set of nonpositive real numbers. Here, we only consider the function , but we want to see what happens for different sets of questions and sets of answers . In which of the following cases is invertible? For each case, argue why your answer is correct and also think about what would be!
4Functions with more arguments
Sometimes, several questions need to be asked before an answer can be given. To understand this, let’s think of a pocket calculator. It typically has an key. To use it, you type in the question (argument) , for example , and then press to get the answer (value) ; in this example . But there is also an key. This requires two arguments and . To use it, you type in the first argument , for example , then press , type in the second argument , for example , and finally press to get the value ; in this example .
Mathematically, this is a function with two arguments: . In a strict mathematical sense, there is only one argument, namely the pair , and one would have to write , but even mathematicians don’t like this and typically think of two arguments instead of one argument that consists of two parts. We could also have three or more arguments. We will not go into what the sets and are in if the function has several arguments. But they exist, and we can also ask whether is invertible, just like for “normal” functions with one argument.
Functions with two arguments can also be specified via a value table, but this time, the table is two‐dimensional. Let us suppose that we want to compute only for and between and . Then the value table is the following.
You might find it weird that , but let’s not discuss it; we only wanted to point out that this is not a typo.
Fill in the value table of the function for and between and .