←
Mathematics — Grade 12, Part I
RELATIONS AND FUNCTIONS · 1 / 6
⌕
Chapter 1 of 6

RELATIONS AND FUNCTIONS

11 sections · 6,777 words

Chapter 1: Relations and Functions

37 words · 1 min read

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.

1.1 Introduction

519 words · 2 min read

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 (a,b)(a, b) is two things written in a fixed order. The order matters: (1,2)(1, 2) is not the same pair as (2,1)(2, 1). If AA and BB are sets, the Cartesian product A×BA \times B is the set of all ordered pairs with the first item from AA and the second from BB.

Let A={1,2,3}A = \{1, 2, 3\} be the phone models and B={1,2,3}B = \{1, 2, 3\} the colours (1 = black, 2 = silver, 3 = blue). Then A×BA \times B has 3×3=93 \times 3 = 9 pairs. In general, if AA has mm items and BB has nn items, then A×BA \times B has m×nm \times n pairs.

A relation RR from AA to BB is any subset of A×BA \times B. Suppose the shop sells model 1 in black and silver, model 2 only in silver, and model 3 in all three colours. Then

R={(1,1),(1,2),(2,2),(3,1),(3,2),(3,3)}R = \{(1, 1), (1, 2), (2, 2), (3, 1), (3, 2), (3, 3)\}

We write (a,b)∈R(a, b) \in R, or a R ba \, R \, b, when the pair is in the relation. Because A×BA \times B has 9 pairs and each pair is either in RR or out of RR, there are 29=5122^{9} = 512 possible relations from AA to BB.

The relation R as dots on the grid of A × B. Each dot is one pair in R.

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 every 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 F={(1,1),(2,2),(3,1)}F = \{(1, 1), (2, 2), (3, 1)\}. Every model appears exactly once as a first item, so FF is a function. We write F(1)=1F(1) = 1, F(2)=2F(2) = 2, F(3)=1F(3) = 1.

In simple words: a relation can connect one input to many outputs. A function cannot. A function is like a vending machine: one button always gives one item.

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.

1.2 Types of Relations

1,018 words · 5 min read

From now on we study relations inside one set: a relation RR in a set XX is a subset of X×XX \times X. This is how we compare things of the same kind: numbers with numbers, lines with lines, words with words.

  • The empty relation has no pairs: R=∅R = \varnothing. Nothing is related to anything.
  • The universal relation has all pairs: R=X×XR = X \times X. Everything is related to everything.

  • Reflexive: every item is related to itself. (a,a)∈R(a, a) \in R for every a∈Xa \in X.
  • Symmetric: if aa is related to bb, then bb is related to aa. (a,b)∈R(a, b) \in R implies (b,a)∈R(b, a) \in R.
  • Transitive: if aa is related to bb and bb is related to cc, then aa is related to cc. (a,b)∈R(a, b) \in R and (b,c)∈R(b, c) \in R imply (a,c)∈R(a, c) \in R.

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 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.

Take X={1,2,3,4,5,6}X = \{1, 2, 3, 4, 5, 6\} and test ten relations. The answers below were computed pair by pair.

RelationRule for a R ba \, R \, bReflexiveSymmetricTransitive
The empty relationno pair at allNoYesYes
The universal relationevery pairYesYesYes
Equala=ba = bYesYesYes
Less thana<ba < bNoNoYes
Less than or equala≤ba \le bYesNoYes
Dividesaa divides bbYesNoYes
Differ by exactly 1∣a−b∣=1|a - b| = 1NoYesNo
Differ by at most 1∣a−b∣≤1|a - b| \le 1YesYesNo
Add up to 7a+b=7a + b = 7NoYesNo
Same paritya−ba - b is evenYesYesYes
A surprise: the empty relation is symmetric and transitive. The rules say "if (a,b)(a, b) is in RR, then ...". With no pairs, the "if" never happens, so the rule can never be broken. But it is not reflexive, because (a,a)(a, a) is missing for every aa.

  • To prove a property for a rule on all numbers, take general items (aa, bb, cc) and use the rule with algebra.
  • To disprove a property, one counterexample is enough. Find one pair (or two linked pairs) where the rule fails.

Let RR be the relation on the set Z\mathbb{Z} of integers given by a R ba \, R \, b when a−ba - b is a multiple of 44. Show that RR is an equivalence relation.

  • Reflexive: a−a=0=4×0a - a = 0 = 4 \times 0, which is a multiple of 44. So a R aa \, R \, a.
  • Symmetric: suppose a−b=4ka - b = 4k for some integer kk. Then b−a=4(−k)b - a = 4(-k), which is also a multiple of 44. So b R ab \, R \, a.
  • Transitive: suppose a−b=4ka - b = 4k and b−c=4mb - c = 4m. Adding, a−c=4(k+m)a - c = 4(k + m), a multiple of 44. So a R ca \, R \, c.

All three hold, so RR is an equivalence relation. As a check, the computer tested every pair of the integers from −8-8 to 88 and agreed: reflexive Yes, symmetric Yes, transitive Yes. (The proof above covers all integers. The test covers this sample.)

On X={−3,−2,−1,0,1,2,3}X = \{-3, -2, -1, 0, 1, 2, 3\} let a R ba \, R \, b when a×b≥0a \times b \ge 0 (the product is zero or positive). It is reflexive, because a×a≥0a \times a \ge 0. It is symmetric, because a×b=b×aa \times b = b \times a. But it is not transitive: (−1,0)∈R(-1, 0) \in R because (−1)(0)=0≥0(-1)(0) = 0 \ge 0, and (0,1)∈R(0, 1) \in R because 0≥00 \ge 0. Yet (−1,1)∉R(-1, 1) \notin R, because (−1)(1)=−1<0(-1)(1) = -1 < 0. The number 00 links numbers that should not be linked.

