1. Relations and Functions
1.1 Chapter Opener: Big Idea, Prerequisite Check and Historical Roots
Chapter 1
Relations and Functions
Big idea: a relation says which things are connected. A function is a relation with a promise: each input has exactly one output. That promise lets you predict, compare, and sometimes undo.
Look at a school roll-number list. Each roll number points to exactly one student. No roll number points to two students, and no student has two roll numbers. That is the whole chapter in one picture: some connections are loose, and some keep a strict promise.
This chapter turns that picture into mathematics. First you will see what a connection means as a set of pairs. Then you will sort connections by three testable habits: reflexive, symmetric and transitive. The connections with all three habits are called equivalence relations, and they split a set into neat groups. Then you will meet functions, first as strict connections and then as formulas, and learn the two function habits one-one and onto. Finally you will chain functions and undo them.
- 1.1 writes connections as pairs and counts them, then states the function promise.
- 1.2 tests relations for the three habits and builds groups called equivalence classes.
- 1.3 tests functions as one-one, onto or both, and counts the functions on small sets.
- 1.4 chains two functions into one and finds the undo rule, called the inverse.
A school keeps a roll-number list. Roll number 1 belongs to one student, roll number 2 to another, and so on. Nobody shares a roll number, and nobody has two. A phone contact list works the same way: each saved name calls exactly one number. These everyday lists already contain the two ideas of this chapter.
A shop lists three phone models. Each model comes in some of three colours. If you write down "model 1 comes in colour 2", you have written one connection between two things. A list of such connections is called a relation. Relations are everywhere: a timetable links classes to rooms, a menu links dishes to prices, a map links towns to roads.
An ordered pair is two things written in a fixed order. The order matters: is not the same pair as . Think of a cinema seat: row 1, seat 2 is a different seat from row 2, seat 1. If and are sets, the Cartesian product is the set of all ordered pairs with the first item from and the second from .
Let be the phone models and the colours (1 = black, 2 = silver, 3 = blue). Then has pairs. In general, if has items and has items, then has pairs. The small case has pairs, which you can list by hand to check the rule.
| Model | Black (1) | Silver (2) | Blue (3) |
|---|---|---|---|
| Model 1 | Yes | Yes | — |
| Model 2 | — | Yes | — |
| Model 3 | Yes | Yes | Yes |
Read the table row by row. Model 1 has two marks, model 2 has one mark, and model 3 has three marks. Each mark is one connection. The table and the pair list below say exactly the same thing in two layouts.
A relation from to is any subset of . Suppose the shop sells model 1 in black and silver, model 2 only in silver, and model 3 in all three colours. Then
We write , or , when the pair is in the relation. Because has 9 pairs and each pair is either in or out of , there are possible relations from to . Each of the positions is a yes-or-no choice, so the count is multiplied by itself times.
A grid with phone model 1, 2, 3 along the horizontal axis and colour 1, 2, 3 up the vertical axis. Six dots are drawn: model 1 with colours 1 and 2, model 2 with colour 2, and model 3 with colours 1, 2 and 3.
Read the figure one dot at a time. Move along the horizontal axis to a model, then up to a colour. A dot means the shop sells that combination. Model 1 has two dots above it, so it comes in two colours. Model 2 has one dot. Dots never move: the picture is the relation.
Look at model 1 in the relation above. It has two colours, so if someone asks "what is the colour of model 1?" there is no single answer. A function removes this problem. It is a relation in which each input has exactly one output.
Now suppose each model has one default colour: model 1 is black, model 2 is silver, model 3 is black. This is . Every model appears exactly once as a first item, so is a function. We write , , . Its range, the outputs that really happen, is : colour is allowed but never used.
Read the diagram from left to right. The number 2 enters the box. Inside, the rule doubles it and adds 1. The number 5 leaves. Feed the same 2 again tomorrow and the same 5 comes out. That repeatability is the function promise.
Goal: decide whether two small lists are functions from to . Given: and .
Step 1: count how often each input appears as a first item. In R, the input 1 appears twice, in (1, 1) and (1, 2). Step 2: apply the promise. Because 1 has two outputs, R breaks the promise, so R is not a function. Step 3: repeat for F. Each of 1, 2 and 3 appears exactly once, so F is a function. Conclusion: R is a relation only, while F is also a function. The computer check agrees: R fails the function test and F passes it.
Step 4, a sharper edge: the list {(1, p), (2, q)} on inputs {1, 2, 3} is not a function either, because input 3 never appears. A function needs every input to appear exactly once: no repeats and no gaps.
A grid with inputs 1, 2, 3 along the horizontal axis and outputs 1, 2, 3 up the vertical axis. Three dots are drawn at (1, 1), (2, 2) and (3, 1). Each vertical line through an input meets exactly one dot.
Compare the two dot pictures. In the R picture, model 1 has two dots stacked above it. In the F picture, every input has exactly one dot. That single difference is the whole idea of a function.
Answer in one sentence each, then compare with the answers below.
Try these on paper. Each answer shows the step you may have missed.
In this chapter you will learn:
- the main types of relations: reflexive, symmetric, transitive, and the very useful equivalence relation;
- the main types of functions: one-one, onto, and bijective;
- composition: doing one function after another;
- inverse functions: when a function can be undone, and how to find the undo rule.
The idea of a function grew slowly over about three hundred years. Each step made it wider than the one before. What you use today as one short definition took many generations to sharpen.
- 1637: René Descartes used the word "function" for powers of a variable, such as and , while studying curves like the parabola and the hyperbola.
- 1667: James Gregory described a function as a quantity obtained from other quantities by algebraic steps, or by "any other operation".
- 1673 and 1714: Gottfried Wilhelm Leibniz (1646–1716) first used the word for quantities that change from point to point along a curve, such as a slope. Later he used it for any quantity that depends on a variable, and he was the first to say "function of ".
- 1718: Johann Bernoulli (1667–1748) wrote for a function of .
- 1734: Leonhard Euler (1707–1783) made letters such as , , and the normal way to name functions. The form that you use today comes from this period.
- 1837: Peter Gustav Lejeune Dirichlet (1805–1859) gave a very wide definition: a function is any rule that gives one for each . No formula is needed.
- Later: after Georg Cantor (1845–1918) built set theory, a function could be defined as a set of ordered pairs with the "one output for each input" property.
Look back at Section 1.1. The definition in this chapter, a function as a special set of ordered pairs, is the last step of this long story. Dirichlet freed the function from formulas, and Cantor gave it a home in sets. Your dot pictures of Section 1.1 are that final idea drawn on paper.
1.2 Types of Relations and Equivalence Classes
From now on we study relations inside one set: a relation in a set is a subset of . This is how we compare things of the same kind: numbers with numbers, lines with lines, words with words.
Think of a height chart for one class. "Is the same height as" compares student with student. "Is taller than" does the same. Both live inside one set, and both can be tested pair by pair. That test is this whole section.
- [Board Standard] The empty relation has no pairs: . Nothing is related to anything.
- [HOTS] The universal relation has all pairs: . Everything is related to everything.
- [Concept] Reflexive: every item is related to itself. for every .
- [Board Standard] Symmetric: if is related to , then is related to . implies .
- [HOTS] Transitive: if is related to and is related to , then is related to . and imply .
Think of "is the same height as". Everyone is the same height as themselves (reflexive). If A is the same height as B, then B is the same height as A (symmetric). If A matches B and B matches C, then A matches C (transitive). Compare "is taller than": it is transitive, but it is not reflexive and not symmetric.
A slow way to remember the three: reflexive looks in the mirror (each item with itself), symmetric looks both ways (every arrow has a return arrow), and transitive builds bridges (two short steps give one long step). Test them in that order and write the witness each time.
A relation that is reflexive, symmetric and transitive is called an equivalence relation. It says "these two items are the same in the way we care about". Same height, same colour, same remainder after dividing by 3: all of these are equivalence relations. An equivalence relation sorts a set into non-overlapping groups.
Take and test ten relations. The answers below were computed pair by pair.
| Relation | Rule for | Reflexive | Symmetric | Transitive |
|---|---|---|---|---|
| The empty relation | no pair at all | No | Yes | Yes |
| The universal relation | every pair | Yes | Yes | Yes |
| Equal | Yes | Yes | Yes | |
| Less than | No | No | Yes | |
| Less than or equal | Yes | No | Yes | |
| Divides | divides | Yes | No | Yes |
| Differ by exactly 1 | No | Yes | No | |
| Differ by at most 1 | Yes | Yes | No | |
| Add up to 7 | No | Yes | No | |
| Same parity | is even | Yes | Yes | Yes |
Read the table one row at a time. The "Equal" row says Yes three times: it is an equivalence relation. The "Less than" row says No, No, Yes: only transitivity holds. The "Same parity" row says Yes three times as well, so it is also an equivalence relation. Each Yes or No was found by testing every pair, not by guessing.
- [Board Standard] To prove a property for a rule on all numbers, take general items (, , ) and use the algebra of the rule.
- [HOTS] To disprove a property, one counterexample is enough. Find one pair (or two linked pairs) where the rule fails.
Goal: test on for the three properties.
Step 1, reflexive: every item needs its own pair. The pairs (1, 1) and (2, 2) are present, but (3, 3) is missing. So R is not reflexive, with witness (3, 3). Step 2, symmetric: each pair needs its return. The pairs (1, 2) and (2, 1) return to each other, and the diagonal pairs return to themselves. So R is symmetric. Step 3, transitive: check every chain. The chain (1, 2) and (2, 1) needs (1, 1), which is present. The chain (2, 1) and (1, 2) needs (2, 2), which is present. All other chains stay on the diagonal. So R is transitive. Conclusion: not reflexive, but symmetric and transitive.
| Property | Verdict | Witness |
|---|---|---|
| Reflexive | No | is missing |
| Symmetric | Yes | every pair has its return |
| Transitive | Yes | each chain lands on a present pair |
A grid with inputs 1, 2, 3 along both axes. Four dots are drawn at (1, 1), (2, 2), (1, 2) and (2, 1). The position (3, 3) on the diagonal is empty, and the whole third row and column have no dots.
Read the figure against the table. The two off-diagonal dots come in a mirrored pair, so symmetry holds. The diagonal has dots at (1, 1) and (2, 2) but a gap at (3, 3), so reflexivity fails at exactly one witness. One gap is enough to fail.
Let be the relation on the set of integers given by when is a multiple of . Show that is an equivalence relation.
- [Concept] Reflexive: , which is a multiple of . So .
- [Board Standard] Symmetric: suppose for some integer . Then , which is also a multiple of . So .
- [HOTS] Transitive: suppose and . Adding, , a multiple of . So .
All three hold, so is an equivalence relation. As a check, the computer tested every pair of the integers from to and agreed: reflexive Yes, symmetric Yes, transitive Yes. (The proof above covers all integers. The test covers this sample.)
On let when (the product is zero or positive). It is reflexive, because . It is symmetric, because . But it is not transitive: because , and because . Yet , because . The number links numbers that should not be linked.
Slow down on this counterexample. The two short steps both pass through 0, and 0 passes the test with everything. But the long step from -1 to 1 avoids 0 and fails. Transitivity demands that every two-step path has its shortcut, with no exceptions.
An equivalence relation sorts a set into groups. The equivalence class of , written , is the set of all items related to . Take and let when is a multiple of (same remainder when divided by ). The classes are
- [Concept]
- [Board Standard]
- [HOTS]
Every item is in exactly one class, and different classes never overlap. We say the classes partition the set. This is why equivalence relations matter: they turn "same in some way" into clean groups. Days of the week work like this: every day number has a remainder when divided by 7, and the same remainder means the same weekday.
Decide which of the three properties each relation has, and name one witness for each No.
Work these with the three-step habit: mirror first, then both-ways, then bridges.
1.3 Exercise 1.1: Relations and Equivalence
1.4 Types of Functions: Injective, Surjective and Bijective Maps
A ticket machine sells seats for one show. You press seat number 12 and the machine prints exactly one ticket. It never prints two tickets for one press, and it never eats your press without printing. That strict behaviour is a function. A display board that lists every film showing in hall 2, by contrast, may list three films: one input with three outputs is a relation, not a function.
A function from a set to a set is written . The set is the domain (the allowed inputs). The set is the codomain (where outputs are allowed to live). The range is the set of outputs that actually happen, and it can be smaller than the codomain.
Example: let be . The domain and codomain are both . But no square is negative, so the range is only . The codomain is the waiting room; the range is who actually shows up.
Read the diagram as a promise. The 3 goes in, the rule works, and 9 comes out. Put 3 in again and 9 comes out again. If a machine sometimes gave 9 and sometimes 10 for the same 3, it would break the promise and stop being a function.
Two questions decide what kind of function we have. Both are about the outputs:
- [Board Standard] One-one (injective): do different inputs always give different outputs? Nothing is shared.
- [HOTS] Onto (surjective): is every item of the codomain actually used as an output? Nothing is left out.
In symbols, is one-one when forces . And is onto when for every in the codomain there is some in the domain with . A function that is both is called bijective: a perfect pairing of the domain with the codomain.
Let the domain be and the codomain .
| Function | Pairs | One-one? | Onto? |
|---|---|---|---|
| Yes | Yes | ||
| No | No |
pairs everything perfectly, so it is bijective. In , the inputs and both go to (not one-one), and is never used (not onto). Read the table as a pairing game: uses every letter exactly once, while reuses and wastes .
- [Concept] One-one: assume and show that . To show it is not one-one, find two different inputs with the same output.
- [Board Standard] Onto: take any in the codomain and try to solve for . If you always find an in the domain, the function is onto. To show it is not onto, find one that no input can reach.
- [HOTS] Graph test: draw horizontal lines. If some horizontal line meets the graph twice, the function is not one-one. If some horizontal line in the codomain meets the graph never, it is not onto.
Show that , is bijective.
One-one. Suppose . Then , so , so .
Onto. Take any real . Solving gives , which is a real number. And . So every is reached.
Graph of the straight line y equals 3x plus 2 from x equals minus 2 to 3, with a dashed horizontal line at y equals 5 meeting the line at the single marked point (1, 5).
Read the figure with the horizontal-line test. The dashed line meets the graph exactly once, at . Every other horizontal line behaves the same way: exactly one meeting point. One meeting point per line is the picture of bijective.
Is , one-one? Is it onto?
Not one-one: and . Two different inputs share one output. Not onto: every square is or more, so no input gives . The graph shows both problems at once.
Graph of the parabola y equals x squared from x equals minus 3 to 3, with a horizontal dashed line at y equals 4 that meets the curve at two marked points, (minus 2, 4) and (2, 4).
Read this figure against the previous one. Here the dashed line meets the curve twice, so one-one fails. Below the horizontal axis there are no meeting points at all, so onto fails too. Two failures, one picture.
Fixing it. Whether a function is one-one or onto depends on its domain and codomain, so we can repair it. Let , . Now each output comes from exactly one input, . So is bijective.
The function , is bijective. It rises all the way along the real line, so no output repeats (one-one). And every real has a real cube root, so every is reached (onto). The computer confirms the steady rise on and the exact undo pairing with the cube-root rule.
Show that , is bijective.
One-one. Suppose . Then . Cross-multiply: . Expand both sides: . Cancel and : , so , so .
Onto. Let . Solve : , so , so . This is defined because . And it is never (if it were, , which is impossible). So every is reached. At the value is , and at it is : two anchor points the graph must pass through.
Graph of the function f of x equals the fraction (2x plus 1) over (x minus 3). It has two separate branches. The left branch lies below the horizontal dashed line y equals 2, and the right branch lies above it. A vertical dashed line at x equals 3 separates them.
Read the figure for what is missing, not only for what is drawn. The vertical dashed line is the forbidden input 3: no point of the graph touches it. The horizontal dashed line is the unreachable output 2: no point reaches it. Remove exactly those two lines from both axes and every remaining output is reached exactly once.
Let the domain have items and the codomain items. Each input can go to any of outputs, so there are functions in all. For one-one functions, the first input has choices, the next has (it cannot repeat), and so on: functions. The table was found by listing every function by computer.
| Domain size | Codomain size | All functions | One-one | Onto | Bijective |
|---|---|---|---|---|---|
- [Concept] If there is no one-one function: too many inputs for too few outputs (the "pigeonhole idea").
- [Board Standard] If there is no onto function: too few inputs to reach every output.
- [HOTS] A bijection needs . When , the number of bijections is (the table shows ).
Read one row as a story. From items to items there are functions, but only are one-one and none are onto: five outputs cannot be covered by three inputs. From items to items, of the functions are onto. The computer listed all of them.
Domain . For each map, say if it is one-one, onto, both or neither.
Use the two-question habit on each map: shared outputs first, then unused outputs.
1.5 Exercise 1.2: Function Properties and Mappings
1.6 Composition of Functions and Invertible Functions
A food stall works in two steps. First the cook adds 1 spoon of sugar to each cup. Then the helper doubles the whole cup into a large glass. The customer tastes the combined result, not the middle step. Two small rules made one bigger rule. That is composition.
Imagine a two-step machine. The first machine takes a number and doubles it, then adds . The second machine squares whatever it receives. If you put a number through both machines in order, you have built a new function. This is called the composition of and .
The composition, written (read " after ") means: apply first, then . In symbols, .
Read the diagram in three hops. The 3 enters the first box and 7 comes out. The 7 enters the second box and 49 comes out. Cover the middle with your finger and the whole picture is one machine sending 3 to 49. That covered machine is g after f.
With and : . At , the first machine gives and the second gives . In the other order, , and at it gives .
For to make sense, every output of must be an allowed input of . In other words, the range of must fit inside the domain of .
Three curves from x equals minus 3 to 3: the straight line f of x equals 2x plus 1, the parabola g of x equals x squared, and the steeper parabola g after f of x equals (2x plus 1) squared. At x equals 3 the marked heights are 7, 9 and 49.
Read the plot at one vertical slice, x = 3. The straight line is at height 7: that is f(3). The lower parabola is at 9: that is g(3). The steep curve is at 49: it took the 7 and squared it. Following the slice upward shows the order: f first, then g.
Goal: combine and , then evaluate both orders at .
Step 1: . At this is . Step 2: . At this is . Conclusion: even these tiny rules give different answers in different orders, against . The computer checked both formulas at four sample points.
Let be , and be . Follow each input through both steps:
So . Notice that is not one-one (both and go to ), and neither is . Read the table down each column: the middle column is the stopover, and the last column forgets it.
- [Concept] Composition of one-one functions is one-one. If , then being one-one gives , and then being one-one gives .
- [Board Standard] Composition of onto functions is onto. Take any target . Because is onto, some has . Because is onto, some has . Then .
- [HOTS] So the composition of two bijections is a bijection. This was checked on the pair of functions and , giving .
Composition also has a tidy property: it is associative. . With , , , both ways give , which equals at . So we can write with no brackets.
Some functions can be undone. If turns into by "double and add ", the undo machine turns back into by "subtract and halve". We say is the inverse of when doing one and then the other gets you back where you started, in both orders:
- [Board Standard] for every in the domain of (do , then undo it);
- [HOTS] for every in the domain of (undo, then do ).
We write the inverse as . A function that has an inverse is called invertible.
- [Concept] Check that the function is a bijection between the given domain and codomain.
- [Board Standard] Write .
- [Board Standard] Solve this equation for , so that is written using .
- [HOTS] Rename: the result is . You may then call the variable again.
- [HOTS] State the domain and range of . They are the range and domain of , swapped.
Find the inverse of on . Write . Then , so . Hence . As a check, and : the undo returns the starting input.
For , swapping each pair gives . Reversing arrows is all there is when the function is given as pairs.
In Example 4 of Section 1.3, solving gave . So the inverse of is , . Notice how the missing input and the missing output trade places.
The function , is a bijection. Solving with gives . So . For instance and .
Two curves and a dashed diagonal line y equals x. One curve is y equals x squared plus 2 for x from 0 to 3. The other is its inverse, y equals the square root of x minus 2, for x from 2 to 11. The two curves are mirror images of each other in the diagonal. The points (3, 11) and (11, 3) are marked.
Read the mirror. Pick (3, 11) on the rising curve. Flip it across the dashed diagonal and you land on (11, 3) on the other curve. Swapping coordinates is the same as swapping each pair in a pair list. The diagonal is the mirror, not part of either graph.
To undo "put on socks, then put on shoes" you must take off the shoes first, then the socks. In symbols, if and are invertible,
Check with and . Then , whose inverse is . On the other side, and , so . They agree. In the wrong order, , which is different.
Work from the inside out: inner rule first, then the outer rule.
1.7 Miscellaneous Worked Examples
The five examples below mix every idea of the chapter: one equivalence relation, one counting argument, one harder bijection, one self-inverse function, and one counting puzzle. Read each with the same habit: goal first, then the given facts, then one justified step at a time.
Goal: show that "equal fractions" is an equivalence relation on pairs. Given: the ordered pairs with . Say when . Show that this is an equivalence relation and describe the classes.
Step 1, reflexive: . Step 2, symmetric: if then . Step 3, transitive: if and , multiply the first by and the second by and compare: , and cancelling gives . The computer also checked all pairs of pairs.
The rule says " and are equal fractions". The pairs fall into 11 classes, one for each different fraction. The class of is , because . The class of has 4 pairs: . So a fraction is an equivalence class of pairs.
Goal: count the onto maps. Given: domain , codomain . How many onto functions are there?
Step 1: start with all functions: . Step 2: remove those that miss at least one output. There are ways to miss one chosen output, each leaving functions, so subtract . Step 3: functions that miss two outputs (everything goes to one item) were subtracted twice. There are of them, so add back . Total: . Listing every function by computer also gives 36.
Goal: squeeze the whole real line into a short interval without losing the pairing. Given: , . Show it is a bijection and find its inverse.
Step 1, inside the interval: since , we have .
Step 2, one-one: if , then and have the same sign (or both are ). Squaring both sides, , so . With the same sign, .
Step 3, onto and inverse: for , put . Then , so and . This formula is also the inverse: . The computer checked the steady rise and the undo pairing on samples.
Goal: show the undo of is itself. Given: for . Show that is the identity, so .
Step 1: . Step 2: test numbers. For example and : the function swaps and . Conclusion: applying twice returns the start, so undoes itself.
Goal: count relations with three demands at once. Given: relations on containing and , reflexive and symmetric, but not transitive. How many?
Step 1: reflexive and symmetric relations containing and have the three pairs and the pair . Step 2: the only free choices are the pair (both and , or neither) and the pair . That is relations. Step 3: two of them are equivalence relations: add neither of the links, or add both. If we add exactly one link (say but not ), transitivity breaks: and are there but is missing. So the answer is 2.
Goal: see an inverse pair as mirror images. Given: and on . Step 1: and , so . Step 2: test numbers: and . Conclusion: doubling is bijective, and halving undoes it.
Two straight lines and a dashed diagonal y equals x: the steep line y equals 2x through (6, 12) and the shallow line y equals x over 2 through (12, 6). The two marked points are mirror images of each other in the diagonal.
Read the mirror exactly as in Section 1.4. The steep line doubles every input; the shallow line halves every input. The dashed diagonal swaps the coordinates: follow any point across it to find its partner on the other line.
Three short items that reuse the worked methods on new numbers.
1.8 Miscellaneous Exercise and Board Assessment
1.9 Chapter Summary and Relations Formula Sheet
This chapter built one idea in four layers. A relation lists connections. Three tests sort those connections. A function keeps a strict promise. Chaining and undoing complete the toolkit. Read the layer below that still feels shaky, then redo its worked example without looking.
- Relation: a subset of . A relation in a set is a subset of .
- Empty relation: no pairs. Universal relation: all pairs.
- Reflexive: for every . Symmetric: implies . Transitive: and in imply .
- Equivalence relation: reflexive, symmetric and transitive. It splits the set into equivalence classes that do not overlap.
- Function : every input has exactly one output. Domain = inputs, codomain = allowed outputs, range = outputs that really happen.
- One-one: implies . Onto: every item of the codomain is an output. Bijective: both.
- Counting from an -set to an -set: functions; one-one; bijections only if , and then there are .
- Composition: . Apply first. It is associative but usually not commutative. Composition of one-one (onto) functions is one-one (onto).
- Invertible: has an inverse exactly when it is a bijection. Then and . The graph of is the mirror image of the graph of in the line .
- Inverse of a composition: . Undo in the reverse order.
One input, one output; test the three habits; check both function questions; inner rule first; undo reverses the order.