One Input, One Output
A small plant is measured once a week. After week 1 it is 1 cm tall, after week 2 it is 2 cm tall, and it keeps growing until it is 7 cm tall after week 7. Pick any week and there is exactly one height for that week. The plant cannot be 3 cm and 5 cm tall at the same moment. Because each week gives one and only one height, we say that the height of the plant is a function of time.

The sine curve works in the same way. Choose any angle θ, positive or negative, and sin θ has just one value. So the sine ratio is a function of θ. The two graphs are about very different things, but they share one idea: every input produces a single output. That idea is the heart of a function.
You already know what a relation is. A relation from a set A to a set B is a set of ordered pairs \( (x, y) \) with \( x \in A \) and \( y \in B \), and it can be drawn as an arrow diagram with an arrow from x to y for each pair. A function is a relation that obeys one extra rule. The rest of this topic is about that rule.
When Is a Relation a Function?
Here are four relations from \( A = \{a, b, c\} \) to \( B = \{p, q, r\} \). In every diagram the arrows start in A, on the left, and land in B, on the right. Read each one by standing in set A and asking: how many arrows leave each element?


- R1: a goes to p, b goes to q and c goes to r. Every element of A has exactly one image, and the pairing is one to one. R1 is a function.
- R2: a is paired with p and also with q. The element a has two images, so R2 is not a function. It is simply a relation.
- R3: a and b have images, but c has no image in B. An element of A with no image breaks the rule, so R3 is not a function. It is simply a relation.
- R4: a and b share the same image p, and c goes to r. Sharing an image is allowed, because each element of A still has only one image. R4 is a function.
Judge a relation from the left-hand set. Every element there must send out exactly one arrow: not two, and not zero. How many arrows arrive at an element of B does not matter, and some elements of B may receive no arrow at all.
Definition of a Function
Function: Let A and B be two non-empty sets. A relation f from A to B is called a function if each element of A has a unique image in B. We write it as f: A → B.
The word unique makes two demands at once. Every element of A must have an image, so nothing is left out. And that image must be only one, so no element has two. A function is also called a mapping, and we say that f maps x to its image.
If x is an element of A, its image in B is written \( f(x) \), read as "f of x". Calling the image y, the whole idea is written symbolically as:
\[ y = f(x), \quad x \in A, \; y \in B \]
Here is a small example. Let \( A = \{1, 2, 3\} \) and \( B = \{2, 4, 6, 8\} \), and let f double each number of A. Then \( f(1) = 2 \), \( f(2) = 4 \) and \( f(3) = 6 \). As ordered pairs, \( f = \{(1, 2), (2, 4), (3, 6)\} \). Each of 1, 2 and 3 has exactly one image, so f is a function from A to B.
Domain, Co-domain and Range
Once f: A → B is a function, each set and each element in it has a name. If the elements of A are called x and their images are called y, the names are these.
Domain: the set A, from which the arrows start. Every element of the domain has an image.
Co-domain: the set B, in which the images are found.
Range: the set of all the images y actually used by the function. It is a subset of the co-domain.
Image: if f maps x to y, then y, which is f(x), is called the image of x under f.
Pre-image: if f maps x to y, then x is called the pre-image of y.
\[ \text{Range of } f = \{f(x) : x \in A\} \subseteq B \]
| If f: A → B is a function | It is | For the doubling function |
| Domain of f | A | \( \{1, 2, 3\} \) |
| Co-domain of f | B | \( \{2, 4, 6, 8\} \) |
| Range of f | \( \{f(x) : x \in A\} \) | \( \{2, 4, 6\} \) |
| Image of 3 | f(3) | 6 |
| Pre-image of 4 | the x with f(x) = 4 | 2 |
Look at the number 8 in the doubling example. It belongs to the co-domain, but no element of A is sent to it, so 8 has no pre-image and is not in the range. That is perfectly fine for a function.
If f: A → B is a function, each element of A must have an image in the co-domain B, but it is not necessary that each element of the co-domain has a pre-image in A. So the range is always a subset of the co-domain. Sometimes the two are equal, and sometimes the range is smaller.
Worked Example 1: Which Relations Are Functions?
When a relation is written as a set of ordered pairs, the first entries are the elements of the domain and the second entries are their images. To test it, follow these steps.
- Step 1: Write down the first element of every ordered pair.
- Step 2: Look for a first element that appears in two pairs with different second elements.
- Step 3: If you find one, that element has two images, so the relation is not a function.
- Step 4: If no first element repeats, every element has a unique image, so the relation is a function.
Part (a): \( f = \{(3, 2), (4, 1), (5, 0), (4, 2)\} \). The first elements are 3, 4, 5 and 4. The element 4 appears twice, in \( (4, 1) \) and in \( (4, 2) \), so 4 has two images, 1 and 2. Therefore f is not a function. In a mapping, if one pre-image has two images, it is not a function.

