(Noob question.)

I'm working through Khan Academy, and one of the criteria that Sal mentioned for a function to be invertible is that its range must be equal to its entire codomain, which means that one of the criteria is that the function must be surjective.

So for a function like $f(x)=e^x$ which is a mapping from ℝ^1 to ℝ^1, does it mean that $e^x$ is not invertible because the image (range) of $e^x$ is not the entire codomain ℝ^1?

For example, $e^x$ can never equal a negative number, and so automatically we know that $e^x$ does not span its codomain (the function's range is smaller than the codomain), which is ℝ^1.

However, we know that $e^x$ does have an inverse, and that inverse is $\ln\left(x\right)$.

Does this go against what the definition of a function being invertible? What am I getting wrong here?

Help would be appreciated.


2 Answers 2


Every function must have a specified domain and codomain, and an inverse function's domain is the codomain of the original function.

If you view $e^x$ as a function from $\mathbb{R}$ to $\mathbb{R}$, then it is indeed not invertible, for the reason you mention, viz. it is not surjective. A function must be able to accept any input from its domain, and your proposed inverse $\log x$ does not accept nonpositive numbers. $\log x$ is not defined as a function on all of $\mathbb{R}$, and so is not an inverse function for $e^x$ as a function to all of $\mathbb{R}$.

However to state the problem is to solve it. You may instead choose to view $e^x$ as a function from $\mathbb{R}$ to $\mathbb{R}^+$ (the positive reals). Then it is surjective, and it has an inverse $\log x$, which is a function from $\mathbb{R}^+$ to $\mathbb{R}$

To reiterate, a function must be surjective in order to have an inverse, because if it were not, then any point in its codomain which is not in its range, is a point in the domain of the inverse function where the inverse function is undefined. And one of the defining requirements for a function to be a function is that it is never undefined at any point of its domain.

  • 2
    $\begingroup$ @thebluepandabear If $f:D\to C$ you can alter the codomain $C$ as much as you like without changing the function; just make sure that $f(D)$ is always contained in your codomain. If you either restrict or increase the domain $D$, then technically you get a new function. You're allowed to do it, of course, and in the latter case your new function will agree with your original function on the smaller domain,but keep in mind that this new object is technically another function. $\endgroup$
    – Simon SMN
    Commented Nov 25, 2022 at 5:24
  • $\begingroup$ @SimonSMN thanks, that cleared things up. $\endgroup$ Commented Nov 25, 2022 at 6:37
  • $\begingroup$ @thebluepandabear Happy to help! $\endgroup$
    – Simon SMN
    Commented Nov 25, 2022 at 7:16
  • $\begingroup$ @SimonSMN the notation $f: D\to C$ specifically means the codomain is $C$ so any claims about the surjectivity are unambiguous and not incomplete. $\endgroup$
    – ziggurism
    Commented Nov 27, 2022 at 2:34

$\def\R{\mathbf{R}}$ Mathematicians do not place much stead in the difference between the co-domain and the range. In other words, most people would consider $f:\R\to\R$ defined as $f(x)=e^x$, and the function $g:\R\to(0,\infty)$ defined by $g(x):=e^x$ to be the same function (even though strictly speaking they are different functions). This should be contrasted to how we treat difference in domains. If in the previous two functions, the domain of $f$ was changed to $[0,1]$, then we would consider $f$ and $g$ to be different functions.

In this vein, really, the only requirement one needs for a function to be invertible is that it be one to one, not surjective. Since all the inverse function is doing is that it is mapping the range back to the domain.

If we had a one to one function $h:A\to B$ where $A,B\subseteq\R$, then if the range did equal the co-domain, we could simply write its inverse as $h^{-1}:B\to A$. If the range was a subset of the co-domain however, we'd have to write something like $h^{-1}: h[A]\to B$, where $h[A]$ means the range of $h$.

In other words, mathematicians in the strictest sense do require functions to be injective as well as surjective in order to be invertible, to avoid the case where some members of the co-domain don't get mapped to anything in the domain, and hence are undefined.

In the end, this distinction is usually not an issue, since we normally know our range and co-domain, and can use these two notions of inverses as we wish.

  • $\begingroup$ I don't agree that $f$ and $g$ as you've defined them are different. They are equal to one another and thus the same. $\endgroup$
    – Simon SMN
    Commented Nov 25, 2022 at 7:19
  • $\begingroup$ @SimonSMN: the strictest definition of function is a triple containing the functional relation, the domain, and the codomain. This causes functions with distinct codomains not to be equal. it makes the $f$ and $g$ defined by user1020500 not equal. $\endgroup$
    – ziggurism
    Commented Nov 26, 2022 at 17:17
  • $\begingroup$ @ziggurism I guess, but the OP seems to be taking a first course in calclulus. I would argue the most useful definition in such a course is the other one. Wouldn't you? Also, what do you mean by "the strictest"? $\endgroup$
    – Simon SMN
    Commented Nov 26, 2022 at 18:11
  • $\begingroup$ @SimonSMN You can choose to be sloppy about whether to keep track of codomains, especially in an intro calc course. But I don't think it makes sense to make comments disagreeing with correct answers by other users just because they didn't choose to be as sloppy as you prefer, like you did to user1020500 $\endgroup$
    – ziggurism
    Commented Nov 27, 2022 at 2:31
  • $\begingroup$ @ziggurism I had not seen your definition before, so I was actually curious. $\endgroup$
    – Simon SMN
    Commented Nov 27, 2022 at 19:43

You must log in to answer this question.

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