An equivalence relation sorts a set into groups. The equivalence class of aa, written [a][a], is the set of all items related to aa. Take X={1,2,3,4,5,6,7,8,9}X = \{1, 2, 3, 4, 5, 6, 7, 8, 9\} and let a R ba \, R \, b when a−ba - b is a multiple of 33 (same remainder when divided by 33). The classes are

  • [1]={1,4,7}[1] = \{1, 4, 7\}
  • [2]={2,5,8}[2] = \{2, 5, 8\}
  • [3]={3,6,9}[3] = \{3, 6, 9\}

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.

In simple words: an equivalence relation puts items into boxes, and two items are related exactly when they are in the same box.
Common mistake: checking only one property. "Reflexive and symmetric" is not enough for an equivalence relation. Transitivity is the one students forget, and it is the one that most often fails.

Decide which of the three properties each relation has.

  1. On {1,2,3,4}\{1, 2, 3, 4\}: R={(1,1),(2,2),(3,3),(4,4),(1,2)}R = \{(1, 1), (2, 2), (3, 3), (4, 4), (1, 2)\}.
  2. On {1,2,3}\{1, 2, 3\}: R={(1,2),(2,1),(1,1)}R = \{(1, 2), (2, 1), (1, 1)\}.
  3. On {1,2,3,4}\{1, 2, 3, 4\}: a R ba \, R \, b when a+b=5a + b = 5.
  4. On {1,2,3,4}\{1, 2, 3, 4\}: a R ba \, R \, b when a≤ba \le b.

Answers

  1. Reflexive and transitive, but not symmetric.
  2. Symmetric, but not reflexive or transitive.
  3. Symmetric, but not reflexive or transitive.
  4. Reflexive and transitive, but not symmetric.

EXERCISE 1.1

619 words · 3 min read
  1. On {1,2,3}\{1, 2, 3\}, let R={(1,1),(2,2),(3,3),(1,2),(2,1)}R = \{(1, 1), (2, 2), (3, 3), (1, 2), (2, 1)\}. Which of the three properties does RR have? Is it an equivalence relation?
  2. On X={1,2,3,4,5,6}X = \{1, 2, 3, 4, 5, 6\}, let a R ba \, R \, b when a×b<10a \times b < 10. Test the three properties.
  3. On X={1,2,…,8}X = \{1, 2, \dots, 8\}, let a R ba \, R \, b when aa divides bb. Test the three properties.
  4. On the integers from −6-6 to 66, let a R ba \, R \, b when a−ba - b is a multiple of 55. Show that it is an equivalence relation and list the equivalence classes. What is the class of 00?
  5. How many relations on a set of 33 items are (a) reflexive, (b) symmetric, (c) equivalence relations?
  6. On the set of all straight lines in a plane, let "ll is perpendicular to mm" be the relation. Which properties does it have?
  7. On the words {cat,dog,tree,bird,sun,moon}\{\text{cat}, \text{dog}, \text{tree}, \text{bird}, \text{sun}, \text{moon}\}, let two words be related when they have the same number of letters. Show it is an equivalence relation and find the classes.
  8. On {−2,−1,0,1,2}\{-2, -1, 0, 1, 2\}, let a R ba \, R \, b when a2=b2a^2 = b^2. Is RR an equivalence relation? Find its classes.
  9. On the real numbers, let a R ba \, R \, b when a−ba - b is an integer. Show that RR is an equivalence relation. Which of 0.250.25, 1.251.25, 3.253.25, 0.50.5, 2.52.5 are in the same class?
  10. How many equivalence relations on {1,2,3}\{1, 2, 3\} contain the pair (1,2)(1, 2)?

Answers

  1. Reflexive: (1,1),(2,2),(3,3)(1,1), (2,2), (3,3) are all in RR. Symmetric: (1,2)(1,2) and (2,1)(2,1) are both there. Transitive: no chain breaks the rule. So RR is reflexive, symmetric and transitive, so it is an equivalence relation.
  2. Not reflexive, because 4×4=164 \times 4 = 16 is not less than 1010, so (4,4)∉R(4, 4) \notin R. Symmetric, because a×b=b×aa \times b = b \times a. Not transitive: (4,1)∈R(4, 1) \in R and (1,6)∈R(1, 6) \in R, but (4,6)∉R(4, 6) \notin R because 24≥1024 \ge 10.
  3. Reflexive (every number divides itself) and transitive (if aa divides bb and bb divides cc, then aa divides cc). Not symmetric: (1,2)∈R(1, 2) \in R but (2,1)∉R(2, 1) \notin R.
  4. The proof is the same as Example 1, with 55 in place of 44. There are 5 classes: {−6,−1,4},  {−5,0,5},  {−4,1,6},  {−3,2},  {−2,3}\{-6, -1, 4\}, \; \{-5, 0, 5\}, \; \{-4, 1, 6\}, \; \{-3, 2\}, \; \{-2, 3\}. The class of 00 is {−5,0,5}\{-5, 0, 5\}.
  5. (a) 6464. (b) 6464. (c) 55. All three counts were found by testing every one of the 29=5122^9 = 512 relations.
  6. Symmetric only. A line is not perpendicular to itself, so it is not reflexive. If l⊥ml \perp m and m⊥nm \perp n, then ll and nn are parallel, not perpendicular, so it is not transitive.
  7. Each word has the same length as itself; "same length" can be read in either direction; and if AA and BB have the same length and BB and CC have the same length, then AA and CC do. So it is an equivalence relation. The classes are {cat,dog,sun},  {tree,bird,moon}\{\text{cat}, \text{dog}, \text{sun}\}, \; \{\text{tree}, \text{bird}, \text{moon}\}.
  8. Yes: equal squares is a form of "the same value", so all three properties hold. The classes are {−2,2},  {−1,1},  {0}\{-2, 2\}, \; \{-1, 1\}, \; \{0\}.
  9. Reflexive: a−a=0a - a = 0 is an integer. Symmetric: if a−ba - b is an integer, so is b−ab - a. Transitive: the sum of two integers (a−b)+(b−c)=a−c(a - b) + (b - c) = a - c is an integer. In the list, 0.250.25, 1.251.25 and 3.253.25 are in one class (they differ by whole numbers), and 0.50.5 and 2.52.5 are in another.
  10. 22. Either 11 and 22 form a class and 33 is alone, or all three numbers are in one class.

