7
$\begingroup$

If a function $f$ is defined as

$$f:X\to Y$$

We say the domain is $X$, and the codomain is $Y$.

However, it seems the image is distinct from codomain, and only coincides with $Y$ if $f$ is surjective.

Question 1: Why is there this distinction? Why is it convenient to define a function's "target" as a super-set of its strict image? For example, why would we say $f(x)=x^2$ is $f:\mathbb{R} \to \mathbb{R}$ and not $f: \mathbb{R} \to \mathbb{R}^{+}$ ?

Question 2: Similarly, if we are content to make a distinction between image and codomain, why do we insist the domain is actually the pre-image and not a superset? That is, why do we say $f(x)=\log(x)$ is $f:\mathbb{R}^{+} \to \mathbb{R}$ and not $f:\mathbb{R} \to \mathbb{R}$ ?


This question asks the same but there is no marked answer, and reading through it, none seemed convincing. The same for this one too.

$\endgroup$
8
  • $\begingroup$ There is a notion of "partial function" which covers functions $f:X \to Y$ which need not be defined on all of $X.$ en.wikipedia.org/wiki/… $\endgroup$
    – coffeemath
    Commented Jan 5 at 2:07
  • 1
    $\begingroup$ There is a related preimage concept. $\endgroup$
    – peterwhy
    Commented Jan 5 at 2:14
  • 1
    $\begingroup$ Thanks for bringing up this question again. I was the OP of the first post you link and I was indeed not satisfied with any of the answers I received. I also did some historical research and found that Russell talked about a ‘converse domain’ as the domain of the inverse (what he called converse) if we treat the function as a relation. I think ‘converse domain’ was later called co-domain. But note: if we consider the ‘domain’ to be all elements for which the function is defined, then that would mean that the ‘converse domain’ would have to be what we now call the image, and not the co-domain. $\endgroup$
    – Bram28
    Commented Jan 5 at 2:28
  • 3
    $\begingroup$ Please use $\to$ or $\rightarrow$ and not $\mapsto$ when indicating domain and codomain. If you want to use $\mapsto$, you can use it to indicate where a particular element maps, as in “$x\mapsto f(x)$.” $\endgroup$ Commented Jan 5 at 2:55
  • 1
    $\begingroup$ And just for the record: I think it makes total sense to separate between co-domain and image: so why not a similar distinction between ‘the kinds of things that are considered candidates for our function to be applied to’ (the ‘Domain of discourse’ or ‘domain’ for short) and ‘those things to which we can actually apply the function’ ie ‘those things for which the function is defined’ (the ‘domain of definition’ or ‘pre-image’). And I feel the $f : A \mapsto B$ notation should give us the ‘domain’ and ‘co-domain’ in this sense. So: $f:\mathbb{R} \mapsto \mathbb{R}$ for both of your examples. $\endgroup$
    – Bram28
    Commented Jan 5 at 2:59

4 Answers 4

6
$\begingroup$

For question 1: In many cases, we do not need to know the exact image, and it would be difficult to calculate. For $f(x) = x^2$ it's easy enough, but what if we had $g(x) = x^6 - 4x^5 + 17x^4 + 23x^3 - 5x^2 + 17x + 52$ ? We want to be able to say $g$ is a function from $\mathbb{R}$ to $\mathbb{R}$ (this is obvious from the definition) without worrying about the image. For many purposes, the fact that $g(x) \in \mathbb{R}$ is important, but the exact image is irrelevant.

For question 2: Because it is important to know the set of points where the function is defined so that we know what values $x$ the expression $g(x)$ is meaningful. When you define a function $g(x)$, you have to give a formula/description of the value $g(x)$ for each value of $x$, so you know the exact domain of $x$ already. There's no reason to give a larger subset.

$\endgroup$
2
  • 2
    $\begingroup$ Do we really know the exact domain of $x$ already just because we provided a formula? A variation of your example: for $F(x)=1/x$ it's easy, but what is the exact domain of $G(x)=1/g(x)$, using your $g(x)$? I think it is the whole $\mathbb{R}$, but I used a CAS to check the roots, so in principle, the exact domain can also be quite difficult to compute. In this regard, I don't really see a difference with computing the exact image, both can be arbitrarily difficult I guess. $\endgroup$
    – SampleTime
    Commented Jan 5 at 12:33
  • 1
    $\begingroup$ @SampleTime Exactly! As far as I can see, all the arguments for separating between image and co-domain on the output side are equally good arguments for having a similar separation on the input side … so where the ‘domain’ is the domain of discourse, i.e. where, as CoArp says, the input elements ‘live’ … but for which possibly only a subset (the ‘pre-image’) there is actually a function value defined. $\endgroup$
    – Bram28
    Commented Jan 5 at 13:28
2
$\begingroup$

For your first question, it does not really matter when only one function is concerned since we can always consider the natural injection $i: im(f) \to Y$ and identify $f$ with $i \circ f.$ However, maybe it is relevant for one to view the original function as being part of a subset of functions between $X$ and $Y,$ where some examples that come to mind would be when we have a sequence $(f_n)_{n \in \mathbb{N}} \subseteq Y^X$ or when these functions exhibit certain special property- measurability, continuity, holomorphy, etc. and one wishes to view the original function as part of this larger class of mappings.

