This is the next post in the series of posts inspired by my brief work for Mathbook. Previously, we talked about sets. Once we have this basic object, we can start to create, define and communicate relationships and patterns between sets. Mathematics uses the language of a function to describe these relationships.
Most simply, a function is a rule that takes elements of one set (often called inputs) and assigns them to elements of another set (often called outputs.) The one rule to remember to make sure you have a function is a function only has a single output for each input.
Let’s first look at a simple example of a function, where we take elements in the set , and assign them to another set , according to the following set of rules.
There are many notations used to discuss functions. The most common, and the one used by this tutorial, will be the form . We call the function, where it takes elements from the set and assigns them to elements in the set . So, we could call the function above . While the letter used to name the function can be arbitrary, it is common to use , , or if no other information is given.
It is good to have a common language to describe the sets and in the context of a function.
Domain: Given the function , we call the set the domain of the function . It can be thought of as the collection of possible inputs to the function.
Codomain: Given the function , we call the set the codomain of the function . The codomain is the set that contains all possible outputs. The set of possible outputs is thus a subset of the codomain.
Let’s look at the function from before, . Then is the domain, and is the codomain.
Imagine you wanted to tell a friend that our function took the input and assigned it to strawberries, but did not want to copy down the list of rules each time. This may not seem like a big deal, but imagine you had a domain with elements. The need for an easy notation becomes apparent.
The accepted notation to tell our friends that sends to strawberries is . This is most commonly read as “ of equals strawberries.” This notation is very flexible, as it allows us to have more than one element as the input. For example, since the subset has elements assigned to , we can say
Remember that a set does not have its elements in a specific order, so we can also write
Given just the above, we cannot tell exactly what and are; if we need to communicate that information, we can list them. But there are often situations where you just need to know if a particular element (often or ) is in the output of a set of inputs.
Function Notation: Given the function , where is assigned to the element , we write , said as “ of is equal to .” Similarly, if is some subset of such that the elements of are assigned exactly to elements in some , we write .
As noted before, given the function , there is no guarantee that every element in is actually an output of the function. We are only guaranteed that contains every output. So, it is then natural to wonder what exactly is. Since is the domain (set of possible inputs) of , every element in is assigned to some element in . So, must be the set of all possible outputs for the function.
Range: The range of a function (also commonly called the image) is defined to be the set , or the set of all possible outputs of the function.
Since all possible outputs must exist in the codomain , for any function we must have . For example, let’s introduce another set , and we will define a new function by the set of rules
Then, So, the range of the function does not have to be equal to the codomain.
It is good to notice that a function can assign different inputs to the same outputs. For example, we can define a function by
Consider the function defined by and .
- What is the cardinality of the domain of ?
- What is the codomain of ?
- What is the image of ?
- Challenge: How many ways can we define a function so that every input is sent to a different output.
Note: A function where every input is sent to a different output is called one-to-one or injective, which will be discussed at a later time.