1.3 Types of Functions

1,211 words · 6 min read

A function ff from a set XX to a set YY is written f:X→Yf : X \to Y. The set XX is the domain (the allowed inputs). The set YY 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 f:R→Rf : \mathbb{R} \to \mathbb{R} be f(x)=x2f(x) = x^2. The domain and codomain are both R\mathbb{R}. But no square is negative, so the range is only [0,∞)[0, \infty).

Two questions decide what kind of function we have. Both are about the outputs:

  • One-one (injective): do different inputs always give different outputs? Nothing is shared.
  • Onto (surjective): is every item of the codomain actually used as an output? Nothing is left out.

In symbols, ff is one-one when f(a)=f(b)f(a) = f(b) forces a=ba = b. And ff is onto when for every yy in the codomain there is some xx in the domain with f(x)=yf(x) = y. A function that is both is called bijective: a perfect pairing of the domain with the codomain.

Let the domain be {1,2,3}\{1, 2, 3\} and the codomain {a,b,c}\{a, b, c\}.

FunctionPairsOne-one?Onto?
f1f_1{(1,a),(2,b),(3,c)}\{(1, \text{a}), (2, \text{b}), (3, \text{c})\}YesYes
f2f_2{(1,a),(2,a),(3,b)}\{(1, \text{a}), (2, \text{a}), (3, \text{b})\}NoNo

f1f_1 pairs everything perfectly, so it is bijective. In f2f_2, the inputs 11 and 22 both go to aa (not one-one), and cc is never used (not onto).

  • One-one: assume f(a)=f(b)f(a) = f(b) and show that a=ba = b. To show it is not one-one, find two different inputs with the same output.
  • Onto: take any yy in the codomain and try to solve f(x)=yf(x) = y for xx. If you always find an xx in the domain, the function is onto. To show it is not onto, find one yy that no input can reach.
  • 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 f:R→Rf : \mathbb{R} \to \mathbb{R}, f(x)=3x+2f(x) = 3x + 2 is bijective.

One-one. Suppose f(a)=f(b)f(a) = f(b). Then 3a+2=3b+23a + 2 = 3b + 2, so 3a=3b3a = 3b, so a=ba = b.

Onto. Take any real yy. Solving 3x+2=y3x + 2 = y gives x=y−23x = \frac{y - 2}{3}, which is a real number. And f ⁣(y−23)=yf\!\left(\frac{y-2}{3}\right) = y. So every yy is reached.

Is f:R→Rf : \mathbb{R} \to \mathbb{R}, f(x)=x2f(x) = x^2 one-one? Is it onto?

Not one-one: f(−2)=4f(-2) = 4 and f(2)=4f(2) = 4. Two different inputs share one output. Not onto: every square is 00 or more, so no input gives −1-1. The graph shows both problems at once.

The line y = 4 meets the parabola twice, so f is not one-one. No line below the x-axis meets it at all, so f is not onto the real numbers.

Fixing it. Whether a function is one-one or onto depends on its domain and codomain, so we can repair it. Let g:[0,∞)→[0,∞)g : [0, \infty) \to [0, \infty), g(x)=x2g(x) = x^2. Now each output y≥0y \ge 0 comes from exactly one input, x=yx = \sqrt{y}. So gg is bijective.

Common mistake: saying "x2x^2 is not onto" without naming the codomain. It is onto [0,∞)[0, \infty) and it is not onto R\mathbb{R}. Always check the codomain that was given.

The function f:R→Rf : \mathbb{R} \to \mathbb{R}, f(x)=x3f(x) = x^3 is bijective. It rises all the way along the real line, so no output repeats (one-one). And every real yy has a real cube root, so every yy is reached (onto).

Show that f:R−{3}→R−{2}f : \mathbb{R} - \{3\} \to \mathbb{R} - \{2\}, f(x)=2x+1x−3f(x) = \frac{2x + 1}{x - 3} is bijective.

One-one. Suppose f(a)=f(b)f(a) = f(b). Then 2a+1a−3=2b+1b−3\frac{2a + 1}{a - 3} = \frac{2b + 1}{b - 3}. Cross-multiply: (2a+1)(b−3)=(2b+1)(a−3)(2a + 1)(b - 3) = (2b + 1)(a - 3). Expand both sides: 2ab−6a+b−3=2ab−6b+a−32ab - 6a + b - 3 = 2ab - 6b + a - 3. Cancel 2ab2ab and −3-3: −6a+b=−6b+a-6a + b = -6b + a, so 7b=7a7b = 7a, so a=ba = b.

