Some functions lose information (two inputs give the same output), and some miss part of their codomain. Functions that do neither can be “undone”: they have inverses. Encryption and decryption, compression and decompression, and ID numbers all depend on these ideas.
Definition 1.26 · Injective, surjective, bijective
A function f : A → B f: A \to B f : A → B is
injective (one-one) if different inputs give different outputs: f ( x 1 ) = f ( x 2 ) ⇒ x 1 = x 2 f(x_1) = f(x_2) \Rightarrow x_1 = x_2 f ( x 1 ) = f ( x 2 ) ⇒ x 1 = x 2 ;
surjective (onto) if every element of B B B is an output: for every b ∈ B b \in B b ∈ B there is a ∈ A a \in A a ∈ A with f ( a ) = b f(a) = b f ( a ) = b , i.e. f ( A ) = B f(A) = B f ( A ) = B ;
bijective (one-one onto) if it is both injective and surjective.
Intuition
Think of students and chairs in an exam hall. One-one: no two students share a chair. Onto: no chair is left empty. Bijective: every chair has exactly one student — so you can also go backwards from a chair to “its” student.
Function One-one? Onto? f : Z → Z f: \mathbb{Z} \to \mathbb{Z} f : Z → Z , f ( x ) = x + 1 f(x) = x + 1 f ( x ) = x + 1 yes yes (pre-image of y y y is y − 1 y - 1 y − 1 ) f : R → R f: \mathbb{R} \to \mathbb{R} f : R → R , f ( x ) = 2 x + 1 f(x) = 2x + 1 f ( x ) = 2 x + 1 yes yes (pre-image y − 1 2 \frac{y - 1}{2} 2 y − 1 ) f : Z → Z f: \mathbb{Z} \to \mathbb{Z} f : Z → Z , f ( x ) = 2 x f(x) = 2x f ( x ) = 2 x yes no (3 has no pre-image) f : Z → Z f: \mathbb{Z} \to \mathbb{Z} f : Z → Z , f ( x ) = x 2 f(x) = x^2 f ( x ) = x 2 no (f ( − 1 ) = f ( 1 ) f(-1) = f(1) f ( − 1 ) = f ( 1 ) ) no (− 1 -1 − 1 , 2 have no pre-image) f : R → [ 0 , ∞ ) f: \mathbb{R} \to [0, \infty) f : R → [ 0 , ∞ ) , f ( x ) = ∣ x ∣ f(x) = \lvert x \rvert f ( x ) = ∣ x ∣ no yes
How to prove the properties
One-one: assume f ( x 1 ) = f ( x 2 ) f(x_1) = f(x_2) f ( x 1 ) = f ( x 2 ) and show x 1 = x 2 x_1 = x_2 x 1 = x 2 . To disprove, give x 1 ≠ x 2 x_1 \neq x_2 x 1 = x 2 with f ( x 1 ) = f ( x 2 ) f(x_1) = f(x_2) f ( x 1 ) = f ( x 2 ) .
Onto: take an arbitrary y ∈ B y \in B y ∈ B and solve f ( x ) = y f(x) = y f ( x ) = y for x ∈ A x \in A x ∈ A . To disprove, give one y y y with no solution in A A A .
Correction · f(x) = x² on the integers (E26)
Study material says: E26 asks “Explain why f : Z → Z f: \mathbb{Z} \to \mathbb{Z} f : Z → Z , f ( x ) = x 2 f(x) = x^2 f ( x ) = x 2 is onto”, says its domain and range are Z \mathbb{Z} Z , and the answer (§1.7) says f f f is one-one because x 2 x^2 x 2 “will be a number that is different for different x”.
Correct version: f ( x ) = x 2 f(x) = x^2 f ( x ) = x 2 on Z \mathbb{Z} Z is neither one-one nor onto. Its domain is Z \mathbb{Z} Z but its range is { 0 , 1 , 4 , 9 , … } \{0, 1, 4, 9, \dots\} { 0 , 1 , 4 , 9 , … } , not Z \mathbb{Z} Z .
Why: f ( − 2 ) = f ( 2 ) = 4 f(-2) = f(2) = 4 f ( − 2 ) = f ( 2 ) = 4 with − 2 ≠ 2 -2 \neq 2 − 2 = 2 , so f f f is not one-one. − 1 -1 − 1 (and also 2 2 2 ) has no integer square root, so f f f is not onto.
Permutations and inverses
A bijection from a finite set A A A to itself is called a permutation of A A A . We write it in two-row form, with each element above its image:
f = ( 1 2 3 2 3 1 ) ( f ( 1 ) = 2 , f ( 2 ) = 3 , f ( 3 ) = 1 ) . f = \begin{pmatrix} 1 & 2 & 3 \\ 2 & 3 & 1 \end{pmatrix} \quad (f(1) = 2,\ f(2) = 3,\ f(3) = 1). f = ( 1 2 2 3 3 1 ) ( f ( 1 ) = 2 , f ( 2 ) = 3 , f ( 3 ) = 1 ) .
Definition 1.27 · Inverse function
If f : A → B f: A \to B f : A → B is a bijection, its inverse f − 1 : B → A f^{-1}: B \to A f − 1 : B → A sends each b ∈ B b \in B b ∈ B to the unique a ∈ A a \in A a ∈ A with f ( a ) = b f(a) = b f ( a ) = b . A function has an inverse if and only if it is bijective, and then f − 1 f^{-1} f − 1 is also a bijection.
For a permutation, swap the two rows and reorder the columns: f − 1 = ( 1 2 3 3 1 2 ) f^{-1} = \begin{pmatrix} 1 & 2 & 3 \\ 3 & 1 & 2 \end{pmatrix} f − 1 = ( 1 3 2 1 3 2 ) .
Recipe for a formula: (1) write y = f ( x ) y = f(x) y = f ( x ) ; (2) solve for x x x in terms of y y y ; (3) swap the names: f − 1 ( x ) = f^{-1}(x) = f − 1 ( x ) = that expression; (4) check f ( f − 1 ( x ) ) = x f(f^{-1}(x)) = x f ( f − 1 ( x )) = x .
Example 1.28 Inverse of a rational function
Goal. Show f : R ∖ { 3 } → R ∖ { 1 } f: \mathbb{R} \setminus \{3\} \to \mathbb{R} \setminus \{1\} f : R ∖ { 3 } → R ∖ { 1 } , f ( x ) = x − 2 x − 3 f(x) = \frac{x - 2}{x - 3} f ( x ) = x − 3 x − 2 , is a bijection and find f − 1 f^{-1} f − 1 .
Step. Write y = x − 2 x − 3 y = \frac{x - 2}{x - 3} y = x − 3 x − 2 and solve for x x x : y ( x − 3 ) = x − 2 ⇒ x y − 3 y = x − 2 ⇒ x ( y − 1 ) = 3 y − 2 ⇒ x = 3 y − 2 y − 1 y(x - 3) = x - 2 \Rightarrow xy - 3y = x - 2 \Rightarrow x(y - 1) = 3y - 2 \Rightarrow x = \frac{3y - 2}{y - 1} y ( x − 3 ) = x − 2 ⇒ x y − 3 y = x − 2 ⇒ x ( y − 1 ) = 3 y − 2 ⇒ x = y − 1 3 y − 2 .
Step. For every y ≠ 1 y \neq 1 y = 1 this gives exactly one x x x , and x ≠ 3 x \neq 3 x = 3 (if x = 3 x = 3 x = 3 then 3 ( y − 1 ) = 3 y − 2 3(y - 1) = 3y - 2 3 ( y − 1 ) = 3 y − 2 , i.e. − 3 = − 2 -3 = -2 − 3 = − 2 , impossible). So every y y y in the codomain has exactly one pre-image: f f f is a bijection.
Step. Swap names: f − 1 ( x ) = 3 x − 2 x − 1 f^{-1}(x) = \frac{3x - 2}{x - 1} f − 1 ( x ) = x − 1 3 x − 2 .
Step. Check at x = 4 x = 4 x = 4 : f ( 4 ) = 2 1 = 2 f(4) = \frac{2}{1} = 2 f ( 4 ) = 1 2 = 2 , and f − 1 ( 2 ) = 6 − 2 2 − 1 = 4 f^{-1}(2) = \frac{6 - 2}{2 - 1} = 4 f − 1 ( 2 ) = 2 − 1 6 − 2 = 4 .
Result. f − 1 : R ∖ { 1 } → R ∖ { 3 } f^{-1}: \mathbb{R} \setminus \{1\} \to \mathbb{R} \setminus \{3\} f − 1 : R ∖ { 1 } → R ∖ { 3 } , f − 1 ( x ) = 3 x − 2 x − 1 f^{-1}(x) = \frac{3x - 2}{x - 1} f − 1 ( x ) = x − 1 3 x − 2 .
Common mistake
Finding a “formula inverse” for a function that is not bijective. f ( x ) = x 2 f(x) = x^2 f ( x ) = x 2 on R \mathbb{R} R has no inverse: x \sqrt{x} x undoes it only on x ≥ 0 x \geq 0 x ≥ 0 , i.e. after restricting the domain to [ 0 , ∞ ) [0, \infty) [ 0 , ∞ ) .
Common mistake
Writing f − 1 ( x ) = 1 f ( x ) f^{-1}(x) = \frac{1}{f(x)} f − 1 ( x ) = f ( x ) 1 . The inverse function undoes f f f ; it is not the reciprocal. For f ( x ) = 2 x f(x) = 2x f ( x ) = 2 x , f − 1 ( x ) = x 2 f^{-1}(x) = \frac{x}{2} f − 1 ( x ) = 2 x , but 1 f ( x ) = 1 2 x \frac{1}{f(x)} = \frac{1}{2x} f ( x ) 1 = 2 x 1 .
Key idea
One-one means no two inputs share an output; onto means every codomain element is an output. Exactly the bijections (both properties) have inverses.
TEE Exam note
For “Show that f f f is one-one and onto”, write two separate parts with the standard arguments above, then find f − 1 f^{-1} f − 1 if asked. Answers: E27 — photo identity numbers need a one-one function (no two people share a number); a constant function would give everyone the same number. E28 — f ( x ) = x 3 − 3 f(x) = x^3 - 3 f ( x ) = x 3 − 3 : y = x 3 − 3 ⇒ x = y + 3 3 y = x^3 - 3 \Rightarrow x = \sqrt[3]{y + 3} y = x 3 − 3 ⇒ x = 3 y + 3 , so f − 1 ( x ) = x + 3 3 f^{-1}(x) = \sqrt[3]{x + 3} f − 1 ( x ) = 3 x + 3 .
Key takeaways
One-one: f ( x 1 ) = f ( x 2 ) ⇒ x 1 = x 2 f(x_1) = f(x_2) \Rightarrow x_1 = x_2 f ( x 1 ) = f ( x 2 ) ⇒ x 1 = x 2 ; onto: every y y y in the codomain has a pre-image.
Bijective = one-one + onto; only bijections have inverses.
Find f − 1 f^{-1} f − 1 by solving y = f ( x ) y = f(x) y = f ( x ) for x x x , then check.
A permutation is a bijection of a finite set to itself; invert it by swapping the rows.
Practice questions Answer on paper first, then check. The explanation matters more than the letter you chose.
Question 1 · multiple choice Which function f : Z → Z f: \mathbb{Z} \to \mathbb{Z} f : Z → Z is one-one but NOT onto?
Check answer
Show answer Answer: B. f ( x ) = 3 x f(x) = 3x f ( x ) = 3 x
3 x 1 = 3 x 2 3x_1 = 3x_2 3 x 1 = 3 x 2 gives x 1 = x 2 x_1 = x_2 x 1 = x 2 , but 1 is not a multiple of 3. Options 1 and 4 are bijections; option 3 is not one-one.
Question 2 · multiple choice Why is f ( x ) = x 2 f(x) = x^2 f ( x ) = x 2 on Z \mathbb{Z} Z not one-one?
Check answer
Show answer Answer: C. Because f ( − 3 ) = f ( 3 ) f(-3) = f(3) f ( − 3 ) = f ( 3 )
Two different inputs give the same output. Option 2 is true, but it shows that f f f is not onto .
Question 3 · multiple choice What is the inverse of f : R → R f: \mathbb{R} \to \mathbb{R} f : R → R , f ( x ) = 2 x + 3 f(x) = 2x + 3 f ( x ) = 2 x + 3 ?
Check answer
Show answer Answer: D. x − 3 2 \frac{x - 3}{2} 2 x − 3
y = 2 x + 3 ⇒ x = y − 3 2 y = 2x + 3 \Rightarrow x = \frac{y - 3}{2} y = 2 x + 3 ⇒ x = 2 y − 3 . Option 1 is the reciprocal, not the inverse.
Question 4 · multiple choice What is the inverse of the permutation ( 1 2 3 4 3 1 4 2 ) \begin{pmatrix} 1 & 2 & 3 & 4 \\ 3 & 1 & 4 & 2 \end{pmatrix} ( 1 3 2 1 3 4 4 2 ) ?
Check answer
Show answer Answer: A. ( 1 2 3 4 2 4 1 3 ) \begin{pmatrix} 1 & 2 & 3 & 4 \\ 2 & 4 & 1 & 3 \end{pmatrix} ( 1 2 2 4 3 1 4 3 )
f f f sends 1 → 3 1 \to 3 1 → 3 , 2 → 1 2 \to 1 2 → 1 , 3 → 4 3 \to 4 3 → 4 , 4 → 2 4 \to 2 4 → 2 , so f − 1 f^{-1} f − 1 sends 3 → 1 3 \to 1 3 → 1 , 1 → 2 1 \to 2 1 → 2 , 4 → 3 4 \to 3 4 → 3 , 2 → 4 2 \to 4 2 → 4 , i.e. 1 ↦ 2 1 \mapsto 2 1 ↦ 2 , 2 ↦ 4 2 \mapsto 4 2 ↦ 4 , 3 ↦ 1 3 \mapsto 1 3 ↦ 1 , 4 ↦ 3 4 \mapsto 3 4 ↦ 3 . Option 2 is f f f itself.
Question 5 · multiple choice A function between two finite sets with 5 elements each is one-one. What else must be true?
A It is constant B It has no inverse C It is onto, hence bijective D Its range has 4 elements
Check answer
Show answer Answer: C. It is onto, hence bijective
Five different outputs inside a 5-element codomain must use every element. Option 4 contradicts one-one, which gives 5 distinct outputs.
Question 6 · short answer
Show that f : R → R f: \mathbb{R} \to \mathbb{R} f : R → R , f ( x ) = 5 x − 7 f(x) = 5x - 7 f ( x ) = 5 x − 7 is a bijection and find f − 1 f^{-1} f − 1 .
Show worked answer One-one: if 5 x 1 − 7 = 5 x 2 − 7 5x_1 - 7 = 5x_2 - 7 5 x 1 − 7 = 5 x 2 − 7 , then 5 x 1 = 5 x 2 5x_1 = 5x_2 5 x 1 = 5 x 2 , so x 1 = x 2 x_1 = x_2 x 1 = x 2 . Onto: for any y ∈ R y \in \mathbb{R} y ∈ R , x = y + 7 5 x = \frac{y + 7}{5} x = 5 y + 7 is real and f ( x ) = 5 ⋅ y + 7 5 − 7 = y f(x) = 5 \cdot \frac{y + 7}{5} - 7 = y f ( x ) = 5 ⋅ 5 y + 7 − 7 = y . So f f f is a bijection, and f − 1 ( x ) = x + 7 5 f^{-1}(x) = \frac{x + 7}{5} f − 1 ( x ) = 5 x + 7 . Check: f − 1 ( f ( 2 ) ) = f − 1 ( 3 ) = 10 5 = 2 f^{-1}(f(2)) = f^{-1}(3) = \frac{10}{5} = 2 f − 1 ( f ( 2 )) = f − 1 ( 3 ) = 5 10 = 2 .