Lecture 19 — Functions: One-to-One, Onto, Inverse
Pre-work: Video 025 (One-to-one, onto, and inverse functions). The reference notes are one-to-one-and-onto-functions for the two properties and their proof templates, and inverse-functions for bijections, inverses, and the two meanings of \(f^{-1}\); the definition of a function itself is in functions-on-general-sets.
Date. The published schedule puts Lecture 19 on Tuesday 08/09, but the course has been running one lecture ahead of it since Lecture 15 (see the note under math1061), which makes this the Monday 07/09 lecture and 2026-09-08-composition-of-functions the Tuesday. Confirm against Blackboard.
Learning goals
- Understanding what a function is, and associated concepts and definitions.
- How to show functions are one-to-one (injective), onto (surjective), bijective.
The picture throughout is \(f : X \to Y\) as two ellipses: \(X\) is the domain, \(Y\) is the co-domain, and an arrow \(f\) takes \(x\) in \(X\) to \(f(x)\) in \(Y\). An arrow back from \(f(x)\) to \(x\) would be \(f^{-1}\). The whole topic is when that arrow back is allowed to exist.
The co-domain is part of the function
Defining the co-domain differently can make a function onto.
\[f : \mathbb{R} \to \mathbb{R}, \; f(x) = x^2 \text{ is not onto} \qquad\qquad g : \mathbb{R} \to \mathbb{R}^{\geq 0}, \; g(x) = x^2 \text{ is onto.}\]
The parabola never reaches the negative half of the \(y\)-axis, so as a function to \(\mathbb{R}\) those values are missed. Same rule, same domain, same pairs — only the declared co-domain differs, and onto is a statement about the declared co-domain (functions-on-general-sets). Shrink the co-domain to the range and every function becomes onto; that is what \(g\) does.
Figure 1: The parabola \(x^2\), with the negative \(y\)-axis marked missed in orange. As a function to \(\mathbb{R}\) every negative value is missed, so \(f\) is not onto; declare the co-domain to be \(\mathbb{R}^{\geq 0}\) and nothing is missed, so \(g\) is onto. Same rule, same graph.
\(f\) and \(g\) are different functions under the course’s definition, even though they contain exactly the same ordered pairs, because a function is written \(f : X \to Y\) and \(Y\) is part of the declaration.
The inverse function of \(f\) does not have the same domain and co-domain as \(f\).
\[f : X \to Y \quad\text{then}\quad f^{-1} : Y \to X.\]
They are swapped. The inverse goes the other way, so its domain is \(f\)’s co-domain and its co-domain is \(f\)’s domain.
Definition of a function
\(f : X \to Y\) is \(f \subseteq X \times Y\) such that for each \(x \in X\), there is a unique \(y \in Y\) such that \((x,y) \in f\).
The unique \(y\) is written \(f(x) = y\). There are three things to check: \(x \in X\), \(y \in Y\), and \(\forall x \in X\), \(f(x)\) is unique. A fan-out fails the definition: one dot in \(X\) with three arrows leaving it is not a function.
Which of the following are functions? The verdicts, each with the reason:
| Verdict | Why | ||
|---|---|---|---|
| 1 | \(f : \mathbb{R} \to \mathbb{R}\), \(f(x) = x^2\) | Function | |
| 2 | \(f : \mathbb{Z}^{+} \to \mathbb{Z}^{+}\), \(f(n) = n!\) | Function | \(n! = n(n-1)\cdots 3 \cdot 2 \cdot 1 \in \mathbb{Z}^{+}\) |
| 3 | \(f : \mathbb{Z}^{+} \to \mathbb{Z}^{+}\), \(f(n) = \dfrac{(n+1)(n+3)}{3}\) | Not a function | \(\dfrac{(n+1)(n+3)}{3}\) might not be in the co-domain \(\mathbb{Z}^{+}\) — e.g. \(n = 1\) gives \(\frac{8}{3}\) |
| 4 | \(f : \mathbb{R} \to \mathbb{R}\), \(f(x) = 1\) | Function | \(\{(x,1) : x \in \mathbb{R}\}\) — constant is fine |
| 5 | \(f : \mathbb{Q} \to \mathbb{Z}\), \(f\!\left(\frac{m}{n}\right) = m\) for all \(m, n \in \mathbb{Z}\), \(n \neq 0\) | Not a function | \(f\!\left(\frac{1}{2}\right) = 1\) but \(f\!\left(\frac{2}{4}\right) = 2\), and \(\frac{1}{2} = \frac{2}{4}\) — one input, two values |
| 6 | \(f : \mathbb{R} \to \mathbb{R}\), \(f = \{(x,y) : 3y + 7 = x\}\) | Function | \(y = \dfrac{x - 7}{3}\) |
| 7 | \(f : \mathbb{R} \to \mathbb{R}\), \(f = \{(x,y) : y^2 = x\}\) | Not a function | e.g. \((4,2), (4,-2) \in f\) — a sideways parabola, which a vertical line meets twice |
| 8 | \(f : \mathbb{R} \to \mathbb{R}\), \(f = \{(x,y) : x = \lvert y \rvert\}\) | Not a function | e.g. \((1,1), (1,-1) \in f\) — a sideways V, same test |
Each failure breaks one of two clauses. 3 lands outside the co-domain (the \(y \in Y\) clause). 5, 7 and 8 give one input two values (unique) — and 5 is the subtle one, because it looks like a rule until you remember that a rational number has many names. A rule that depends on how the input is written rather than on what the input is is not well defined, which is the standard name for exactly this failure.
7 and 8 are the vertical line test from functions-on-general-sets, run on curves that are not graphs of \(y\) against \(x\) — the two red curves in Figure 2.
Figure 2: Items 7 and 8. \(y^2 = x\) is a parabola opening to the right; \(x = |y|\) is a V opening to the right. The dashed vertical line meets each curve twice — at \((4,2)\) and \((4,-2)\), at \((1,1)\) and \((1,-1)\) — and each pair of points is the witness that the set of pairs is not a function.
Injective and surjective
Let \(f\) be a function, \(f : X \to Y\).
Injective function (one-to-one function): \(\forall x_1, x_2 \in X\), if \(f(x_1) = f(x_2)\) then \(x_1 = x_2\).
Surjective function (onto function): \(\forall y \in Y\), \(\exists x \in X\) such that \(f(x) = y\).
One-to-one is also written one-one. The two failures are drawn in Figure 3:
- not one-to-one — \(x_1\) and \(x_2\) in \(X\), both arrows landing on the same dot \(f(x_1) = f(x_2)\) in \(Y\).
- not onto — the whole domain pours into the range, an inner ellipse of \(Y\), and one dot in \(Y\) lies outside it: range \(\subset\) co-domain.
Figure 3: The two ways a function can fall short. Left: not one-to-one, two different inputs sharing one output; the blue rings mark the two sources and the one target. Right: not onto, the whole domain funnelled into a range (hatched in blue) that is a proper subset of the co-domain; the dot outside the hatching is a y that no x reaches. Domain on the left, co-domain on the right, names above.
Two examples on the plane, graphed in Figure 4:
\[f : \mathbb{R} \to \mathbb{R}, \; f(x) = x^3 - x \text{ is surjective but not injective.}\] \[f : \mathbb{R} \to \mathbb{R}, \; f(x) = 2^x \text{ is injective but not surjective.}\]
Figure 4: The two graphed examples. The cubic \(x^3 - x\) takes every real value, so it is onto, but takes the value 0 three times (and every value in its middle band three times), so it is not one-to-one; the dashed horizontal line is the horizontal line test. The exponential \(2^x\) never repeats a value, so it is one-to-one, but never reaches 0 or anything below it, so as a function to \(\mathbb{R}\) it is not onto.
The two properties are independent: Figure 4 has one of each, and the constant function \(f(x) = 1\) above has neither.
How to show it
There are four templates, two for showing a property and two for showing its failure:
| To show \(f : X \to Y\) is … | Do |
|---|---|
| one-to-one | suppose that \(f(x_1) = f(x_2)\) and show that \(x_1 = x_2\) |
| not one-to-one | find elements \(x_1, x_2 \in X\) such that \(f(x_1) = f(x_2)\) and \(x_1 \neq x_2\) |
| onto | suppose that \(y \in Y\) and find an \(x \in X\) such that \(f(x) = y\) |
| not onto | find an element \(y \in Y\) such that for all \(x \in X\), \(f(x) \neq y\) |
The pattern is the same one as for sets (2026-09-03-set-properties-and-functions): a universal claim (is one-to-one, is onto) needs a general argument from an arbitrary element, and its negation needs one witness. Which is why the two “not” rows are so much shorter to do — and why a proof of one-to-one that checks a few values proves nothing.
Worked: a bijection onto the odd integers
Consider the function \(g : \mathbb{Z} \to \mathbb{Z}^{\text{odd}}\) defined by \(g(x) = 2x + 3\). (a) Is \(g\) an injective function? (b) Is \(g\) a surjective function?
Yes and Yes. That is the intuition; the proofs follow.
(a) Proof. Let \(x_1, x_2 \in \mathbb{Z}\) such that \(g(x_1) = g(x_2)\). Hence \[2x_1 + 3 = 2x_2 + 3, \qquad 2x_1 = 2x_2, \qquad x_1 = x_2.\] \(\therefore g\) is one-to-one. \(\square\)
(b) Proof. Let \(y \in \mathbb{Z}^{\text{odd}}\). Take \(x = \dfrac{y - 3}{2}\). Since \(y\) is odd, \(y - 3\) is even, so \(\dfrac{y-3}{2} \in \mathbb{Z}\). And \[g\!\left(\frac{y-3}{2}\right) = 2\left(\frac{y-3}{2}\right) + 3 = (y - 3) + 3 = y,\] so \(\forall y \in \mathbb{Z}^{\text{odd}}\), \(\exists x \in \mathbb{Z}\) s.t. \(g(x) = y\). \(\therefore g\) onto. \(\square\)
The thinking behind (b) is not part of the proof: want to find \(x \in \mathbb{Z}\) such that \(g(x) = y\); \(2x + 3 = y\); \(x = \frac{y-3}{2}\). That is scratch work — solving for \(x\) backwards — and the proof then runs it forwards: name the candidate, check it is in the domain, check \(g\) sends it to \(y\). The “check it is in the domain” line is the one that gets skipped: it is exactly where the oddness of \(y\) is used, and without it the argument would “prove” \(g : \mathbb{Z} \to \mathbb{Z}\) onto, which is false.
Worked: a function on pairs
Define a function \(f : \mathbb{R} \times \mathbb{R} \to \mathbb{R} \times \mathbb{R}\) by \(f((x,y)) = (y + 1, 2x)\). For example, \(f((0,0)) = (1,0)\) and \(f((-2,3)) = (4,-4)\).
In the example \(f((0,0)) = (1,0)\), the input’s second entry \(y\) feeds the first entry of the output, and the input’s first entry \(x\) feeds the second. The inputs and outputs are pairs, and the coordinates cross over.
(a) Prove that \(f\) is one-to-one. Suppose \((x_1,y_1), (x_2,y_2) \in \mathbb{R} \times \mathbb{R}\) and \(f((x_1,y_1)) = f((x_2,y_2))\). Then \((y_1 + 1, 2x_1) = (y_2 + 1, 2x_2)\). So \[y_1 + 1 = y_2 + 1 \;\text{ and }\; 2x_1 = 2x_2, \qquad y_1 = y_2 \;\text{ and }\; x_1 = x_2.\] So \((x_1,y_1) = (x_2,y_2)\). \(\square\)
The first entries give one equation, the second entries give another, and the and between them matters. Two ordered pairs are equal exactly when both coordinates agree, so one equation of pairs is two equations of numbers, and both are needed.
(b) Prove that \(f\) is onto. Suppose \((a,b) \in \mathbb{R} \times \mathbb{R}\) (co-domain). Take \(\left(\frac{b}{2}, a - 1\right) \in \mathbb{R} \times \mathbb{R}\) (domain), and \[f\!\left(\left(\tfrac{b}{2}, a - 1\right)\right) = \left((a-1) + 1, \; 2\left(\tfrac{b}{2}\right)\right) = (a,b).\] \(\therefore f\) is onto. \(\square\)
The scratch work behind the candidate: want \(f((x,y)) = (a,b)\); \((y+1, 2x) = (a,b)\); \(y + 1 = a\) and \(2x = b\); \(y = a - 1\), \(x = \frac{b}{2}\). Same method as for \(g\) above, one coordinate at a time. Here the domain check is trivial — \(\frac{b}{2}\) and \(a - 1\) are real whenever \(a\) and \(b\) are — which is why it is written as a bare (domain) label rather than argued.
This function returns in 2026-09-08-composition-of-functions, where its inverse is computed from exactly this working.
Inverse functions
A function that is both one-to-one and onto is said to be a bijection.
A bijection \(f : X \to Y\) has an inverse function \(f^{-1} : Y \to X\).
\(f : X \to Y\) takes \(x_1 \mapsto f(x_1)\) and \(x_2 \mapsto f(x_2)\), and \(f^{-1} : Y \to X\) runs the other way.
The two failure cases are drawn in Figure 5:
- not one-to-one \(\Rightarrow\) no inverse (green) — two dots of \(X\) going to one dot of \(Y\); the orange arrow back from that dot is marked ?, because it would have to go to two places.
- not onto \(\Rightarrow\) no inverse (purple) — a dot of \(Y\) outside the range; the arrow back from it is marked ?, because there is nowhere for it to go.
Figure 5: Why an inverse needs both properties. Left (green): if \(f\) is not one-to-one, the arrow back from a shared output has two candidates and cannot be a function. Right (purple): if \(f\) is not onto, the arrow back from an unreached \(y\) has no candidate at all. An inverse function has to send every \(y \in Y\) to exactly one \(x\) — onto supplies the every, one-to-one supplies the exactly one.
Q2 from the pre-class questions
Let \(f : X \to Y\) be a bijective function. Which one of the following is true?
| Why | |||
|---|---|---|---|
| a) | The inverse function of \(f\) does not exist. | ✗ | a bijection is exactly the case where the inverse does exist |
| b) | For all \(y \in Y\), \(f^{-1}(y) = x\) where \(x\) is the unique element in \(X\) such that \(f(x) = y\). | ✓ | \(x\) exists since \(f\) is onto; it is unique since \(f\) is one-to-one |
| c) | \(f^{-1}\) is a function from \(X\) to \(Y\). | ✗ | the inverse runs \(Y \to X\) |
| d) | \(X\) and \(Y\) are finite. | ✗ | nothing about bijections needs finiteness — \(g(x) = 2x + 3\) above is a bijection between infinite sets |
Option b) is the definition of \(f^{-1}\), and its two reasons are the whole topic in one sentence: onto gives existence, one-to-one gives uniqueness.
The notation \(f^{-1}\) is used in two different ways
This distinction is important.
1. If \(f : X \to Y\) is any function and \(A\) is any subset of \(Y\), then the inverse image or preimage \(f^{-1}(A)\) of \(A\) is defined by \[f^{-1}(A) = \{x \in X : f(x) \in A\}.\] Notice that the preimage function \(f^{-1}\) is a function \(f^{-1} : \mathcal{P}(Y) \to \mathcal{P}(X)\).
2. If \(f : X \to Y\) is any bijective function then the inverse function of \(f\) is the function \(f^{-1} : Y \to X\) where for all \(y \in Y\) \[f^{-1}(y) = x \text{ where } x \text{ is the unique } x \in X \text{ such that } f(x) = y.\] Notice that the inverse function \(f^{-1}\) is a function \(f^{-1} : Y \to X\).
Both are drawn in inverse-functions. In the first, \(f\) is many-to-one and a blob \(f^{-1}(A)\) in \(X\) collects everything that lands in the blob \(A\) in \(Y\). In the second, \(f\) is bijective (one-to-one and onto) and a single arrow \(f^{-1}\) runs back from \(y\) to \(x\).
The difference is in what goes in and what comes out:
| Input | Output | Exists for | |
|---|---|---|---|
| preimage \(f^{-1}(A)\) | a subset of \(Y\) | a subset of \(X\) | every function |
| inverse function \(f^{-1}(y)\) | an element of \(Y\) | an element of \(X\) | bijections only |
Preimages are defined in functions-on-general-sets and nothing about them has changed; what is new is that the same symbol now also has a second, much more restricted meaning, and the braces are what tell you which one is meant.
Worked: preimage or inverse function?
Let \(f : \{1,2,3,4\} \to \{a,b,c\}\) be the function \(f = \{(1,a), (2,a), (3,b), (4,b)\}\). For each of the following statements about the function \(f\), decide whether the statement is true or false.
The arrow diagram is Figure 6: \(1, 2 \to a\); \(3, 4 \to b\); \(c\) untouched.
| Statement | Why | ||
|---|---|---|---|
| (1) | The inverse function \(f^{-1}\) of \(f\) does not exist. | T | since \(f\) is not a bijection |
| (2) | The preimage of the set \(\{a\}\) is \(f^{-1}(\{a\}) = \{1,2\}\). | T | \(\{a\}\) is a subset of the co-domain; 1 and 2 map to \(a\) (no others map to \(a\)) |
| (3) | \(f^{-1}(a)\) is not defined. | T | \(a\) is an element of the co-domain; here the \(f^{-1}\) notation represents the inverse function, which is not defined for this \(f\) |
| (4) | \(f^{-1}(\{c\}) = \emptyset\). | T | \(\{c\}\) is a subset of the co-domain; the pre-image of \(\{c\}\) is \(\emptyset\) since no element maps to \(c\) |
Figure 6: The function \(f\) as an arrow diagram. It is neither one-to-one (1 and 2 share \(a\), 3 and 4 share \(b\)) nor onto (\(c\) is never reached), so there is no inverse function and \(f^{-1}(a)\) means nothing. But preimages exist for every function: \(f^{-1}({a})\) collects 1 and 2 (green), and \(f^{-1}({c})\) collects nothing (purple, empty).
All four are true, and (2)–(4) are the same lesson three times: read the braces. \(\{a\}\) and \(\{c\}\) are sets, so \(f^{-1}\) means preimage and the answer is a set — possibly empty, which is an answer and not an error. \(a\) alone is an element, so \(f^{-1}\) would have to mean the inverse function, which this \(f\) does not have.
See also
- one-to-one-and-onto-functions — the two definitions, the four proof templates, and more worked examples
- inverse-functions — bijections, the inverse function, and the two meanings of \(f^{-1}\)
- functions-on-general-sets — the definition of a function, co-domain versus range, image and preimage
- 2026-09-03-set-properties-and-functions — Lecture 18 · 2026-09-08-composition-of-functions — Lecture 20
- practice-problems — §25, with full worked solutions