Onto. Let y≠2y \ne 2. Solve y=2x+1x−3y = \frac{2x + 1}{x - 3}: y(x−3)=2x+1y(x - 3) = 2x + 1, so x(y−2)=3y+1x(y - 2) = 3y + 1, so x=3y+1y−2x = \frac{3y + 1}{y - 2}. This is defined because y≠2y \ne 2. And it is never 33 (if it were, 3y+1=3y−63y + 1 = 3y - 6, which is impossible). So every y≠2y \ne 2 is reached.

The two branches of f(x) = (2x + 1) / (x − 3). The dashed lines x = 3 and y = 2 are never reached: they are the missing input and the missing output.

Let the domain have mm items and the codomain nn items. Each input can go to any of nn outputs, so there are nmn^m functions in all. For one-one functions, the first input has nn choices, the next has n−1n - 1 (it cannot repeat), and so on: n(n−1)(n−2)⋯(n−m+1)n(n - 1)(n - 2) \cdots (n - m + 1) functions. The table was found by listing every function by computer.

Domain size mmCodomain size nnAll functionsOne-oneOntoBijective
223399660000
33332727666666
335512512560600000
4422161600141400
4433818100363600
55332432430015015000
  • If m>nm > n there is no one-one function: too many inputs for too few outputs (the "pigeonhole idea").
  • If m<nm < n there is no onto function: too few inputs to reach every output.
  • A bijection needs m=nm = n. When m=nm = n, the number of bijections is n!n! (the table shows 3!=63! = 6).

Domain {1,2,3,4}\{1, 2, 3, 4\}. For each map, say if it is one-one, onto, both or neither.

  1. 1→p,  2→q,  3→r,  4→s1 \to p, \; 2 \to q, \; 3 \to r, \; 4 \to s, codomain {p,q,r,s}\{p, q, r, s\}.
  2. 1→p,  2→q,  3→r,  4→r1 \to p, \; 2 \to q, \; 3 \to r, \; 4 \to r, codomain {p,q,r}\{p, q, r\}.
  3. 1→p,  2→q,  3→r,  4→s1 \to p, \; 2 \to q, \; 3 \to r, \; 4 \to s, codomain {p,q,r,s,t}\{p, q, r, s, t\}.
  4. Every input goes to pp, codomain {p,q,r}\{p, q, r\}.

Answers

  1. It is one-one and onto (bijective).
  2. It is onto but not one-one.
  3. It is one-one but not onto.
  4. It is neither one-one nor onto.

EXERCISE 1.2

576 words · 3 min read
  1. Domain {1,2,3}\{1, 2, 3\}, codomain {x,y,z}\{x, y, z\}: 1→y,  2→z,  3→x1 \to y, \; 2 \to z, \; 3 \to x. Is it one-one? Onto? And the map from {1,2,3,4}\{1, 2, 3, 4\} to {x,y}\{x, y\} with 1→x,  2→y,  3→x,  4→y1 \to x, \; 2 \to y, \; 3 \to x, \; 4 \to y?
  2. Show that f:R→Rf : \mathbb{R} \to \mathbb{R}, f(x)=5x−7f(x) = 5x - 7 is bijective. Which input gives the output 1818?
  3. Show that f:R→Rf : \mathbb{R} \to \mathbb{R}, f(x)=∣x∣f(x) = |x| is neither one-one nor onto.
  4. Is f:R→Rf : \mathbb{R} \to \mathbb{R}, f(x)=x2+1f(x) = x^2 + 1 one-one? Onto? Change the domain and codomain to make it bijective.
  5. Show that f:R−{−2}→R−{1}f : \mathbb{R} - \{-2\} \to \mathbb{R} - \{1\}, f(x)=xx+2f(x) = \frac{x}{x + 2} is bijective.
  6. Domain with 44 items, codomain with 33 items. How many functions are there? Then find: one-one functions from 33 items to 55 items; onto functions from 44 items to 22 items; bijections from 44 items to 44 items.
  7. Is f:Z→Zf : \mathbb{Z} \to \mathbb{Z}, f(x)=2xf(x) = 2x one-one? Onto?
  8. Is f:N→Nf : \mathbb{N} \to \mathbb{N}, f(n)=n+1f(n) = n + 1 one-one? Onto? (Here N={1,2,3,… }\mathbb{N} = \{1, 2, 3, \dots\}.)
  9. A thermometer converts Celsius to Fahrenheit with F=1.8C+32F = 1.8C + 32. Show that this is a bijection from R\mathbb{R} to R\mathbb{R}. What is FF for C=37C = 37? What is CC for F=50F = 50?
  10. Give an example of (a) a one-one function from {1,2,3}\{1, 2, 3\} to {1,2,3,4}\{1, 2, 3, 4\} that is not onto, and (b) an onto function from {1,2,3,4}\{1, 2, 3, 4\} to {1,2,3}\{1, 2, 3\} that is not one-one.

