This collection offers 20 practice problems on inverse functions, arranged by increasing difficulty and solved with step-by-step explanations. The exercises deal with computing the inverse, studying invertibility, the role of domain and codomain, and the notions of left inverse and right inverse.
The key idea to keep in mind is that a function \(f:A\to B\) has an inverse \(f^{-1}:B\to A\) if and only if it is bijective, that is, simultaneously injective and surjective.
Exercise 1 — level ★☆☆☆☆
Find the inverse of the function
\[ f:\mathbb R\to\mathbb R,\qquad f(x)=3x-5. \]
Answer
The function is invertible, and its inverse is
\[ f^{-1}(x)=\frac{x+5}{3}. \]
Solution
The function is affine with nonzero slope. It is therefore both injective and surjective from \(\mathbb R\) to \(\mathbb R\), and hence it has an inverse.
Set
\[ y=3x-5. \]
To find the inverse, we solve this equation for \(x\). Adding \(5\) to both sides:
\[ y+5=3x. \]
Dividing by \(3\), we obtain
\[ x=\frac{y+5}{3}. \]
Hence
\[ f^{-1}(y)=\frac{y+5}{3}. \]
Renaming the independent variable, we obtain
\[ f^{-1}(x)=\frac{x+5}{3}. \]
Let us verify by composition:
\[ f^{-1}(f(x))=\frac{(3x-5)+5}{3}=x \]
and
\[ f(f^{-1}(x))=3\cdot\frac{x+5}{3}-5=x. \]
The two identities confirm that the function we found is indeed the inverse of \(f\).
Exercise 2 — level ★☆☆☆☆
Let
\[ f:\mathbb R\to\mathbb R,\qquad f(x)=\frac{x-4}{2}. \]
Find \(f^{-1}\) and check the result by composition.
Answer
The function is invertible, and
\[ f^{-1}(x)=2x+4. \]
Solution
Set
\[ y=\frac{x-4}{2}. \]
We solve for \(x\). Multiplying both sides by \(2\), we obtain
\[ 2y=x-4. \]
Adding \(4\) to both sides:
\[ x=2y+4. \]
Hence
\[ f^{-1}(y)=2y+4. \]
Renaming the independent variable:
\[ f^{-1}(x)=2x+4. \]
Now we verify the two compositions. For every \(x\in\mathbb R\),
\[ f^{-1}(f(x))=2\cdot\frac{x-4}{2}+4=x-4+4=x. \]
Moreover, for every \(x\in\mathbb R\),
\[ f(f^{-1}(x))=\frac{(2x+4)-4}{2}=x. \]
Since
\[ f^{-1}\circ f=\operatorname{id}_{\mathbb R} \qquad\text{and}\qquad f\circ f^{-1}=\operatorname{id}_{\mathbb R}, \]
the function we found is the inverse of \(f\).
Exercise 3 — level ★★☆☆☆
Find the inverse of the function
\[ f:\mathbb R\setminus\{-3\}\to\mathbb R\setminus\{2\}, \qquad f(x)=\frac{2x-1}{x+3}. \]
Answer
The function is invertible, and
\[ f^{-1}(x)=\frac{3x+1}{2-x}. \]
Solution
We start from the equation
\[ y=\frac{2x-1}{x+3}. \]
Since \(x\ne -3\), the denominator is nonzero. We multiply both sides by \(x+3\):
\[ y(x+3)=2x-1. \]
Expanding the left-hand side:
\[ xy+3y=2x-1. \]
We move the terms containing \(x\) to one side and the remaining terms to the other:
\[ xy-2x=-1-3y. \]
Factoring out \(x\):
\[ x(y-2)=-(1+3y). \]
Since the codomain is \(\mathbb R\setminus\{2\}\), we have \(y\ne 2\), so we may divide by \(y-2\):
\[ x=\frac{-(1+3y)}{y-2}. \]
Changing the sign of both numerator and denominator, we obtain
\[ x=\frac{3y+1}{2-y}. \]
Hence
\[ f^{-1}(y)=\frac{3y+1}{2-y}. \]
Renaming the independent variable:
\[ f^{-1}(x)=\frac{3x+1}{2-x}. \]
Note that \(x\ne 2\) in the domain of \(f^{-1}\), so the denominator \(2-x\) never vanishes. This is consistent with the fact that the domain of the inverse is the codomain of the original function.
Exercise 4 — level ★★☆☆☆
Consider the function
\[ f:[0,+\infty)\to[0,+\infty), \qquad f(x)=x^2. \]
Determine whether it is invertible and, if so, find its inverse.
Answer
The function is invertible, and
\[ f^{-1}(x)=\sqrt{x}. \]
Solution
The function
\[ f(x)=x^2 \]
is not invertible from \(\mathbb R\) to \(\mathbb R\), but in this exercise the domain is restricted to \([0,+\infty)\) and the codomain is \([0,+\infty)\).
We check injectivity. If \(x_1,x_2\in[0,+\infty)\) and
\[ f(x_1)=f(x_2), \]
then
\[ x_1^2=x_2^2. \]
Since \(x_1\ge 0\) and \(x_2\ge 0\), from \(x_1^2=x_2^2\) it follows that
\[ x_1=x_2. \]
Hence \(f\) is injective.
We check surjectivity. Given any \(y\in[0,+\infty)\), we choose
\[ x=\sqrt y. \]
Then \(x\in[0,+\infty)\) and
\[ f(x)=f(\sqrt y)=(\sqrt y)^2=y. \]
Hence \(f\) is surjective.
Being both injective and surjective, \(f\) is bijective and therefore has an inverse. From the relation
\[ y=x^2 \]
with \(x\ge 0\), we obtain
\[ x=\sqrt y. \]
Therefore
\[ f^{-1}(x)=\sqrt x. \]
Exercise 5 — level ★★☆☆☆
Determine whether the function
\[ f:\mathbb R\to\mathbb R, \qquad f(x)=x^2 \]
has an inverse function.
Answer
The function is not invertible, because it is neither injective nor surjective on \(\mathbb R\).
Solution
A function \(f:\mathbb R\to\mathbb R\) has an inverse if and only if it is bijective, that is, both injective and surjective.
The function
\[ f(x)=x^2 \]
is not injective. Indeed
\[ f(-1)=(-1)^2=1 \]
and
\[ f(1)=1^2=1. \]
Hence
\[ f(-1)=f(1), \]
yet \(-1\ne 1\). Thus two distinct elements of the domain have the same image.
Moreover, the function is not surjective on \(\mathbb R\), since no negative number is the image of any real number under \(x^2\). For instance, there is no \(x\in\mathbb R\) such that
\[ x^2=-1. \]
Consequently \(f\) is not bijective.
Therefore the function
\[ f:\mathbb R\to\mathbb R,\qquad f(x)=x^2 \]
has no inverse function.
Exercise 6 — level ★★☆☆☆
Find the inverse of the function
\[ f:[-2,+\infty)\to[0,+\infty), \qquad f(x)=\sqrt{x+2}. \]
Answer
The function is invertible, and
\[ f^{-1}(x)=x^2-2. \]
Solution
The function is defined on \([-2,+\infty)\), since we must have
\[ x+2\ge 0. \]
Moreover, it takes values in \([0,+\infty)\), since a square root is always nonnegative.
Set
\[ y=\sqrt{x+2}. \]
Since \(y\ge 0\), we may square both sides:
\[ y^2=x+2. \]
Solving for \(x\):
\[ x=y^2-2. \]
Hence
\[ f^{-1}(y)=y^2-2. \]
Renaming the independent variable:
\[ f^{-1}(x)=x^2-2. \]
Note that the domain of \(f^{-1}\) is \([0,+\infty)\), namely the codomain of \(f\), while the codomain of \(f^{-1}\) is \([-2,+\infty)\), namely the domain of \(f\).
We verify:
\[ f^{-1}(f(x))=\left(\sqrt{x+2}\right)^2-2=x \]
for every \(x\in[-2,+\infty)\), and
\[ f(f^{-1}(x))=\sqrt{(x^2-2)+2}=\sqrt{x^2}=x \]
for every \(x\in[0,+\infty)\). In the last step we used the fact that \(x\ge 0\), so \(\sqrt{x^2}=x\).
Exercise 7 — level ★★☆☆☆
Find the inverse of the function
\[ f:\mathbb R\to(1,+\infty), \qquad f(x)=e^x+1. \]
Answer
The function is invertible, and
\[ f^{-1}(x)=\ln(x-1). \]
Solution
The function \(e^x\) is strictly increasing on \(\mathbb R\), hence so is \(e^x+1\). Consequently \(f\) is injective.
Moreover, since
\[ e^x>0 \]
for every \(x\in\mathbb R\), we have
\[ e^x+1>1. \]
The image of the function is thus \((1,+\infty)\), which coincides with the prescribed codomain. The function is therefore surjective.
Being bijective, it has an inverse. Set
\[ y=e^x+1. \]
Subtracting \(1\) from both sides:
\[ y-1=e^x. \]
Since \(y\in(1,+\infty)\), we have \(y-1>0\), so we may apply the natural logarithm:
\[ \ln(y-1)=x. \]
Therefore
\[ f^{-1}(y)=\ln(y-1). \]
Renaming the variable:
\[ f^{-1}(x)=\ln(x-1). \]
Exercise 8 — level ★★☆☆☆
Find the inverse of the function
\[ f:(0,+\infty)\to\mathbb R, \qquad f(x)=\ln x-3. \]
Answer
The function is invertible, and
\[ f^{-1}(x)=e^{x+3}. \]
Solution
The natural logarithm is defined for \(x>0\), is strictly increasing, and has image \(\mathbb R\). Hence \(\ln x-3\) is likewise a bijection from \((0,+\infty)\) onto \(\mathbb R\).
Set
\[ y=\ln x-3. \]
Adding \(3\) to both sides:
\[ y+3=\ln x. \]
Applying the exponential to both sides:
\[ e^{y+3}=x. \]
Hence
\[ f^{-1}(y)=e^{y+3}. \]
Renaming the independent variable, we obtain
\[ f^{-1}(x)=e^{x+3}. \]
We verify one composition:
\[ f(f^{-1}(x))=\ln(e^{x+3})-3=x+3-3=x. \]
Moreover
\[ f^{-1}(f(x))=e^{(\ln x-3)+3}=e^{\ln x}=x. \]
The two identities confirm that the function we found is the inverse.
Exercise 9 — level ★★☆☆☆
Determine whether the function
\[ f:\mathbb R\to\mathbb R, \qquad f(x)=e^x \]
is invertible. If not, explain which property fails.
Answer
The function is not invertible from \(\mathbb R\) to \(\mathbb R\), because it is not surjective.
Solution
The function
\[ f(x)=e^x \]
is injective on \(\mathbb R\), since the exponential is strictly increasing.
However, it is not surjective from \(\mathbb R\) to \(\mathbb R\). Indeed, for every \(x\in\mathbb R\),
\[ e^x>0. \]
Thus no real number less than or equal to zero is the image of a real number under \(f\). For instance, there is no \(x\in\mathbb R\) such that
\[ e^x=-1. \]
Consequently, the image of \(f\) is
\[ f(\mathbb R)=(0,+\infty), \]
which is a proper subset of the codomain \(\mathbb R\).
Since \(f\) is not surjective, it is not bijective. Therefore it has no inverse function
\[ f^{-1}:\mathbb R\to\mathbb R. \]
If instead one considers the function
\[ f:\mathbb R\to(0,+\infty), \qquad f(x)=e^x, \]
then it becomes bijective and its inverse is
\[ f^{-1}(x)=\ln x. \]
Exercise 10 — level ★★☆☆☆
Determine whether the function
\[ f:\mathbb R\to[0,+\infty), \qquad f(x)=|x| \]
is invertible. If not, explain which property fails.
Answer
The function is not invertible, because it is surjective but not injective.
Solution
The function
\[ f(x)=|x| \]
always takes nonnegative values, so the codomain \([0,+\infty)\) is consistent with its image.
The function is surjective onto \([0,+\infty)\). Indeed, given any \(y\in[0,+\infty)\), it suffices to choose
\[ x=y. \]
Then \(x\in\mathbb R\) and
\[ f(x)=|y|=y, \]
since \(y\ge 0\).
However, \(f\) is not injective. Indeed
\[ f(-2)=|-2|=2 \]
and
\[ f(2)=|2|=2. \]
Hence
\[ f(-2)=f(2), \]
yet \(-2\ne 2\).
Since the function is not injective, it is not bijective. Consequently it has no inverse function.
The obstruction is that, starting from the value \(2\), one cannot unambiguously decide whether the original element was \(2\) or \(-2\).
Exercise 11 — level ★★★☆☆
Consider the function
\[ f:[1,+\infty)\to[0,+\infty), \qquad f(x)=(x-1)^2. \]
Determine whether it is invertible and, if so, find its inverse.
Answer
The function is invertible, and
\[ f^{-1}(x)=1+\sqrt{x}. \]
Solution
The function is defined on \([1,+\infty)\). On this interval we have
\[ x-1\ge 0. \]
We check injectivity. If \(x_1,x_2\in[1,+\infty)\) and
\[ f(x_1)=f(x_2), \]
then
\[ (x_1-1)^2=(x_2-1)^2. \]
Since \(x_1-1\ge 0\) and \(x_2-1\ge 0\), it follows that
\[ x_1-1=x_2-1. \]
Hence
\[ x_1=x_2. \]
Hence the function is injective.
We check surjectivity. Let \(y\in[0,+\infty)\). We seek \(x\in[1,+\infty)\) such that
\[ (x-1)^2=y. \]
Since \(x-1\ge 0\), we obtain
\[ x-1=\sqrt y. \]
Hence
\[ x=1+\sqrt y. \]
This number belongs to \([1,+\infty)\), so the function is surjective.
Being bijective, the function is invertible. From the relation
\[ y=(x-1)^2 \]
we obtain
\[ x=1+\sqrt y. \]
Therefore
\[ f^{-1}(x)=1+\sqrt x. \]
Exercise 12 — level ★★★☆☆
Find the inverse of the function
\[ f:\mathbb R\to\mathbb R, \qquad f(x)=x^3+2. \]
Answer
The function is invertible, and
\[ f^{-1}(x)=\sqrt[3]{x-2}. \]
Solution
The function
\[ f(x)=x^3+2 \]
is strictly increasing on \(\mathbb R\), since \(x^3\) is strictly increasing and adding \(2\) does not affect monotonicity.
Hence \(f\) is injective.
Moreover, for every \(y\in\mathbb R\), we can solve the equation
\[ x^3+2=y. \]
Subtracting \(2\):
\[ x^3=y-2. \]
Since every real number has a real cube root, we obtain
\[ x=\sqrt[3]{y-2}. \]
Thus, for every \(y\in\mathbb R\), there exists \(x\in\mathbb R\) with \(f(x)=y\). The function is surjective.
Being both injective and surjective, \(f\) is bijective and has an inverse.
From the relation
\[ y=x^3+2 \]
we obtain
\[ x=\sqrt[3]{y-2}. \]
Therefore
\[ f^{-1}(x)=\sqrt[3]{x-2}. \]
Exercise 13 — level ★★★☆☆
Consider the function
\[ f:[2,+\infty)\to[0,+\infty), \qquad f(x)=|x-2|. \]
Determine whether it is invertible and find its inverse.
Answer
The function is invertible, and
\[ f^{-1}(x)=x+2. \]
Solution
Since the domain is \([2,+\infty)\), for every \(x\in[2,+\infty)\) we have
\[ x-2\ge 0. \]
Consequently
\[ |x-2|=x-2. \]
The function thus becomes
\[ f(x)=x-2 \]
on the domain \([2,+\infty)\).
This function is injective, because if
\[ f(x_1)=f(x_2), \]
then
\[ x_1-2=x_2-2, \]
and hence
\[ x_1=x_2. \]
It is also surjective onto \([0,+\infty)\). Indeed, given \(y\in[0,+\infty)\), we choose
\[ x=y+2. \]
Then \(x\in[2,+\infty)\) and
\[ f(x)=|y+2-2|=|y|=y, \]
since \(y\ge 0\).
Hence the function is bijective.
From the relation
\[ y=x-2 \]
we obtain
\[ x=y+2. \]
Therefore
\[ f^{-1}(x)=x+2. \]
Exercise 14 — level ★★★☆☆
Find the inverse of the function
\[ f:(0,+\infty)\to(0,+\infty), \qquad f(x)=\frac{1}{x}. \]
Answer
The function is invertible and coincides with its own inverse:
\[ f^{-1}(x)=\frac{1}{x}. \]
Solution
The function is defined on \((0,+\infty)\) and takes values in \((0,+\infty)\), since if \(x>0\), then
\[ \frac{1}{x}>0. \]
Set
\[ y=\frac{1}{x}. \]
Since \(x>0\), we may multiply by \(x\):
\[ xy=1. \]
Since \(y>0\), we may divide by \(y\):
\[ x=\frac{1}{y}. \]
Hence
\[ f^{-1}(y)=\frac{1}{y}. \]
Renaming the independent variable:
\[ f^{-1}(x)=\frac{1}{x}. \]
In this case the function coincides with its own inverse.
We verify:
\[ f(f(x))=f\left(\frac{1}{x}\right)=\frac{1}{\frac{1}{x}}=x. \]
Thus applying \(f\) twice returns the original element.
Exercise 15 — level ★★★☆☆
Consider the function
\[ f:(-1,+\infty)\to(-\infty,1), \qquad f(x)=\frac{x}{x+1}. \]
Determine whether it is invertible and, if so, find its inverse.
Answer
The function is invertible, and
\[ f^{-1}(x)=\frac{x}{1-x}. \]
Solution
For \(x\in(-1,+\infty)\), we have \(x+1>0\), so the function is well defined.
Moreover, we can rewrite the function as
\[ f(x)=\frac{x}{x+1}=\frac{x+1-1}{x+1}=1-\frac{1}{x+1}. \]
Since \(x+1>0\), we have
\[ \frac{1}{x+1}>0. \]
Hence
\[ f(x)=1-\frac{1}{x+1}<1. \]
Thus the values of \(f\) belong to the prescribed codomain \((-\infty,1)\).
We now find the inverse. Set
\[ y=\frac{x}{x+1}. \]
Multiplying by \(x+1\):
\[ y(x+1)=x. \]
Expanding:
\[ xy+y=x. \]
We move the terms containing \(x\) to the same side:
\[ xy-x=-y. \]
Factoring out \(x\):
\[ x(y-1)=-y. \]
Since \(y\in(-\infty,1)\), we have \(y\ne 1\), so we may divide by \(y-1\):
\[ x=\frac{-y}{y-1}. \]
Changing the sign of both numerator and denominator:
\[ x=\frac{y}{1-y}. \]
Hence
\[ f^{-1}(y)=\frac{y}{1-y}. \]
Moreover, if \(y<1\), then
\[ \frac{y}{1-y}+1=\frac{1}{1-y}>0, \]
so \(\frac{y}{1-y}>-1\). Hence the value found belongs to the domain \((-1,+\infty)\).
Renaming the variable:
\[ f^{-1}(x)=\frac{x}{1-x}. \]
Note that the domain of the inverse is \((-\infty,1)\), so \(1-x>0\) and the denominator never vanishes.
Exercise 16 — level ★★★☆☆
Let
\[ f:\mathbb R\to\mathbb R, \qquad f(x)=e^x. \]
Construct a left inverse of \(f\).
Answer
One possible left inverse is the function \(g:\mathbb R\to\mathbb R\) defined by
\[ g(y)= \begin{cases} \ln y, & y>0,\\ 0, & y\le 0. \end{cases} \]
Indeed
\[ g\circ f=\operatorname{id}_{\mathbb R}. \]
Solution
The function
\[ f:\mathbb R\to\mathbb R,\qquad f(x)=e^x \]
is injective, but not surjective on \(\mathbb R\), since its image is \((0,+\infty)\).
To obtain a left inverse of \(f\), we must construct a function
\[ g:\mathbb R\to\mathbb R \]
such that
\[ g\circ f=\operatorname{id}_{\mathbb R}. \]
Explicitly, we require
\[ g(f(x))=x \]
for every \(x\in\mathbb R\).
Since \(f(x)=e^x>0\), on positive values \(g\) must behave like the natural logarithm:
\[ g(e^x)=\ln(e^x)=x. \]
However, \(g\) must be defined on all of \(\mathbb R\), since its domain has to coincide with the codomain of \(f\).
On the values \(y\le 0\), \(f\) imposes no constraint on \(g\), since no number less than or equal to zero lies in the image of \(f\). We may therefore choose any real value.
For instance, we define
\[ g(y)= \begin{cases} \ln y, & y>0,\\ 0, & y\le 0. \end{cases} \]
Then, for every \(x\in\mathbb R\), we have \(e^x>0\), so
\[ g(f(x))=g(e^x)=\ln(e^x)=x. \]
Hence
\[ g\circ f=\operatorname{id}_{\mathbb R}. \]
Thus \(g\) is a left inverse of \(f\). It is not, however, a two-sided inverse, since \(f\) is not surjective from \(\mathbb R\) to \(\mathbb R\).
Exercise 17 — level ★★★☆☆
Let
\[ f:\mathbb R\to[0,+\infty), \qquad f(x)=x^2. \]
Construct two distinct right inverses of \(f\).
Answer
Two right inverses of \(f\) are
\[ h_1(y)=\sqrt y \]
and
\[ h_2(y)=-\sqrt y. \]
Both are functions from \([0,+\infty)\) to \(\mathbb R\) and satisfy
\[ f\circ h_i=\operatorname{id}_{[0,+\infty)} \]
for \(i=1,2\).
Solution
A right inverse of \(f\) is a function
\[ h:[0,+\infty)\to\mathbb R \]
such that
\[ f\circ h=\operatorname{id}_{[0,+\infty)}. \]
Explicitly, we require
\[ f(h(y))=y \]
for every \(y\in[0,+\infty)\).
Since \(f(x)=x^2\), for each \(y\ge 0\) we must choose a real number \(h(y)\) such that
\[ (h(y))^2=y. \]
A first natural choice is
\[ h_1(y)=\sqrt y. \]
Indeed, for every \(y\in[0,+\infty)\),
\[ f(h_1(y))=f(\sqrt y)=(\sqrt y)^2=y. \]
Hence
\[ f\circ h_1=\operatorname{id}_{[0,+\infty)}. \]
A second possible choice is
\[ h_2(y)=-\sqrt y. \]
Again, for every \(y\in[0,+\infty)\),
\[ f(h_2(y))=f(-\sqrt y)=(-\sqrt y)^2=y. \]
Hence
\[ f\circ h_2=\operatorname{id}_{[0,+\infty)}. \]
The functions \(h_1\) and \(h_2\) are distinct, since for example
\[ h_1(1)=1, \qquad h_2(1)=-1. \]
This shows that a surjective but non-injective function can have several right inverses.
Exercise 18 — level ★★★★☆
Prove that if a function \(f:A\to B\) has a left inverse \(g:B\to A\), then \(f\) is injective.
Answer
If there exists \(g:B\to A\) such that
\[ g\circ f=\operatorname{id}_A, \]
then \(f\) is injective.
Solution
By hypothesis, \(g\) is a left inverse of \(f\). This means that
\[ g\circ f=\operatorname{id}_A. \]
Explicitly:
\[ g(f(x))=x \]
for every \(x\in A\).
We must show that \(f\) is injective. So take \(x_1,x_2\in A\) and suppose that
\[ f(x_1)=f(x_2). \]
To establish injectivity, we must deduce that
\[ x_1=x_2. \]
Applying \(g\) to both sides of the equality \(f(x_1)=f(x_2)\), we obtain
\[ g(f(x_1))=g(f(x_2)). \]
Since \(g\circ f=\operatorname{id}_A\), we have
\[ g(f(x_1))=x_1 \]
and
\[ g(f(x_2))=x_2. \]
Therefore
\[ x_1=x_2. \]
We have shown that whenever two elements of the domain have the same image, they coincide. Hence \(f\) is injective.
Exercise 19 — level ★★★★☆
Prove that if a function \(f:A\to B\) has a right inverse \(h:B\to A\), then \(f\) is surjective.
Answer
If there exists \(h:B\to A\) such that
\[ f\circ h=\operatorname{id}_B, \]
then \(f\) is surjective.
Solution
By hypothesis, \(h\) is a right inverse of \(f\). Hence
\[ f\circ h=\operatorname{id}_B. \]
Explicitly, for every \(y\in B\),
\[ f(h(y))=y. \]
We must show that \(f\) is surjective. To this end, take an arbitrary element \(y\in B\); we must exhibit at least one element \(x\in A\) such that
\[ f(x)=y. \]
Since \(h\) is a function from \(B\) to \(A\), the element \(h(y)\) belongs to \(A\). We therefore set
\[ x=h(y). \]
Then, using the identity \(f\circ h=\operatorname{id}_B\), we obtain
\[ f(x)=f(h(y))=y. \]
We have thus found an element \(x\in A\) with \(f(x)=y\).
Since \(y\in B\) was arbitrary, every element of \(B\) is the image of at least one element of \(A\). Hence \(f\) is surjective.
Exercise 20 — level ★★★★★
Let \(f:A\to B\) be a function. Suppose there exists a function \(u:B\to A\) such that
\[ u\circ f=\operatorname{id}_A \]
and
\[ f\circ u=\operatorname{id}_B. \]
Prove that \(f\) is bijective and that \(u=f^{-1}\).
Answer
The function \(f\) is bijective and \(u\) is its inverse function:
\[ u=f^{-1}. \]
Solution
By hypothesis, the function \(u:B\to A\) satisfies two identities:
\[ u\circ f=\operatorname{id}_A \]
and
\[ f\circ u=\operatorname{id}_B. \]
The first identity says that \(u\) is a left inverse of \(f\). Indeed, for every \(x\in A\),
\[ u(f(x))=x. \]
We first show that \(f\) is injective. Let \(x_1,x_2\in A\) and suppose that
\[ f(x_1)=f(x_2). \]
Applying \(u\) to both sides:
\[ u(f(x_1))=u(f(x_2)). \]
Since \(u\circ f=\operatorname{id}_A\), we obtain
\[ x_1=x_2. \]
Hence \(f\) is injective.
The second identity says that \(u\) is a right inverse of \(f\). Indeed, for every \(y\in B\),
\[ f(u(y))=y. \]
We now show that \(f\) is surjective. Let \(y\in B\). Since \(u(y)\in A\), setting
\[ x=u(y), \]
we have
\[ f(x)=f(u(y))=y. \]
Thus every element \(y\in B\) is the image of at least one element of \(A\). Therefore \(f\) is surjective.
We have shown that \(f\) is both injective and surjective. Hence \(f\) is bijective.
Since a bijective function has an inverse function \(f^{-1}:B\to A\), this inverse is characterized by the identities
\[ f^{-1}\circ f=\operatorname{id}_A \]
and
\[ f\circ f^{-1}=\operatorname{id}_B. \]
But \(u\) satisfies precisely these two identities:
\[ u\circ f=\operatorname{id}_A \qquad\text{and}\qquad f\circ u=\operatorname{id}_B. \]
Thus \(u\) inverts \(f\) both on the left and on the right.
By the uniqueness of the inverse, we conclude that
\[ u=f^{-1}. \]