Domain, Codomain, Range: the Words Every Type Uses
A function \( f: A \to B \) is a rule that sends every element of set A to exactly one element of set B. Set A is the domain. Set B is the codomain. When an element x is sent to y, we say y is the image of x, and x is a pre-image of y. The set of all images actually used is the range. The range is always a part of the codomain, but it does not have to be all of it.
Every type in this topic is a type of function, so the first check is always whether the relation is a function at all. On a graph, this is the vertical line test: if any vertical line cuts the graph at more than one point, one x has more than one y, and the graph is not a function. Try it on the eight graphs below before reading the table.




| Graph | What a vertical line does | Function? |
| c | Meets the curve once everywhere | Yes |
| d | Meets the curve three times near the y-axis | No |
| e | Meets the two crossing lines twice | No |
| f | Meets the oval twice | No |
| g | Meets the curve three times near the origin | No |
| h | Meets the curve once everywhere | Yes |
| i | Meets only one step at a time | Yes |
| j | Meets the line once everywhere | Yes |
Functions are sorted by asking two separate questions. First: is every element of the codomain used? That decides onto or into. Second: does any image have more than one pre-image? That decides one to one or many to one.
Onto Function
Onto function: a function \( f: A \to B \) is onto if its range is equal to its codomain. Every element of B is the image of at least one element of A.
To test for onto, look at the codomain, not the domain. Go through each element of B and ask: does at least one arrow land here? If every element of B receives an arrow, nothing in B is left out, and the function is onto.


In f₂, two elements of A share the same image. That does not stop the function being onto. Onto only asks whether all of B is used, not how many arrows arrive at each element.
Into Function
Into function: a function \( f: A \to B \) is into if its range is a proper subset of its codomain. At least one element of B is not the image of any element of A.
Into is the opposite of onto. If even one element of B is left without an arrow, the range is smaller than the codomain and the function is into. Every function is either onto or into, never both.


An element of the domain with no arrow means the relation is not a function at all. An element of the codomain with no arrow is allowed, and it simply makes the function into. Do not mix up the two sets.
One to One Function
One to one function: a function \( f: A \to B \) is one to one if each image has a unique pre-image in the domain. Different elements of A always have different images.
To test for one to one, look at the arrows arriving in B. If no element of B receives two or more arrows, every image has only one pre-image, and the function is one to one. A one to one function can still be onto or into, so we often name both properties together.


Many to One Function
Many to one function: a function \( f: A \to B \) is many to one if at least one image has more than one pre-image in the domain.
If two or more arrows meet at the same element of B, that element is an image with several pre-images, and the function is many to one. For example, with \( f(x) = x^2 \), both 2 and \( -2 \) have the image 4, so squaring is many to one on a set that holds both.


Putting the Two Questions Together
Because the two questions are independent, every function gets one answer from each. That gives four possible combined names.
| Name | Image has two or more pre-images? | Every element of B used? |
| One to one and onto | No | Yes |
| One to one and into | No | No |
| Many to one and onto | Yes | Yes |
| Many to one and into | Yes | No |
Counting elements gives a quick check. If A has fewer elements than B, the function cannot be onto, because there are not enough arrows to reach every element of B. If A has more elements than B, the function cannot be one to one, because at least two arrows must land on the same element.
Constant Function
Constant function: a function \( f: A \to B \) is constant if every element of the domain has the same single image, so the range contains only one element. It is written \( f(x) = c \), where c is a fixed number.
In a constant function, the input makes no difference to the output. On an arrow diagram, every arrow ends at the same element. On a graph, every point sits at the same height, so the points lie on a horizontal line.


A constant function on a domain with more than one element is also many to one, since every element shares one image.
Identity Function
Identity function: a function is an identity function if the image of each element is the element itself, that is, \( f(x) = x \). Each element maps onto itself.
For an identity function the domain and the codomain are the same set, and the image and the pre-image are the same. So 1 goes to 1, 2 goes to 2, and 3 goes to 3. Its graph is a straight line through the origin, and each of its points has equal coordinates, like \( (1, 1) \), \( (2, 2) \) and \( (3, 3) \).

An identity function is always one to one and onto, because every element of the set is used exactly once as an image.
Linear Function
Linear function: a function of the form \( f(x) = mx + c \) is a linear function. Its graph is a straight line with slope m and y-intercept c.
\[ f(x) = mx + c \]
The slope m measures how steep the line is, and the line makes an angle \( \theta \) with the positive x-axis. The y-intercept c is the height at which the line crosses the y-axis. The graph takes different forms depending on the value of m.


- When \( m = 0 \), the rule becomes \( f(x) = c \). This is the constant function, drawn as a horizontal line.
- When m is positive, the line rises from left to right.
- When m is negative, the line falls from left to right.
- When \( m = 1 \) and \( c = 0 \), the rule becomes \( f(x) = x \). This is the identity function.
Take \( f(x) = 2x + 1 \). Here \( m = 2 \) and \( c = 1 \).
Step 1: Putting \( x = 0 \) gives the y-intercept:
\[ f(0) = 2 \times 0 + 1 = 1 \]
Step 2: Putting \( x = 1 \):
\[ f(1) = 2 \times 1 + 1 = 3 \]
Step 3: Putting \( x = 2 \):
\[ f(2) = 2 \times 2 + 1 = 5 \]
Each time x goes up by 1, y goes up by 2, which is the slope. The points \( (0, 1) \), \( (1, 3) \) and \( (2, 5) \) lie on one straight line that rises and crosses the y-axis at 1.
How to Name the Type of a Function
Whether the function is given as an arrow diagram, a set of ordered pairs or a graph, the same checks work in the same order.
- Check it is a function: every element of the domain has exactly one image.
- Write down the codomain and the range.
- Compare them: equal means onto, a proper subset means into.
- Look for an image with two or more pre-images: if there is one, the function is many to one, otherwise one to one.
- Look at the rule: one image for everything means constant, each element to itself means identity, and \( mx + c \) means linear.
Onto or into depends on the codomain you are given. The pairs \( (1, 2), (2, 4), (3, 6) \) are onto if B is \( \{2, 4, 6\} \) but into if B is \( \{2, 4, 6, 8\} \). Always read what B is before deciding.
The full lesson is waiting for you
The notes are free to read in full. A free account opens the rest of the practice, and tracks your progress and confidence score for every subject. Presentations and videos need approval from Learn Yeti.