6

I understand what domain and image of a function are, and believe those terms to be well-defined. I have read that range is ambiguous, so I avoid it.

However for any given function the image has infinitely many supersets. It seems rather arbitrary to me which one we pick to be the codomain.

Is it governed by some informal convention of mathematicians?

Clearly, $\Bbb N$, $\Bbb R$, and $\Bbb C$ are popular, hence the symbols. However if, say, $\Bbb N$ is the codomain of the floor function, than it can just as well be $\Bbb R$ or $\Bbb C$.

In case of numbers you could argue, that one should pick the most restrictive among $\Bbb N$ and $\Bbb R$ and $\Bbb C$, but what about functions that do not evaluate to numbers?

dfeuer
  • 9,069

1 Answers1

8

There are actually several different notions of "function" in mathematics. If you read a book about set theory, you may well see a function defined simply as a set $f$ of ordered pairs such that if $(a,b)\in f$ and $(a,c)\in f$ then $b=c$. Such a "function" has a domain (or "preimage") and an image, but no concept of codomain.

If, however, you are thinking more "categorically", a "function" consists of three things: a domain, a codomain, and the set as described above. The most immediate advantage of this approach is that function composition works out nicely in a fashion that is easy to describe: if $f\colon A \to B$ and $g\colon B \to C$, then $g\circ f\colon A \to C$. You don't have to futz around with "if the image of $f$ is a subset of the domain of $g$, then …."

dfeuer
  • 9,069
  • 3
    Just a remark to address the ambiguity concerns of OP: The codomain is not ambiguous since it is required that it is specified as part of describing the function. What is correct to say is that the codomain is in no way uniquely determined by the function. – Ittay Weiss Nov 27 '13 at 09:37
  • 3
    It also adds an extra convenience: when you encode a codomain into functions and make it part of the composition rule, identity functions become actual units in the algebraic sense. Without thinking of functions as individuated in part by their codomains, identity functions are much less nice. – Malice Vidrine Nov 27 '13 at 10:26
  • Your last sentence is misleading; if $f:A→B$ and $g:C→D$, and $B⊆C$ but $B≠C$, I still want to be able to compose them, but your other approach would say "no". So it's not nice at all from my point of view. – user21820 Jun 30 '21 at 17:25
  • @user21820, I'm just explaining that there are different perspectives. Sometimes one is more appropriate; sometimes another is. I write a lot of code in Haskell, where the second definition holds. If you're working with refinement types, you're likely to think more about the first definition (or actually a hybrid). – dfeuer Aug 30 '21 at 17:03
  • I know that if you treat function types as representing function signatures in the sense of type theories with strict typing, then you're stuck with having to match output and input types when composing. However, my point is that when you actually have a mismatch between them but you still want to compose, then you still have to address whether the first is a subtype of the second, regardless of the foundational system we are using. After all, if you want to type-coerce, you still need it to be permitted. – user21820 Aug 30 '21 at 17:25
  • In the "ordered pairs" approach it still makes sense to talk about codomains: any set that includes the image can be a codomain. – Guillaume F. Apr 25 '22 at 20:59