What this lesson covers
A function is a rule that pairs each element of one set with exactly one element of another. To say this precisely we first need the Cartesian product of two sets and the idea of a relation. This lesson builds those ideas and then defines image, pre-image, domain, co-domain and range.
Cartesian product of two sets
Let and be two sets. Their Cartesian product, written and read "A cross B", is the set of all ordered pairs whose first entry comes from and second entry from :
If has elements and has elements, then has elements.
Relation
Any subset of is called a relation from to .
For example, let and . Then
and is a relation from to .
Function
A relation from to is called a function if every element of is associated with a unique element of . We write , read "f maps A to B".
Two things can stop a relation from being a function: some element of has no partner in , or some element of has two or more partners. Elements of , on the other hand, may be left unused or used more than once.
Consider three arrow diagrams.
- from to , in which is joined to two letters and is joined to nothing. This is not a function.
- from to with , , , . Every element of has exactly one arrow, so is a function, even though is used twice and is unused.
- from to , in which one element of sends arrows to two different letters. This is not a function.
Number of functions. If and are finite, each of the elements of can be sent to any of the elements of , so the number of functions from to is
Image and pre-image
If is a function and with , , then is called the image of , and is called a pre-image of . We write .
Domain, co-domain and range
Let be a function. Then
- is the domain of ,
- is the co-domain of ,
- the set of all images of elements of is the range of , written .
The range is always a subset of the co-domain.
Example 1
For the function with , , , :
Domain , co-domain , range .
Example 2
Let , and . Is a function?
Each element of has exactly one image in , so is a function. Domain , co-domain , range .
Example 3
The relation from to given by is a function: every real number has exactly one square.
The relation from to given by is not a function. For instance (the domain), but is not a real number, so has no image in the co-domain .
Practice
- If and , write and state how many elements it has.
- How many relations are there from to in question 1?
- How many functions are there from a set with 3 elements to a set with 4 elements?
- Is a function from to ? Why?
- For , , find the range.
- For on the domain , find the pre-image of .
Answers
Show answers
- , which has elements.
- Every subset of is a relation, so there are .
- .
- No: has two images, and .
- .
- gives .