Part (b): \( g = \{(2, 1), (1, 0), (0, -1), (-1, -1)\} \). The first elements 2, 1, 0 and -1 are all different, so each has a unique image in the co-domain. Therefore g is a function. Notice that 0 and -1 share the image -1, and that is allowed.

Part (c): \( h = \{(3, 2), (4, 2), (5, 2), (6, 7)\} \). The image 2 has three pre-images, 3, 4 and 5, and 6 has the image 7. Still, each element of the domain appears only once as a first element, so each has a unique image. Therefore h is a function.

Many arrows arriving at one element of the co-domain do not stop a relation being a function. The fault is always on the domain side: an element with two images, or an element with no image.
Part (d): \( k = \{(1, a), (2, b), (3, c), (4, d)\} \). The first elements 1, 2, 3 and 4 are all different, so each element of the domain has a unique image. Therefore k is a function. Here every element of the co-domain is also used, so the range equals the co-domain.

Worked Example 2: Finding the Domain, Co-domain and Range
Let \( A = \{1, 2, 3\} \) and \( B = \{a, b, c\} \), and let a function f: A → B be defined by \( f(1) = a \), \( f(2) = a \) and \( f(3) = c \). Find the domain, co-domain and range of f.
Step 1: The domain is the set the arrows start from, which is A:
\[ \text{Domain of } f = A = \{1, 2, 3\} \]
Step 2: The co-domain is the set the images are taken from, which is B:
\[ \text{Co-domain of } f = B = \{a, b, c\} \]
Step 3: Writing the image of every element of the domain, as given:
\[ \begin{aligned} f(1) &= a \\ f(2) &= a \\ f(3) &= c \end{aligned} \]
Step 4: Collecting the images into one set. The image a appears twice, but a set lists each element once:
\[ \therefore \; \text{Range of } f = \{a, c\} \]

Two things in this example are worth seeing clearly. First, f is a function even though 1 and 2 have the same image a, because each element of A still has one image only. Second, b has no pre-image, which is exactly why the range \( \{a, c\} \) is smaller than the co-domain \( \{a, b, c\} \).
Functions in Tables, Rules and Graphs
A relation is not always drawn with arrows. The same test works in every form, as long as you can see which output belongs to which input.
- A table: the top row holds the inputs x and the bottom row holds the outputs y. If no x appears twice with different y values, the table shows a function. A repeated y is allowed.
- A list of rules such as \( 2 \mapsto 4 \), read as "2 maps to 4": if the same input is sent to two different outputs anywhere in the list, it is not a function.
- Points on a graph: each point is an ordered pair (x, y). If two points have the same x-coordinate but different y-coordinates, one sitting directly above the other, it is not a function.
- A curve on a graph, such as the plant's height against time: if every upright line drawn across the graph meets the curve at most once, each input has one output and the curve shows a function.
For example, the points \( (2, 4) \), \( (2, 2) \) and \( (4, 3) \) do not form a function, because the input 2 has two outputs, 4 and 2. The points \( (1, 3) \), \( (2, 3) \) and \( (3, 3) \) do form a function. They all share the output 3, but no input is repeated.

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.