Relations and functions
Pairs link one thing to another, a library card to its holder, a house to its postcode. When does knowing the first thing settle the second?
Where you are 3 in Definition of a function
Why this exists
A great deal of information comes in pairs. A library lists each card number beside the person who holds the card. A postal service gives every house a postcode. A school records the class each student is in.
Hand a librarian a card number and there is one name on file: the card settles who holds it. Tell a postman a postcode and there may be many houses with it: the postcode does not settle the house. Turning a pairing round can change the answer too: a person who holds two cards has no single card number.
Mathematics needs a word for any pairing at all, and a sharper word for the pairings in which the first thing settles the second. These are relation and function. The input-output machine pictured a function as a box with a rule inside. This lesson looks at a function from the outside, as nothing more than its pairs, which works even when no rule can be written down.
Definition
An ordered pair (x, y) is two things written in a fixed order. In a relation the first entry is the input and the second the output. On the coordinate plane the same kind of pair names a point, x across and y up.
A relation is any set of ordered pairs. There is no rule about which pairs may appear: an input may have one output or several, and several inputs may share an output. A relation can be written as a list in braces, in roster notation:
Its inputs are 1 and 2, and its outputs are 4, 5 and 7.
A function is a relation in which each input is paired with exactly one output. Put another way, no input appears in two pairs with different outputs. The relation above is not a function, because the input 2 is paired with both 5 and 7. The relation \{(1, 4),\ (2, 5),\ (3, 5)\} is a function: the inputs 2 and 3 sharing the output 5 breaks nothing.
“y is a function of x” means that x is the input, y is the output, and each value of x is paired with exactly one value of y. The order of the words matters: “the postcode is a function of the house” and “the house is a function of the postcode” are different claims.
A relation can be shown as a set of ordered pairs; as a mapping diagram, with the inputs in one oval, the outputs in another, and one arrow for each pair; as a table, with each input beside its output; or in words describing a real situation. Plotting the pairs as points is a fifth way, with its own test, the vertical line test.
Intuition
In a mapping diagram every arrow is one pair. Stand at each input in turn and count the arrows that leave it. If exactly one leaves every input, the relation is a function. If two leave some input, it is not.
Arrows arriving at an output are never counted. In diagram B of Figure 1, two arrows arrive at 4: two inputs sharing an output, like two students in the same class, which is allowed. In diagram C only one arrow arrives at each output, yet C fails, because two arrows leave 1.
So a function is a relation in which “what goes with this input?” always has exactly one answer.
Results
A set of pairs. A relation given as a list of ordered pairs is a function exactly when no input appears in two pairs with different outputs. In particular, a relation whose inputs are all different is always a function.
A mapping diagram. A relation is a function exactly when one arrow leaves each input. How many arrows arrive at an output does not matter.
A table. A table is a function exactly when no input appears in two rows with different outputs. The same input in two rows with the same output is one pair written twice.
Turning a function round. Swap the input and the output in every pair of a function. The result is a function exactly when no two inputs of the original shared an output.
Why it is true
A set of pairs. “Each input has exactly one output” can fail in two ways: an input with no output, or an input with two or more. In a list of pairs the first cannot happen, since a number is an input only by being the first entry of some pair. So a list fails only when two pairs have the same first entry and different second entries, which cannot happen if all the inputs differ.
A mapping diagram and a table. Each arrow, and each row, is one pair, so the arrows leaving an input are the pairs with that input first. Arrows arriving at an output are pairs sharing an output, which the definition allows. A set does not count repeats: listing (3, 5) twice leaves the input 3 with the single output 5.
Turning a function round. Suppose two different inputs a and b share the output c, so the function contains (a, c) and (b, c). Swapping gives (c, a) and (c, b): the input c now has two different outputs. If instead no two inputs share an output, each output came from just one input, so after the swap each new input has just one output.
Worked examples
Deciding from a set of pairs
Which of these relations are functions?
- (a) \{(1, 3),\ (2, 5),\ (3, 7),\ (4, 9)\}
- (b) \{(-2, 4),\ (-1, 1),\ (0, 0),\ (1, 1),\ (2, 4)\}
- (c) \{(5, 1),\ (6, 2),\ (5, 3),\ (7, 4)\}
- (d) \{(4, 0),\ (8, 2),\ (4, 0)\}
Only a repeated first entry can cause trouble.
(a) The inputs 1, 2, 3, 4 are all different, so (a) is a function.
(b) The inputs -2, -1, 0, 1, 2 are all different, so (b) is a function. The outputs 4 and 1 each appear twice, but a repeated output is two inputs sharing it, which is allowed. (Each output is its input squared, and (-2)^2 = 2^2 = 4.)
(c) The input 5 appears in (5, 1) and in (5, 3), so it has two outputs, and (c) is not a function.
(d) The input 4 appears twice, but both times as (4, 0): one pair written twice. The input 4 has the single output 0, so (d) is a function, the set \{(4, 0),\ (8, 2)\}.
Houses and postcodes
Figure 2 shows five houses on one street and their postcodes.
- (a) Is the postcode a function of the house?
- (b) Is the house a function of the postcode?
(a) The house is the input. Exactly one arrow leaves each house, so the postcode is a function of the house. Three arrows arriving at QX1 4RT say only that three houses share it.
(b) Now the postcode is the input, so every pair is turned round, and the input QX1 4RT is paired with No. 2, No. 4 and No. 6, so the house is not a function of the postcode. Houses sharing a postcode in (a) became a postcode with several houses in (b), as the result on turning a function round predicts.
A table of library cards
A small library keeps this record of its cards.
| Card number | Holder |
|---|---|
| 1047 | Brigid |
| 2213 | Chidi |
| 3380 | Farida |
| 4125 | Chidi |
| 5096 | Eskil |
- (a) Is the holder a function of the card number?
- (b) Is the card number a function of the holder?
(a) The input is the card number. The five card numbers are all different, so each has exactly one holder: the holder is a function of the card number. Chidi appearing twice in the output column only says that two cards share a holder.
(b) Now the holder is the input, and the table is read from right to left. Chidi appears with both 2213 and 4125, so the card number is not a function of the holder. Same table, different input column, different answer.
Three tables of numbers
Which of these tables show y as a function of x?
Table A
| x | 0 | 1 | 2 | 3 | 4 |
|---|---|---|---|---|---|
| y | 5 | 5 | 5 | 5 | 5 |
Table B
| x | 3 | 3 | 3 |
|---|---|---|---|
| y | 0 | 1 | 2 |
Table C
| x | -1 | 0 | 2 | 0 |
|---|---|---|---|---|
| y | 4 | 7 | 1 | 7 |
Table A: the inputs 0 to 4 are all different, so Table A is a function. Five inputs share the output 5, which is allowed. A function whose output never changes is a constant function.
Table B: the one input 3 has the outputs 0, 1 and 2, so Table B is not a function.
Table C: the input 0 appears twice, both times with the output 7, so it still has one output, and -1 and 2 appear once each. Table C is a function: as a set it is \{(-1, 4),\ (0, 7),\ (2, 1)\}.
Names and heights
A school nurse measures four students on the same morning.
| Student | Height (cm) |
|---|---|
| Aurelio | 152 |
| Brigid | 147 |
| Chidi | 152 |
| Dorotea | 160 |
- (a) Is height a function of name?
- (b) Is name a function of height?
- (c) One answer comes from the situation and the other from these particular numbers. Which is which?
(a) The input is the name. No two of these students share a name, and each was measured once, so each name has exactly one height: height is a function of name. Aurelio and Chidi sharing 152 is allowed.
(b) The input 152 goes with both Aurelio and Chidi, so name is not a function of height. Told only “the student who is 152 cm tall”, you cannot say who is meant.
(c) Answer (a) comes from the situation: a person has one height at any one moment. (Two students who shared a name would break it, since that name would then have two heights.) Answer (b) comes from the numbers: with four different heights it would have been “yes” for these four, until a fifth student measured 147 cm. A “yes” that rests only on a table of data holds for that table, not for the situation.
Choosing a missing entry
- (a) For which values of k is \{(1, 2),\ (3, 4),\ (5, 6),\ (k, 9)\} a function?
- (b) For which values of a is \{(2, a),\ (2, 5),\ (4, 7)\} a function?
- (c) Take k = 7 in (a). Is the relation with every pair turned round a function?
(a) The inputs 1, 3 and 5 are all different, so everything depends on the last pair. If k is a new input, all four inputs differ. If k is 1, 3 or 5, that input gets a second output (k = 1 pairs 1 with both 2 and 9). So the relation is a function for every value of k except 1, 3 and 5.
(b) The pairs (2, a) and (2, 5) share the input 2. They agree only if they are the same pair, which needs a = 5, so the relation is a function only when a = 5. It is then \{(2, 5),\ (4, 7)\}.
(c) With k = 7 the outputs 2, 4, 6, 9 are all different. Turned round, the relation is \{(2, 1),\ (4, 3),\ (6, 5),\ (9, 7)\}, whose inputs are all different, so it is a function, as the result on turning a function round says it must be.
Boundaries
“Exactly one” includes “at least one”. When a relation is described in words over a stated group of inputs, every input must have an output. Pair each student in a class with the name of their sister: a student with no sister has no output, a student with two sisters has two, and either way the pairing is not a function. A bare list of pairs cannot fail this way, because its inputs are just the first entries that appear.
The direction is part of the question. “Is this a function?” has no answer until it is settled which entry is the input, as the cards of Example 3 show. When pairs are written (x, y) with no other word, the first entry is the input.
The pairing must be fixed in time. A student’s height changes over a year, so “student to height” is a function only once the moment of measuring is fixed.
Where this goes next
Collecting a relation’s inputs into one set and its outputs into another gives its domain and range, in Domain and range from pairs and tables. Because a function gives each input exactly one output, that output can be named: f(3) means “the one output the function f pairs with 3”, the notation of Evaluating a function at a number.
Plotting a table’s pairs gives a graph, in Graphing a function from a table, where the test becomes the Testing graphs and equations for functions; reading pairs back off a graph is Reading values off a graph. Inputs chosen freely and outputs that follow are independent and dependent variables, and turning a real situation into such a pairing is building a model.
Exercises
Sets of ordered pairs
Decide whether each relation is a function. If it is not, name an input with more than one output.
- \{(1, 8),\ (2, 8),\ (3, 8)\}
- \{(0, 1),\ (1, 0),\ (0, -1)\}
- \{(-3, 2),\ (-1, 4),\ (1, 6),\ (3, 8)\}
- \{(7, 7),\ (8, 8),\ (7, 7),\ (9, 6)\}
- \{(2, 3),\ (3, 2),\ (2, 2)\}
Mapping diagrams
- Write the relation in diagram P as a set of ordered pairs. Is it a function?
- Write the relation in diagram Q as a set of ordered pairs. Is it a function?
- Turn every arrow of diagram P round, so that its outputs become inputs. Is the new relation a function?
Tables
Each table gives x in the top row and y below it.
Table D
| x | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|
| y | 2 | 4 | 2 | 4 | 2 |
Table E
| x | 6 | 7 | 6 | 8 |
|---|---|---|---|---|
| y | 1 | 1 | 2 | 3 |
Table F
| x | -2 | 0 | -2 | 5 |
|---|---|---|---|---|
| y | 9 | 3 | 9 | 3 |
- Does Table D show y as a function of x? Does it show x as a function of y?
- Does Table E show y as a function of x?
- Does Table F show y as a function of x?
Choosing a missing entry
Table G
| x | 1 | 2 | 1 | 4 |
|---|---|---|---|---|
| y | 5 | 6 | m | 8 |
- For which value of m does Table G show y as a function of x?
- For which values of k is \{(k, 1),\ (2, 3),\ (4, 5)\} a function?
Real situations
- Each student at a school is in exactly one class, and each class has many students. Is the class a function of the student? Is the student a function of the class?
- A library lets each person hold only one card, and each card belongs to one person. Is the card number a function of the holder? Compare Example 3.
- In a certain town some postcodes belong to a single house and others to many houses. Is the house a function of the postcode? What would have to be true of every postcode for it to be?
- A coat check hangs a numbered ticket on each coat it takes, one ticket per coat, and no two tickets carry the same number. Is the coat a function of the ticket number? Is the ticket number a function of the coat?
- Dorotea’s height was measured on 1 January each year: 128 cm in 2019, 134 cm in 2020, 134 cm in 2021, 141 cm in 2022 and 147 cm in 2023. Is her height a function of the year? Is the year a function of her height?
Reasoning
- Farida says: “A relation is a function when no output appears twice.” Give one relation showing she is wrong because it is a function with a repeated output, and one showing she is wrong because it is not a function although no output repeats.
- A mapping diagram has the inputs 1, 2, 3 and the outputs 10, 20. At least one arrow leaves each input and at least one arrow arrives at each output. Show that it can be a function. Then explain why the relation with every arrow turned round can never be a function, whatever the arrows are.
Answers
- A function. The inputs 1, 2, 3 are all different; sharing the output 8 is allowed.
- Not a function. The input 0 has the outputs 1 and -1.
- A function. The inputs -3, -1, 1, 3 are all different.
- A function. The input 7 appears twice, both times as (7, 7), the same pair.
- Not a function. The input 2 has the outputs 3 and 2.
- \{(-1, 3),\ (0, 5),\ (1, 5),\ (2, 9)\}. A function: one arrow leaves each input.
- \{(4, 1),\ (6, 2),\ (6, 3),\ (8, 3)\}. Not a function: two arrows leave 6.
- \{(3, -1),\ (5, 0),\ (5, 1),\ (9, 2)\}. Not a function: the input 5 has the outputs 0 and 1, because 0 and 1 shared the output 5 in P.
- y is a function of x: the inputs 1 to 5 are all different. x is not a function of y: y = 2 goes with x = 1, 3 and 5.
- Not a function. The input 6 has the outputs 1 and 2.
- A function. The input -2 appears twice, both times with 9; as a set the table is \{(-2, 9),\ (0, 3),\ (5, 3)\}.
- m = 5. Both rows for the input 1 must be the pair (1, 5); any other m gives 1 two outputs.
- Every k except 2 and 4. With k = 2 the input 2 has the outputs 1 and 3; with k = 4 the input 4 has 1 and 5. Any other k is a new input.
- The class is a function of the student, since each student is in one class. The student is not a function of the class, since one class goes with many students.
- Yes. Each holder has exactly one card; Chidi’s two cards in Example 3 are now ruled out.
- No. A postcode with many houses is one input with many outputs. It would be a function if every postcode belonged to exactly one house.
- Both are functions. Each coat has one ticket, and since the numbers are all different, each number is on one coat.
- Height is a function of the year: one measurement each year, and 2020 and 2021 sharing 134 is allowed. The year is not a function of her height: 134 goes with 2020 and 2021.
- For example, \{(1, 5),\ (2, 5)\} repeats the output 5 and is a function, while \{(1, 5),\ (1, 6)\} repeats no output and is not one. The test is about inputs, not outputs.
- It can be a function, for example \{(1, 10),\ (2, 10),\ (3, 20)\}. Turned round it never is: each of the three inputs has an arrow, so at least three arrows land on two outputs and some output receives two. They come from different inputs, since two arrows from one input to one output would be the same pair. Turned round, that output is an input with two outputs.