Functions as sets of ordered pairs
Another thing that you will need to know as we move forward is a bit about functions. Functions may seem like mysterious entities, but set theoretically speaking, they are really quite simple. After all, what a function does is it takes an input, and provides a single output. For example, if we take the function , and apply it to the number , we get . There are various ways of specifying the function, like , or , but the only thing that is important is that there are a bunch of inputs, and for each input, there is just one output. So if is the function, then .
Perhaps somewhat confusing to the untrained eye is the fact that , as specified above is, by itself, the same as the number . So in this context, it makes sense to write things like , or .
Functions can be represented in set theory by sets of ordered pairs. These ordered pairs essentially represent a list of all input-output pairs that a function is made up of. For example, if we take the function again, defined on the natural numbers , set theoretically, it would be the set of all the following ordered pairs: Or in one line, . Again, this is just a list of all possible input-output pairs for the function.
Note the use of ‘’ in specifying the function. Since the function is defined on all natural numbers, naturally, its set-theoretic representation will be an infinitely large set! What the dots represent is that the list goes on forever since, for any natural number, you can always just add and get another one.
One thing that you need to keep in mind is that not any set of ordered pairs constitutes a function. In particular, functions are those sets of ordered pairs where for each input, there is only one output. One way to formulate this idea is to say that if there is an input to the function, and seemingly two different outputs, then those two seemingly different outputs must be the same. Hence:
Definition 3.4 (Function). A function is a set of ordered pairs such that if and , then . The set of all such that is called the function’s domain, while the set of all such is called its range or image. A function’s codomain (if specified) is a superset of its range.
We may write to specify to be a function with domain and codomain . If , we may write, alternatively, that , or that .
Exercise 3.7. Is every function a relation? Is every relation a function? In your answer, explain your reasoning.
The above definition ensures that whatever conforms to that specification is an actual function. On the other hand, one can introduce more restrictions on these sets, to define certain special classes of functions.
Let’s start with some useful terminology. According to the above definition, there are no functions which are one-to-many, in the sense of assigning many outputs to one input. That would immediately ensure they are not a function.
What about many-to-one functions? Indeed, these are possible. Suppose we have a function that assigns to each person their age at the moment. At any one moment, this would give us a very large set of ordered pairs:
Since there are many people on Earth, there will be many that share their age at any one moment (at least as things currently stand). Above, you can immediately see that Dwayne Johnson and Idris Elba are the same age at the moment of writing this book. Thus, the person-to-person’s-age function is many-to-one. Again, note that it is a function, and thus not one-to-many, and this is by nature, since every person only has one age.
On the other hand, some functions are not many-to-one, but one-to-one. This means that for two distinct inputs, they never have the same output. Take the function again. The function on the natural numbers is one-to-one, since for each two distinct natural numbers , . This is easy to see since if were the case, then would also be the case, even though we specified those two numbers must be distinct. In other words, the same output can only be had if the input is really the same. One-to-one functions are also called injective.
At times, we may want to explicitly specify not only the domain on which the function is defined (like how the function has as domain the natural numbers), but also what its codomain is, which is a (not necessarily proper) superset of its range. For example, we may say that is a function from the domain of natural numbers to the codomain of natural numbers. This may be written . Note that this notation is different from the above which specifies that for each , is ‘mapped to’ , i.e., .
In connection, one may find that some functions ‘cover’ their codomain, in the sense that for each member of a function’s codomain, there is a certain input value which outputs just that member. A function that is not like this is the function specified as , since neither nor is an output for any input value (since the input value would have to be either or , which are not natural numbers). On the other hand, we may specify a function such that . This function covers its codomain, the even numbers, since for every even number , there is a natural number such that . Functions like are called surjective or onto. Note that whether a function is surjective is relative to how its codomain is specified. Clearly, would not be surjective, since no odd number ever gets output.
Finally, some functions are both injective and surjective, or both one-to-one and onto. These functions are called bijective or are said to be a one-to-one correspondence (sometimes, 1-1 correspondence.) For example, it is easy to see that the function is bijective or a one-to-one correspondence. We already know that it is surjective. But it is also injective, since there are no two distinct natural numbers such that and (). Thus, it is bijective.
Bijective functions are very important, since they essentially allow one to count the members of a set by pairing them with numbers. For example, if you have the set , this set can be put into 1-1 correspondence with the set (in various ways), so it has three members. But notice that the set cannot be put into 1-1 correspondence with . And the set cannot be put into 1-1 correspondence with either. Indeed, for any set , it can only be put into 1-1 correspondence with one initial segment of the (positive) natural numbers, .
Note also that if – correspondence provides a definition of ‘has the same number of elements as’, then and have the same number of elements by the bijective function (infinitely many), even though . Weird!
Exercise 3.8. Answer the following questions. In each case, explain your reasoning.
-
No human has more than 1 million hairs on their body. There are more than 8 million residents of New York City. Must there be two New York residents with exactly the same number of hairs on their body? Explain why, or why not.
-
Let be the set of all natural numbers such that there is a New York City resident with exactly hairs. Let be the set of all New York City residents. Let be the set of all actual pairs where and , representing “hair number – person with that number of hairs” pairs. Is a function?
-
Let be like except consisting of all pairs provided . What does represent intuitively? Is a function?
-
Is surjective and/or injective? Is a one-to-one correspondence?
Definition 3.5 (Properties of functions).
-
A function is one-to-one or injective provided there are no such that but .
-
A function is surjective or onto provided for every there is an such that .
-
A function is bijective or a one-to-one correspondence provided it is both injective and surjective (one-to-one and onto).
Exercise 3.9. A 1-1 correspondence is defined as a function between a domain and a codomain that is both injective and surjective. We already noted that there can be no 1-1 correspondence between and , or between and (or indeed, between and ). This means that a function between any of these two is either not injective, or not surjective.
-
Take the sets and . Suppose is any function from to . Can it be surjective? Can it be injective?
-
Now take the sets and . Suppose is any function from to . Can it be surjective? Can it be injective?
-
How do the answers change if we take to be from to , and to be from to ?
Finally, here is a definition that will be useful later on.
Definition 3.6. Let be any function with the domain of formulas of , and let be its condomain. Then, is called a truth-function.