Answers

  1. The first map is one-one and onto (bijective). The second map is onto but not one-one: it reaches both xx and yy, but four inputs share two outputs.
  2. If 5a−7=5b−75a - 7 = 5b - 7 then a=ba = b (one-one). For any yy, x=y+75x = \frac{y + 7}{5} gives f(x)=yf(x) = y (onto). For y=18y = 18: x=255=18x = \frac{25}{5} = 18. Check: 5(18)−7=185(18) - 7 = 18.
  3. Not one-one: f(−3)=3f(-3) = 3 and f(3)=3f(3) = 3. Not onto: ∣x∣≥0|x| \ge 0 for every xx, so −1-1 is never an output.
  4. Not one-one: f(−2)=5=f(2)f(-2) = 5 = f(2). Not onto: x2+1≥1x^2 + 1 \ge 1, so 00 is never an output. Take f:[0,∞)→[1,∞)f : [0, \infty) \to [1, \infty). Then each y≥1y \ge 1 comes from exactly one input x=y−1x = \sqrt{y - 1}, and ff is bijective.
  5. One-one: aa+2=bb+2\frac{a}{a + 2} = \frac{b}{b + 2} gives a(b+2)=b(a+2)a(b + 2) = b(a + 2), so 2a=2b2a = 2b. Onto: solving y=xx+2y = \frac{x}{x + 2} gives x=2y1−yx = \frac{2y}{1 - y}, defined for y≠1y \ne 1, and it is never −2-2 (that would need 2y=−2+2y2y = -2 + 2y).
  6. 34=813^4 = 81 functions. One-one from 33 to 55: 5×4×3=605 \times 4 \times 3 = 60. Onto from 44 to 22: 1414 (all 24=162^4 = 16 functions, minus the 22 that send everything to one item). Bijections of 44 items: 4!=244! = 24.
  7. One-one: 2a=2b2a = 2b gives a=ba = b. Not onto: 2x2x is always even, so an odd number such as 11 is never an output.
  8. One-one: a+1=b+1a + 1 = b + 1 gives a=ba = b. Not onto: the smallest output is 22, so 11 is never reached.
  9. It is a straight line with non-zero slope, so it is one-one and onto (as in Example 1). F(37)=1.8×37+32=98.6F(37) = 1.8 \times 37 + 32 = 98.6. Solving C=F−321.8C = \frac{F - 32}{1.8} gives C=181.8=10C = \frac{18}{1.8} = 10.
  10. (a) 1→1,  2→2,  3→31 \to 1, \; 2 \to 2, \; 3 \to 3: one-one, and 44 is never used. (b) 1→1,  2→2,  3→3,  4→31 \to 1, \; 2 \to 2, \; 3 \to 3, \; 4 \to 3: every output is used, but 33 and 44 share the output 33. Both were confirmed by computer.

1.4 Composition of Functions and Invertible Function

1,230 words · 6 min read

Imagine a two-step machine. The first machine ff takes a number and doubles it, then adds 11. The second machine gg 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 ff and gg.

The composition, written g∘fg \circ f (read "gg after ff") means: apply ff first, then gg. In symbols, (g∘f)(x)=g(f(x))(g \circ f)(x) = g(f(x)).

With f(x)=2x+1f(x) = 2x + 1 and g(x)=x2g(x) = x^2: (g∘f)(x)=(2x+1)2(g \circ f)(x) = (2x + 1)^2. At x=3x = 3, the first machine gives 77 and the second gives 4949. In the other order, (f∘g)(x)=2x2+1(f \circ g)(x) = 2x^2 + 1, and at x=3x = 3 it gives 1919.

Order matters. g∘fg \circ f and f∘gf \circ g are usually different functions: here 4949 and 1919. The function written closest to xx is applied first.

For g∘fg \circ f to make sense, every output of ff must be an allowed input of gg. In other words, the range of ff must fit inside the domain of gg.

Let f:{1,2,3}→{a,b,c}f : \{1, 2, 3\} \to \{a, b, c\} be f={(1,b),(2,a),(3,c)}f = \{(1, \text{b}), (2, \text{a}), (3, \text{c})\}, and g:{a,b,c}→{10,20}g : \{a, b, c\} \to \{10, 20\} be g={(a,10),(b,20),(c,10)}g = \{(\text{a}, 10), (\text{b}, 20), (\text{c}, 10)\}. Follow each input through both steps:

xxf(x)f(x)g(f(x))g(f(x))
11b\text{b}2020
22a\text{a}1010
33c\text{c}1010

So g∘f={(1,20),(2,10),(3,10)}g \circ f = \{(1, 20), (2, 10), (3, 10)\}. Notice that gg is not one-one (both aa and cc go to 1010), and neither is g∘fg \circ f.

  • Composition of one-one functions is one-one. If g(f(a))=g(f(b))g(f(a)) = g(f(b)), then gg being one-one gives f(a)=f(b)f(a) = f(b), and then ff being one-one gives a=ba = b.
  • Composition of onto functions is onto. Take any target zz. Because gg is onto, some yy has g(y)=zg(y) = z. Because ff is onto, some xx has f(x)=yf(x) = y. Then g(f(x))=zg(f(x)) = z.
  • So the composition of two bijections is a bijection. This was checked on the pair of functions f={(1,b),(2,a),(3,c)}f = \{(1, b), (2, a), (3, c)\} and g={(a,10),(b,20),(c,30)}g = \{(a, 10), (b, 20), (c, 30)\}, giving g∘f={(1,20),(2,10),(3,30)}g \circ f = \{(1, 20), (2, 10), (3, 30)\}.

Composition also has a tidy property: it is associative. (h∘g)∘f=h∘(g∘f)(h \circ g) \circ f = h \circ (g \circ f). With f(x)=x+1f(x) = x + 1, g(x)=2xg(x) = 2x, h(x)=x2h(x) = x^2, both ways give (2(x+1))2(2(x + 1))^2, which equals 6464 at x=3x = 3. So we can write h∘g∘fh \circ g \circ f with no brackets.

Some functions can be undone. If ff turns 33 into 77 by "double and add 11", the undo machine turns 77 back into 33 by "subtract 11 and halve". We say gg is the inverse of ff when doing one and then the other gets you back where you started, in both orders:

  • g(f(x))=xg(f(x)) = x for every xx in the domain of ff (do ff, then undo it);
  • f(g(y))=yf(g(y)) = y for every yy in the domain of gg (undo, then do ff).

