Introduction to Functions
by mrichard, Oct 30, 2018, 4:51 AM
Previously, we talked about sets. Once we have these basic objects, 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 on 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 proper function is a function only has a single output for each input.
Let's look at a simple example of a function.
There are many notations used to discuss functions. The most common, and the one used throughout this blog, 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 from our example
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.
Definition
Let's consider the function
from before. We say that
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; however, you don't want to copy down the list of rules we had each time! This may not seem like a big deal, but imagine you had a domain with
elements. We'd need an easier notation for these situations!
The accepted notation to tell our friends that
sends
to
is
This is most commonly read as "
of
equals
"
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 many situations where you just need to know if a particular element (very frequently
or
) is among the outputs of a set of inputs.
Definition
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 (i.e. the set of all possible inputs) of
, every element in
is assigned to some element in
. So,
must be a subset of
, and in particular is the set that contains all possible outputs of the functions, and no extra elements.
Definition
Since all possible outputs must exist in the codomain
, for any function
we must have 
Here is another example.
It is also good to note that a function can assign different inputs to the same output!
Here is a function where the codomain only has one element.
Questions
Consider the function
defined by
and 
What is the cardinality of this function's domain?
What is the codomain of the function?
What is the image of the function?
Consider another function
.
How many ways can we define this function so that every input is sent to a different output?
Consider a function
Suppose 
How many ways can we define this function?
Most simply, a function is a rule that takes elements on 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 proper function is a function only has a single output for each input.
Let's look at a simple example of a function.
Example
Consider the set
and the set
We create a function that takes elements of
and assigns them to elements of
, according to the following set of rules:

However, the following set of rules do not make a function:

It is okay that we do not assign
to anything. However,
is assigned to two values in
. Remember a function can only have one output for each input, so this is not a function!
Consider the set





However, the following set of rules do not make a function:

It is okay that we do not assign



There are many notations used to discuss functions. The most common, and the one used throughout this blog, will be the form




So, we could call the function from our example




It is good to have a common language to describe the sets


Definition
Definition
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 a set that contains all possible outputs. There are many possible codomains of a function. The set of all outputs of a function is a subset of the codomain.
Domain: Given the function



Codomain: Given the function



Let's consider the function



Imagine you wanted to tell a friend that our function



The accepted notation to tell our friends that







This notation is very flexible, as it allows us to have more than one element as the input. For example, since the subset








Definition
Definition
Function Notation: Given the function
, where
is assigned to the element
, we write
and say "
of
is equal to
."
Similarly, if
is some subset of
such that the elements of
are assigned exactly to elements in some
, we write 
Note: To be entirely consistent, we should write
However, it is accepted that
is shorthand for this.
Function Notation: Given the function







Similarly, if





Note: To be entirely consistent, we should write


As noted before, given the function










Definition
Definition
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.
Range: The range of a function


Since all possible outputs must exist in the codomain



Here is another example.
Example
Consider the set
, and the new function
defined by:
Then,
So, the range of the function is
, and is not equal to the codomain.
Consider the set





It is also good to note that a function can assign different inputs to the same output!
Here is a function where the codomain only has one element.
Example
Define the function
by
All three elements of
are assigned to
, and
is a valid function.
Define the function





Questions
Consider the function



What is the cardinality of this function's domain?
The domain of
is
. Since this has two elements, its cardinality is 



What is the codomain of the function?
The codomain is
.

What is the image of the function?
The image, or range of the function is 

Consider another function

How many ways can we define this function so that every input is sent to a different output?
First, we choose a value for
We can choose from the three elements in
. Once we have selected
, we need to choose
to be different from
This will leave us with two choices for 
For each of the three choices of
, we are left with two choices for
. Hence, we can define
in
ways 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.






For each of the three choices of




Note: A function where every input is sent to a different output is called one-to-one or injective.
Consider a function


How many ways can we define this function?
There is only one element in the domain. So, the function is only defined by
Since
has
elements, there are
choices for
Hence, we can define the function in
different ways.





