I've read through a few of the other posts on the site, but I still don't quite understand.

Suppose $f : A \to B$, for $A = \{a, b, c\}$ and $B = \{1, 2, 3, 4\}$, and suppose that we define the function $f(x)$, for some $x \in A$, as:

$f(a) = 1$

$f(b) = 2$

$f(c) = 3$

That is, the element $4$ in the codomain remains unmapped/unassigned to any element in the codomain. While the function is one-to-one, it is not surjective, and thereby is not bijective.

The inverse, if we were to write one up, would look like so:

$f(1) = a$

$f(2) = b$

$f(3) = c$

$f(4) = undefined$

Now, what I don't understand is why this is a problem. Why did the original function have to be surjective? Consider the familiar function $f : R \to R$ such that $f(x) = \frac{1}{x}$. This function, while one-to-one, is not onto, just as with my example above. However, we can still find an inverse:

$y = f(x) = \frac{1}{x}$

$xy = 1$

$x = \frac{1}{y}$

$y = \frac{1}{x}$

$f^{-1}(x) = \frac{1}{x}$


5 Answers 5


Keep in mind three things about the mathematical concept of a function and its inverse

  1. every function comes with a domain and a range.
  2. there must be a function value defined for every element of the domain.
  3. The inverse of a function $f:A \to B$ must be a function $f^{-1} : B \to A$ having the properties that $f^{-1} \circ f$ is the identity function on the set $A$ and $f \circ f^{-1}$ is the identity function on the set $B$. In particular, the roles of the domain and range must be swapped with comparing $f$ to $f^{-1}$.

In your example of $f : \{a,b,c\} \to \{1,2,3,4\}$, in your attempt to write a formula for an inverse function $f^{-1} : \{1,2,3,4\} \to \{a,b,c\}$ you write $f^{-1}(4) = undefined$. But "undefined" is not allowed for a function whose range is the set $\{a,b,c\}$, $f^{-1}(4)$ must be an element of the set $\{a,b,c\}$.

In your example of $f : R \to R$ given by $f(x)=\frac{1}{x}$, notice that $f(0)$ is undefined, so this example also violates the requirements for a function.

Now, if you had instead written $f : R - \{0\} \to R - \{0\}$ given by $f(x) = \frac{1}{x}$, that would indeed have been a bijection. And it would have an inverse. In fact, $f$ is its own inverse: $f = f^{-1}$.

  • $\begingroup$ Thank you very much! I think my confusion stemmed from a misunderstanding of the domain. So a domain element must correspond to one range value. Consequently, when we swap the domain and codomain, the "new domain" (formerly the codomain) must have all its values mapped. But since the function was not surjective, its inverse cannot map its "new domain" to the "new codomain", and is thus not a function--did I understand that correctly? $\endgroup$ Jun 1, 2017 at 18:21
  • $\begingroup$ Additionally, as someone who is taking discrete mathematics after algebra and calculus, I think I was having trouble making a connection between what I already knew and this "new" material. So when we define the function f(x) = 1/x, we never actually say it's $f: R \to R$ because the notation $f : A \to B $ says "the function f maps elements of the domain to the codomain", and yet R is not the domain of f(x) = 1/x because it includes x = 0, right? I think I get it now. $\endgroup$ Jun 1, 2017 at 18:24
  • $\begingroup$ I wouldn't use the word range here for $B$, since $f$ is not a surjection $A \rightarrow B$. $B$ is the codomain. $\endgroup$ Jun 1, 2017 at 18:30
  • $\begingroup$ @AleksandrH: Your two comments are both correct. $\endgroup$
    – Lee Mosher
    Jun 2, 2017 at 14:53

Because, while such functions look like inverses in a lot of ways, they don't actually satisfy the definition.

Let's look at the first example you give.

First of all, "undefined" isn't a valid output for a function: by definition, a function must be defined on its whole domain.

We can get around this by having $g$ send $4$ to some random element of $A$ - say, $a$. This causes two problems. The first problem is that $g$ isn't unique anymore: we have three different choices for $g$, since we have three different choices for where $4$ goes.

Another problem, closely related, is seen by looking at the definition of the inverse function:

$g: B\rightarrow A$ is the inverse of $f: A\rightarrow B$ if (i) for all $x\in A$ we have $(g\circ f)(x)=x$ and (ii) for all $y\in B$ we have $(f\circ g)(y)=y$. Or, using somewhat different notation, (i) $g\circ f=id_X$ and (ii) $f\circ g=id_Y$.

It's this second clause which is a problem if $f$ isn't surjective: no matter where $g$ sends $4$, we don't have $(f\circ g)(4)=4$ (e.g. if $g(4)=a$ then $(f\circ g)(4)=1$).

Now, there are also left and right inverses. In the example you give, we do have $g\circ f=id_X$; this means that $g$ is a left inverse of $f$, and $f$ is a right inverse of $g$. But this is quite different from an actual inverse. Also, it's not unique: a function may have many left- or right-inverses.

That said, for applications it's often true that a one-sided inverse is enough, and we don't need a genuine inverse; one setting where this crops up a lot is trigonometry, where it's useful to consider the one-sided inverses of trig functions (arctan, arcsin, arccos, ...) which don't have genuine inverses.


It's basically a matter of how you choose to define 'inverse' in the context of functions. An injective function is invertible, but the domain of its inverse won't be the codomain of the original function. As long as you realise that, you can use this idea of an inverse function. If you require the inverse to be defined on the whole codomain, then clearly the function must be surjective as well.

By the way, if $f:\mathbb{R}\to\mathbb{R}$, then the rule $f(x) = \frac{1}{x}$ does not define the value of the function at every point in its domain (specifically at 0).


A function from $A$ to $B$ is defined to be a subset of $A\times B$ (the set of ordered pairs whose first element is in $A$, and whose second element is in $B$) satisfying the following two properties: first, for all $x\in A$, there exists $y\in B$ such that $(x,y)\in f$. Second, if $(x,y), (x,y')\in f$ for some $x\in A, y,y'\in B$, then $y=y'$. The first property prevents us from having functions with "undefined" values.

Your reasoning with the function $f(x)=\frac 1 x$ is valid if we consider $f$ to be a function from $\mathbb{R}\backslash\{0\}$ to itself. Otherwise, if we tried to consider $0$ to be part of the domain of $f$, then $f(0)$ cannot even be defined, so you can't say that $y=f(x)$.

Everything above is based off of the standard notion of a function. The concept of a partial function exists (which is given by dropping the first requirement for a function), which allows for some points to have "undefined" values.


You can think of functions as arrows from one set $A$ to an other set $B$ such that in every element of $A$ starts exactly one arrow. The inverse function, if it exists, reverses the arrows such that the direction of the arrows change: the arrows start now in $B$. However, if $f$ is not surjective, then there are elements in $B$ that do not receive an arrow starting in $A$. Then, you cannot reverse the arrows because by definition of a function, in every element of $B$ an arrow must start.

In short: every element of the domain of a function MUST be mapped to a certain value.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .