Once we have functions we can chain them and, when they are bijective, reverse them. These two ideas — composition and inverse — are the practical payoff of one-one and onto. This page also folds in binary operations, the algebra of combining two elements into one.
Composition of functions
Given $f:A\to B$ and $g:B\to C$, the composite $g\circ f : A \to C$ is defined by
$$(g\circ f)(x) = g\big(f(x)\big).$$
You apply $f$ first, then feed the result into $g$. For the composite to make sense, the range of $f$ must sit inside the domain of $g$ — this is the domain condition. Key facts:
- Not commutative: in general $g\circ f \ne f\circ g$.
- Associative: $h\circ(g\circ f) = (h\circ g)\circ f$, so we can drop the brackets.
- The composite of two one-one functions is one-one; the composite of two onto functions is onto; hence the composite of two bijections is a bijection.
The identity function $I_A(x)=x$ acts as a "do nothing" map: $f\circ I_A = f = I_B \circ f$.
Invertible functions
A function $f:A\to B$ is invertible if there is a function $g:B\to A$ that undoes it:
$$g\circ f = I_A \quad\text{and}\quad f\circ g = I_B.$$
Such a $g$ is unique; we call it the inverse and write $f^{-1}$. The central theorem of this chapter:
$f$ is invertible $\iff$ $f$ is bijective (one-one and onto).
This is why we spent the previous page classifying functions: only a bijection can be inverted. Note $f^{-1}$ is the inverse function, not the reciprocal $1/f$.
Properties of the inverse
- $(f^{-1})^{-1} = f$ — inverting twice returns the original.
- $f^{-1}\big(f(x)\big)=x$ and $f\big(f^{-1}(y)\big)=y$.
- Reversal law: if $f$ and $g$ are bijections, then $(g\circ f)^{-1} = f^{-1}\circ g^{-1}$ ("socks and shoes": undo in reverse order).
Finding an inverse — the method
- Confirm $f$ is bijective (so the inverse exists).
- Write $y=f(x)$.
- Solve the equation for $x$ in terms of $y$.
- Swap symbols to express $f^{-1}(y)$ (or rename $y$ as $x$).
Binary operations
A binary operation $*$ on a non-empty set $A$ is a rule that combines any two elements $a,b\in A$ into a single element $a*b\in A$. Formally it is a function $* : A\times A \to A$. The defining requirement is closure: $a*b$ must land back inside $A$. Ordinary addition and multiplication on $\mathbb{R}$ are binary operations; subtraction is a binary operation on $\mathbb{Z}$ but not on $\mathbb{N}$ (since $2-5=-3\notin\mathbb{N}$).
A binary operation may enjoy any of these properties:
The identity element, if it exists, is unique, and an inverse can only be discussed once an identity is known. For example, on $\mathbb{R}$ under addition the identity is $0$ and the inverse of $a$ is $-a$; under multiplication the identity is $1$ and the inverse of $a\ne 0$ is $1/a$. These four properties are the bridge from this chapter to the algebra of groups studied later.
If $f(x)=2x+1$ and $g(x)=x^2$, find $(g\circ f)(x)$ and $(f\circ g)(x)$, and verify they are different.
Solution
$(g\circ f)(x) = g(f(x)) = g(2x+1) = (2x+1)^2 = 4x^2+4x+1$.
$(f\circ g)(x) = f(g(x)) = f(x^2) = 2x^2+1$.
At $x=1$: $(g\circ f)(1)=9$ while $(f\circ g)(1)=3$. They disagree, confirming composition is not commutative.
Answer: $(g\circ f)(x)=4x^2+4x+1$ and $(f\circ g)(x)=2x^2+1$; they are not equal, so composition is not commutative.
Show that $f:\mathbb{R}\to\mathbb{R},\ f(x)=2x+3$ is invertible and find $f^{-1}$.
Solution
From the previous page, $f(x)=2x+3$ is bijective, so it is invertible.
Put $y=2x+3$. Solve for $x$: $x=\dfrac{y-3}{2}$. Therefore
$$f^{-1}(y)=\frac{y-3}{2}, \qquad \text{or} \qquad f^{-1}(x)=\frac{x-3}{2}.$$
Check: $f^{-1}(f(x)) = \dfrac{(2x+3)-3}{2} = x$. Correct.
Answer: $f^{-1}(x)=\dfrac{x-3}{2}$.
Let $f:\mathbb{R}\setminus\{2\}\to\mathbb{R}\setminus\{1\}$ be $f(x)=\dfrac{x}{x-2}$. Find $f^{-1}$.
Solution
Put $y=\dfrac{x}{x-2}$. Then $y(x-2)=x \Rightarrow yx-2y = x \Rightarrow yx - x = 2y \Rightarrow x(y-1)=2y$.
So $x=\dfrac{2y}{y-1}$ (valid since $y\ne 1$). Hence
$$f^{-1}(x)=\frac{2x}{x-1}.$$
Check at a point: $f(0)=\dfrac{0}{-2}=0$ and $f^{-1}(0)=\dfrac{0}{-1}=0$. Consistent.
Answer: $f^{-1}(x)=\dfrac{2x}{x-1}$.
With $f(x)=x+1$ and $g(x)=3x$, verify the reversal law $(g\circ f)^{-1}=f^{-1}\circ g^{-1}$.
Solution
First, $(g\circ f)(x)=g(x+1)=3(x+1)=3x+3$. Inverting: set $y=3x+3 \Rightarrow x=\dfrac{y-3}{3}$, so $(g\circ f)^{-1}(x)=\dfrac{x-3}{3}$.
Next, $f^{-1}(x)=x-1$ and $g^{-1}(x)=\dfrac{x}{3}$. Then $(f^{-1}\circ g^{-1})(x)=f^{-1}\!\left(\dfrac{x}{3}\right)=\dfrac{x}{3}-1=\dfrac{x-3}{3}$.
Both sides equal $\dfrac{x-3}{3}$, so the reversal law holds.
Answer: Both sides equal $\dfrac{x-3}{3}$, so $(g\circ f)^{-1}=f^{-1}\circ g^{-1}$.
Let $f(x)=x^2+1$ and $g(x)=2x-3$ on $\mathbb{R}$. Find $(f\circ g)(x)$ and $(g\circ f)(x)$, and evaluate each at $x=2$.
Solution
$(f\circ g)(x)=f(g(x))=f(2x-3)=(2x-3)^2+1 = 4x^2-12x+10$.
$(g\circ f)(x)=g(f(x))=g(x^2+1)=2(x^2+1)-3 = 2x^2-1$.
At $x=2$: $(f\circ g)(2)=4(4)-12(2)+10 = 2$, while $(g\circ f)(2)=2(4)-1 = 7$.
Answer: $(f\circ g)(x)=4x^2-12x+10$ and $(g\circ f)(x)=2x^2-1$; at $x=2$ they give $2$ and $7$, confirming $f\circ g \ne g\circ f$.
Show that $f:\mathbb{R}\to\mathbb{R},\ f(x)=4x-7$ is invertible and find $f^{-1}$. Hence find $f^{-1}(5)$.
Solution
Bijective: $f(x_1)=f(x_2)\Rightarrow 4x_1-7=4x_2-7\Rightarrow x_1=x_2$ (one-one); and $y=4x-7$ solves to $x=\dfrac{y+7}{4}\in\mathbb{R}$ for every $y$ (onto). So $f$ is invertible.
From $y=4x-7$ we get $x=\dfrac{y+7}{4}$, hence
$$f^{-1}(x)=\frac{x+7}{4}.$$
Then $f^{-1}(5)=\dfrac{5+7}{4}=\dfrac{12}{4}=3$.
Answer: $f^{-1}(x)=\dfrac{x+7}{4}$ and $f^{-1}(5)=3$.
A binary operation $*$ is defined on $\mathbb{Z}$ by $a*b = a+b-4$. Show that $*$ is commutative and associative, and find the identity element.
Solution
Commutative: $a*b = a+b-4 = b+a-4 = b*a$. Yes.
Associative: $(a*b)*c = (a+b-4)*c = (a+b-4)+c-4 = a+b+c-8$. Also $a*(b*c)=a*(b+c-4)=a+(b+c-4)-4 = a+b+c-8$. Both equal $a+b+c-8$, so $*$ is associative.
Identity $e$: need $a*e=a$, i.e. $a+e-4=a \Rightarrow e=4$. Check $4*a = 4+a-4 = a$ too.
Answer: $*$ is commutative and associative, with identity element $e=4$.
On the set $\mathbb{R}$ of real numbers, a binary operation is defined by $a*b = a+b-ab$. Find the identity element, and find the inverse of an element $a$ (where it exists).
Solution
Identity $e$: require $a*e=a$, i.e. $a+e-ae=a \Rightarrow e-ae=0 \Rightarrow e(1-a)=0$. For this to hold for all $a$ we take $e=0$. Check: $a*0 = a+0-0 = a$. So $e=0$.
Inverse of $a$: require $a*b=e=0$, i.e. $a+b-ab=0 \Rightarrow b(1-a)=-a \Rightarrow b=\dfrac{-a}{1-a}=\dfrac{a}{a-1}$, valid only when $a\ne 1$.
Answer: identity $e=0$; the inverse of $a$ is $\dfrac{a}{a-1}$ for every $a\ne 1$ (the element $1$ has no inverse).
Show by example that subtraction is not a binary operation on $\mathbb{N}$, but is one on $\mathbb{Z}$; and check whether subtraction on $\mathbb{Z}$ is commutative.
Solution
On $\mathbb{N}$: take $a=3,\ b=7$. Then $a-b=3-7=-4\notin\mathbb{N}$. Closure fails, so subtraction is not a binary operation on $\mathbb{N}$.
On $\mathbb{Z}$: for any integers $a,b$, the difference $a-b$ is again an integer, so closure holds and subtraction is a binary operation on $\mathbb{Z}$.
Commutative? $3-7=-4$ but $7-3=4$, and $-4\ne 4$, so subtraction on $\mathbb{Z}$ is not commutative.
Answer: subtraction fails closure on $\mathbb{N}$ but is a binary operation on $\mathbb{Z}$, where it is not commutative.
Let $f:\mathbb{R}\to\mathbb{R},\ f(x)=x^3+2$. Show $f$ is invertible and find $f^{-1}$.
Solution
Bijective: $x^3$ is strictly increasing, so $f(x)=x^3+2$ is too; thus $f$ is one-one. For any $y\in\mathbb{R}$, $y=x^3+2$ gives $x=(y-2)^{1/3}\in\mathbb{R}$, so $f$ is onto. Hence invertible.
Solving $y=x^3+2$ for $x$: $x^3=y-2 \Rightarrow x=(y-2)^{1/3}$. Therefore
$$f^{-1}(x)=(x-2)^{1/3}.$$
Check: $f^{-1}(f(x))=\big((x^3+2)-2\big)^{1/3}=(x^3)^{1/3}=x$. Correct.
Answer: $f$ is invertible with $f^{-1}(x)=(x-2)^{1/3}$.