We write the inverse as f−1f^{-1}. A function that has an inverse is called invertible.

Which functions can be undone? Exactly the bijective ones. If two inputs share an output (not one-one), the undo machine would not know which input to return. If some output has no input (not onto), the undo machine would have nothing to do for it. A bijection pairs everything perfectly, so reversing the pairs gives a function.

  1. Check that the function is a bijection between the given domain and codomain.
  2. Write y=f(x)y = f(x).
  3. Solve this equation for xx, so that xx is written using yy.
  4. Rename: the result is f−1(y)f^{-1}(y). You may then call the variable xx again.
  5. State the domain and range of f−1f^{-1}. They are the range and domain of ff, swapped.

Find the inverse of f(x)=4x−7f(x) = 4x - 7 on R\mathbb{R}. Write y=4x−7y = 4x - 7. Then 4x=y+74x = y + 7, so x=y+74x = \frac{y + 7}{4}. Hence f−1(y)=y+74f^{-1}(y) = \frac{y + 7}{4}.

For f={(1,b),(2,a),(3,c)}f = \{(1, \text{b}), (2, \text{a}), (3, \text{c})\}, swapping each pair gives f−1={(a,2),(b,1),(c,3)}f^{-1} = \{(\text{a}, 2), (\text{b}, 1), (\text{c}, 3)\}.

In Example 4 of Section 1.3, solving y=2x+1x−3y = \frac{2x + 1}{x - 3} gave x=3y+1y−2x = \frac{3y + 1}{y - 2}. So the inverse of f:R−{3}→R−{2}f : \mathbb{R} - \{3\} \to \mathbb{R} - \{2\} is f−1:R−{2}→R−{3}f^{-1} : \mathbb{R} - \{2\} \to \mathbb{R} - \{3\}, f−1(y)=3y+1y−2f^{-1}(y) = \frac{3y + 1}{y - 2}. Notice how the missing input 33 and the missing output 22 trade places.

The function f:[0,∞)→[2,∞)f : [0, \infty) \to [2, \infty), f(x)=x2+2f(x) = x^2 + 2 is a bijection. Solving y=x2+2y = x^2 + 2 with x≥0x \ge 0 gives x=y−2x = \sqrt{y - 2}. So f−1(y)=y−2f^{-1}(y) = \sqrt{y - 2}. For instance f(3)=11f(3) = 11 and f−1(11)=3f^{-1}(11) = 3.

The graph of an inverse is the mirror image of the original in the line y = x. The point (3, 11) on f becomes (11, 3) on its inverse.

To undo "put on socks, then put on shoes" you must take off the shoes first, then the socks. In symbols, if ff and gg are invertible,

(g∘f)−1=f−1∘g−1(g \circ f)^{-1} = f^{-1} \circ g^{-1}

Check with f(x)=2x+1f(x) = 2x + 1 and g(x)=3x−5g(x) = 3x - 5. Then (g∘f)(x)=3(2x+1)−5=6x−2(g \circ f)(x) = 3(2x + 1) - 5 = 6x - 2, whose inverse is x+26\frac{x + 2}{6}. On the other side, f−1(x)=x−12f^{-1}(x) = \frac{x - 1}{2} and g−1(x)=x+53g^{-1}(x) = \frac{x + 5}{3}, so f−1(g−1(x))=x+53−12=x+26f^{-1}(g^{-1}(x)) = \frac{\frac{x + 5}{3} - 1}{2} = \frac{x + 2}{6}. They agree. In the wrong order, g−1(f−1(x))=x+96g^{-1}(f^{-1}(x)) = \frac{x + 9}{6}, which is different.

Common mistake: reading f−1f^{-1} as 1f\frac{1}{f}. For f(x)=2xf(x) = 2x, the inverse is f−1(x)=x2f^{-1}(x) = \frac{x}{2}, but 1f(x)=12x\frac{1}{f(x)} = \frac{1}{2x}. At x=4x = 4 these are 22 and 18\frac{1}{8}. The small −1-1 means "undo", not "reciprocal".

  1. Let f(x)=3x+1f(x) = 3x + 1 and g(x)=x2g(x) = x^2. Find (g∘f)(2)(g \circ f)(2) and (f∘g)(2)(f \circ g)(2).
  2. Find the inverse of f(x)=x−45f(x) = \frac{x - 4}{5}.
  3. Is f={(1,q),(2,q),(3,r)}f = \{(1, \text{q}), (2, \text{q}), (3, \text{r})\}, from {1,2,3}\{1, 2, 3\} to {p,q,r}\{p, q, r\}, invertible?
  4. Find the inverse of f(x)=x3+1f(x) = x^3 + 1 on R\mathbb{R}.

Answers

  1. (g∘f)(2)=g(7)=49(g \circ f)(2) = g(7) = 49 and (f∘g)(2)=f(4)=13(f \circ g)(2) = f(4) = 13.
  2. y=x−45y = \frac{x - 4}{5} gives x=5y+4x = 5y + 4, so f−1(y)=5y+4f^{-1}(y) = 5y + 4.
  3. No. It is not one-one (11 and 22 both go to qq), and it is not onto (pp is never used).
  4. y=x3+1y = x^3 + 1 gives x=y−13x = \sqrt[3]{y - 1}, so f−1(y)=y−13f^{-1}(y) = \sqrt[3]{y - 1}.

Miscellaneous Examples

584 words · 3 min read

Take the ordered pairs (a,b)(a, b) with a,b∈{1,2,3,4}a, b \in \{1, 2, 3, 4\}. Say (a,b)∼(c,d)(a, b) \sim (c, d) when a×d=b×ca \times d = b \times c. Show that this is an equivalence relation and describe the classes.