As for your second question, I believe you answered it yourself since your example of the logarithm function is not defined for negative values and we do ask of the function to be defined at all points of its domain. I hope this helps. :)

$\endgroup$
3
  • $\begingroup$ Wanting to think of $f(x) = x^2$ as a member of the (vector) space of real functions of a real variable would be a better example than the one you chose. The downvote puzzles me. $\endgroup$ Commented Jan 5 at 2:25
  • 1
    $\begingroup$ I think you misunderstood question 2. The question is precisely why we require this to be the case. $\endgroup$
    – anankElpis
    Commented Jan 5 at 2:43
  • $\begingroup$ @EthanBolker yes, that's what I had in mind, even though maybe I did not make it clear enough, what I meant exactly is that one may want to look at a function as a member of a certain Banach space or some operator algebra for example. Of course, a comprehensive list would be basically endless. $\endgroup$ Commented Jan 5 at 3:15
2
$\begingroup$

The way I see it, functions are defined this way because it is the most convenient in most situations: If the target had to agree with the image, you would have to calculate the image of every function you want to write down. This can be tedious or difficult or impossible depending on the function you are working with. Therefore it is easier to give a codomain and refer to the image only if needed.

For the domain, the situation is more nuanced. The advantage of having your function defined everywhere on the domain is that you can write down $f(x)$ for any $x$ in the domain of $f$ without worry. If $f$ were not defined everywhere, $f(x)$ might not exist and you have to distinguish these cases whenever you want to apply your function.

However, sometimes another notion of "function" is more useful, which is why variants of the standard definition exist. For example, it is often difficult to determine exactly where a function is defined. That's why partial functions exist. Similarly, multivalued functions don't require the image of an element to be unique, which is useful for example for complex roots or logs. In general, if a different convention fits your problem more cleanly, you can freely alter the definition (as long as you say so at the start).

$\endgroup$
1
$\begingroup$

My attempt at an answer: (these are the reasons that make sense to me, hopefully they make you think as well)

For question 1, it often depends on context. For example, consider the function $f: \mathbb{R} \to \mathbb{R}$ defined as $f(x) = x^2$ as an element of the set of continuous functions from $\mathbb{R}$ to $\mathbb{R}$. Of course, the image of $f$ is $\mathbb{R}^+$ but it may make more sense for us to consider the codomain as different from the image of $f$ based on where this copy of $f$ "lives". There are a ton of examples in this vein since a single function will almost always appear in different contexts but this is (at least one) reason why there is not a universal standard when it comes to this.

For question 2, as Actually Fritz states in their answer, we really would like elements of the domain to be defined when we plug them in to our function (otherwise, what are they even doing in the domain!). But I also wanted to point out that this also depends on context. There is no reason why we couldn't have defined the domain of our function $f$ to be $\mathbb{C}$ other than the fact we were considering it at a continuous function from $\mathbb{R}$ to $\mathbb{R}$ (of course we would need to change the codomain as well but that is besides the point).

Morally, the domain and codomain of a function gives us information on where the function "lives" and how it is being used ($\mathbb{R}$ versus $\mathbb{C}$). And since the same functions are used in various contexts (i.e. they live in different places and are used for different things) there is no standard for what they should be set as.

$\endgroup$
6
  • $\begingroup$ So why do the arguments not cut both ways? Why not say that the ‘domain’ is where the input elements ‘live’? Isn’t that the same answer to ‘what are they doing there?’ when one asks why we make a difference between image and co-domain? When students are asked to graph a function on a $x,y$ coordinate system, isn’t it totally natural to first tell them what the ‘$x$’ and ‘$y$’ are, i.e. what ‘world’ we try to msp to shat ‘world’, and only after that have them figure out whether or not the function covers all of the input world or output world? $\endgroup$
    – Bram28
    Commented Jan 5 at 13:37
  • $\begingroup$ @Bram28 The domain is exactly where the input elements "live", but if we add elements that aren't defined on the function, we now have a partial function. This is still a valid thing to talk about, but it's not quite the same as "expanding" the codomain since we still have a function when we do that. $\endgroup$
    – CoArp
    Commented Jan 5 at 18:37
  • $\begingroup$ But why de we demand that a function is defined for every element of its domain? Why don't we set things up in a away such that functions can be total functions or non-total (partial) functions. That to me would make so much more sense, be so much more intuitive, and perfectly consistent with what we do on the output side. $\endgroup$
    – Bram28
    Commented Jan 5 at 19:30
  • $\begingroup$ @Bram28 I honestly think it comes down to convention. Allowing a function to not be defined on parts of its domain is more general than the current definition and that could be great. But why not go the other way and redefine the codomain as the image. This would make for an easier definition of the inverse of a function. At the end of the day, there are quite a few options and one of them must be chosen. $\endgroup$
    – CoArp
    Commented Jan 7 at 2:19
  • $\begingroup$ Well, yes, of course it is all about convention: it's all up to the community as to how we want to define things, and none of these definitions are set in stone. $1$ used to be a prime, but then later on we felt it was better to regard $1$ not to be a prime, so we changed our definition of prime. So none of this is about what is true, and one of it is set in stone ... rather it is all about what is helpful, practical, elegant, and other such notions. $\endgroup$
    – Bram28
    Commented Jan 7 at 3:03

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