Reflexive: ab=baa b = b a. Symmetric: if ad=bca d = b c then cb=dac b = d a. Transitive: if ad=bca d = b c and cf=dec f = d e, multiply the first by ff and the second by bb and compare: adf=bcf=bdea d f = b c f = b d e, and cancelling dd gives af=bea f = b e. The computer also checked all 256256 pairs of pairs.

The rule says "ab\frac{a}{b} and cd\frac{c}{d} are equal fractions". The 1616 pairs fall into 11 classes, one for each different fraction. The class of (1,2)(1, 2) is {(1,2),(2,4)}\{(1, 2), (2, 4)\}, because 12=24\frac{1}{2} = \frac{2}{4}. The class of (1,1)(1, 1) has 4 pairs: 11=22=33=44\frac{1}{1} = \frac{2}{2} = \frac{3}{3} = \frac{4}{4}. So a fraction is an equivalence class of pairs.

How many onto functions are there from {1,2,3,4}\{1, 2, 3, 4\} to {a,b,c}\{a, b, c\}?

Start with all functions: 34=813^4 = 81. Remove those that miss at least one output. There are 33 ways to miss one chosen output, each leaving 24=162^4 = 16 functions, so subtract 3×16=483 \times 16 = 48. But functions that miss two outputs (everything goes to one item) were subtracted twice. There are 33 of them, so add back 33. Total: 81−48+3=3681 - 48 + 3 = 36. Listing every function by computer also gives 36.

Show that f:R→(−1,1)f : \mathbb{R} \to (-1, 1), f(x)=x1+x2f(x) = \frac{x}{\sqrt{1 + x^2}} is a bijection and find its inverse.

Inside the interval. Since ∣x∣<1+x2|x| < \sqrt{1 + x^2}, we have ∣f(x)∣<1|f(x)| < 1.

One-one. If f(a)=f(b)f(a) = f(b), then aa and bb have the same sign (or both are 00). Squaring both sides, a2(1+b2)=b2(1+a2)a^2 (1 + b^2) = b^2 (1 + a^2), so a2=b2a^2 = b^2. With the same sign, a=ba = b.

Onto. For y∈(−1,1)y \in (-1, 1), put x=y1−y2x = \frac{y}{\sqrt{1 - y^2}}. Then 1+x2=11−y21 + x^2 = \frac{1}{1 - y^2}, so 1+x2=11−y2\sqrt{1 + x^2} = \frac{1}{\sqrt{1 - y^2}} and f(x)=yf(x) = y. This formula is also the inverse: f−1(y)=y1−y2f^{-1}(y) = \frac{y}{\sqrt{1 - y^2}}.

Let f(x)=x+1x−1f(x) = \frac{x + 1}{x - 1} for x≠1x \ne 1. Show that f∘ff \circ f is the identity, so f−1=ff^{-1} = f.

f(f(x))=x+1x−1+1x+1x−1−1=2xx−12x−1=xf(f(x)) = \dfrac{\frac{x + 1}{x - 1} + 1}{\frac{x + 1}{x - 1} - 1} = \dfrac{\frac{2x}{x - 1}}{\frac{2}{x - 1}} = x. For example f(2)=3f(2) = 3 and f(3)=2f(3) = 2: the function swaps 22 and 33.

How many relations on {1,2,3}\{1, 2, 3\} contain (1,2)(1, 2) and (2,1)(2, 1), are reflexive and symmetric, but are not transitive?

Reflexive and symmetric relations containing (1,2)(1, 2) and (2,1)(2, 1) have the three pairs (a,a)(a, a) and the pair (1,2),(2,1)(1,2),(2,1). The only free choices are the pair {1,3}\{1, 3\} (both (1,3)(1,3) and (3,1)(3,1), or neither) and the pair {2,3}\{2, 3\}. That is 2×2=42 \times 2 = 4 relations. Two of them are equivalence relations: add neither of the links, or add both. If we add exactly one link (say 1↔31 \leftrightarrow 3 but not 2↔32 \leftrightarrow 3), transitivity breaks: (2,1)(2, 1) and (1,3)(1, 3) are there but (2,3)(2, 3) is missing. So the answer is 2.

*Miscellaneous Exercise on Chapter 1*

527 words · 2 min read
  1. Show that f:R→Rf : \mathbb{R} \to \mathbb{R}, f(x)=x3+5f(x) = x^3 + 5 is a bijection and find f−1f^{-1}.
  2. On the nine ordered pairs (a,b)(a, b) with a,b∈{1,2,3}a, b \in \{1, 2, 3\}, let (a,b)∼(c,d)(a, b) \sim (c, d) when a+d=b+ca + d = b + c. Show that ∼\sim is an equivalence relation. How many classes are there, and what is the class of (1,2)(1, 2)?
  3. Let f(x)=2x+1f(x) = 2x + 1 and g(x)=x2−3g(x) = x^2 - 3. Find g∘fg \circ f and f∘gf \circ g and evaluate both at x=2x = 2.
  4. How many functions from {1,2,3}\{1, 2, 3\} to itself are neither one-one nor onto?
  5. Show that f:R→Rf : \mathbb{R} \to \mathbb{R}, f(x)=∣x∣+xf(x) = |x| + x is neither one-one nor onto.
  6. On {0,1,2,…,12}\{0, 1, 2, \dots, 12\}, let a R ba \, R \, b when a−ba - b is a multiple of 33 or a multiple of 44. Is RR an equivalence relation?
  7. Show that f:R−{1}→R−{3}f : \mathbb{R} - \{1\} \to \mathbb{R} - \{3\}, f(x)=3x+2x−1f(x) = \frac{3x + 2}{x - 1} is a bijection and find its inverse.
  8. The function c(K)=K−273.15c(K) = K - 273.15 converts a temperature from kelvin to Celsius, and f(C)=1.8C+32f(C) = 1.8C + 32 converts Celsius to Fahrenheit. Find the composite that converts kelvin to Fahrenheit, its inverse, and the Fahrenheit value of 300300 K.

Answers

  1. If a3+5=b3+5a^3 + 5 = b^3 + 5 then a3=b3a^3 = b^3, so a=ba = b (one-one). For any yy, x=y−53x = \sqrt[3]{y - 5} gives f(x)=yf(x) = y (onto). So f−1(y)=y−53f^{-1}(y) = \sqrt[3]{y - 5}.
  2. The rule says b−a=d−cb - a = d - c: the two pairs have the same "step" from the first number to the second. Same step is an equivalence relation. The steps are −2,−1,0,1,2-2, -1, 0, 1, 2, so there are 5 classes. The class of (1,2)(1, 2) is {(1,2),(2,3)}\{(1, 2), (2, 3)\}.
  3. (g∘f)(x)=(2x+1)2−3=4x2+4x−2(g \circ f)(x) = (2x + 1)^2 - 3 = 4x^2 + 4x - 2, and (g∘f)(2)=22(g \circ f)(2) = 22. (f∘g)(x)=2(x2−3)+1=2x2−5(f \circ g)(x) = 2(x^2 - 3) + 1 = 2x^2 - 5, and (f∘g)(2)=3(f \circ g)(2) = 3.
  4. There are 33=273^3 = 27 functions. For a finite set mapped to itself, one-one and onto go together, so the 6 bijections are the ones that are both. The rest, 27 − 6 = 21, are neither.
  5. Not one-one: f(−1)=0f(-1) = 0 and f(−2)=0f(-2) = 0 (every negative number goes to 00). Not onto: ∣x∣+x≥0|x| + x \ge 0 always, so −1-1 is never an output.
  6. It is reflexive and symmetric, but not transitive. 0 R 30 \, R \, 3 (difference 33) and 3 R 73 \, R \, 7 (difference 44), yet 00 and 77 differ by 77, which is neither. So it is not an equivalence relation.
  7. Solving y=3x+2x−1y = \frac{3x + 2}{x - 1} gives y(x−1)=3x+2y(x - 1) = 3x + 2, so x(y−3)=y+2x(y - 3) = y + 2 and x=y+2y−3x = \frac{y + 2}{y - 3}. This is defined for every y≠3y \ne 3 and never equals 11, so ff is onto. If f(a)=f(b)f(a) = f(b), cross-multiplying gives 5b=5a5b = 5a, so ff is one-one. Hence f−1(y)=y+2y−3f^{-1}(y) = \frac{y + 2}{y - 3}.
  8. (f∘c)(K)=1.8(K−273.15)+32=1.8K−459.67(f \circ c)(K) = 1.8(K - 273.15) + 32 = 1.8K - 459.67. Its inverse is F↦F+459.671.8F \mapsto \frac{F + 459.67}{1.8}. At K=300K = 300: 1.8×300−459.67=80.331.8 \times 300 - 459.67 = 80.33 °F.

Summary

216 words · 1 min read
  • Relation: a subset of A×BA \times B. A relation in a set XX is a subset of X×XX \times X.
  • Empty relation: no pairs. Universal relation: all pairs.
  • Reflexive: (a,a)∈R(a, a) \in R for every aa. Symmetric: (a,b)∈R(a, b) \in R implies (b,a)∈R(b, a) \in R. Transitive: (a,b)(a, b) and (b,c)(b, c) in RR imply (a,c)∈R(a, c) \in R.
  • Equivalence relation: reflexive, symmetric and transitive. It splits the set into equivalence classes that do not overlap.
  • Function f:X→Yf : X \to Y: every input has exactly one output. Domain = inputs, codomain = allowed outputs, range = outputs that really happen.
  • One-one: f(a)=f(b)f(a) = f(b) implies a=ba = b. Onto: every item of the codomain is an output. Bijective: both.
  • Counting from an mm-set to an nn-set: nmn^m functions; n(n−1)⋯(n−m+1)n(n - 1) \cdots (n - m + 1) one-one; bijections only if m=nm = n, and then there are n!n!.
  • Composition: (g∘f)(x)=g(f(x))(g \circ f)(x) = g(f(x)). Apply ff first. It is associative but usually not commutative. Composition of one-one (onto) functions is one-one (onto).
  • Invertible: ff has an inverse exactly when it is a bijection. Then f−1(f(x))=xf^{-1}(f(x)) = x and f(f−1(y))=yf(f^{-1}(y)) = y. The graph of f−1f^{-1} is the mirror image of the graph of ff in the line y=xy = x.
  • Inverse of a composition: (g∘f)−1=f−1∘g−1(g \circ f)^{-1} = f^{-1} \circ g^{-1}. Undo in the reverse order.

*Historical Note*

240 words · 1 min read

The idea of a function grew slowly over about three hundred years. Each step made it wider than the one before.

  • 1637: René Descartes used the word "function" for powers of a variable, such as x2x^2 and x3x^3, 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 xx".
  • 1718: Johann Bernoulli (1667–1748) wrote ϕx\phi x for a function of xx.
  • 1734: Leonhard Euler (1707–1783) made letters such as ff, FF, ϕ\phi and ψ\psi the normal way to name functions. The form f(x)f(x) 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 yy for each xx. 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.

Up next
Continue to the next chapter