I am wondering if there are any standards for defining the codomain of a function. For example, what is the codomain of the function $f(x)=x^2+1$? Is it $\Bbb R$ or instead all positive real numbers $\Bbb R>0$? Similarly, if I had the function $g(n)=n^2+1$, should I define the codomain as the set of all integers or the set of all natural numbers? Can I determine the codomain through using an algorithm (as I can do with the range) or is it more of an intuitive concept that can be answered in multiple ways?
2 Answers
The domain and codomain are part of the information we include in the definition of the function. If you change the codomain then you are actually changing the function itself and a number of its properties changes with it. To use your example of $f(x) = x^2+1$ with domain $\mathbb{R}$ if the codomain is $\mathbb{R}$ then it's not surjective but if the codomain is $[1,\infty)$ then it is surjective.

- 11,018
- 1
- 12
- 29
It is not really intuitive. In your examples, the codomains could be either. Technically when one is defining a function, the codomain should be specified, but usually people are just being sloppy and abuse the notation. In your examples, the functions with different codomain are different by some inclusion map, but since most of time it doesn’t affect anything in analysis or topology, people just omit it or consider it to be self-evident.
To be more specific, say in your first example, since the standard analysis is developed with $\mathbb{R}^n$, you may think of the codomain to be $\mathbb{R}$.

- 407
-
Whether a codomain needs to be specified or not actually depends on how you define functions. See for example this answer – Arturo Magidin Aug 05 '19 at 03:34
-
@Arturo Magidin A great reference. The first point of view in your link is for something people are always thinking about but seldom say it out (though I think the second definition is adopted more in rigorous settings). – froyooo Aug 05 '19 at 03:46
-
Depends on your definition of “rigorous”, and as Pete Clark says in the linked question, it is often important to switch from one of the definitions to the other and back. The first definition is quite rigorous: it is, for example, the one adopted in most set theory books. An important point, though, it sthat “Technically when one is defining a function, the codomain should be specified, but usually people are just being sloppy” is... a bit sloppy, since whether it is required is a matter of definition/convention. – Arturo Magidin Aug 05 '19 at 04:03
-
Maybe. “One problem with this definition is that it makes no real sense to ask if a given function is "surjective", because there is no understood "target set". You have to ask about "surjective onto $B$".” This is probably the reason why people specify codomain for most of time. – froyooo Aug 05 '19 at 04:05
-
“Most of [the] time” may be correct in your experience. What I’m saying is that you shouldn’t generalize from what you’ve seen to what “is”, nor should you generalize from what you think is better to what other people find more convenient or useful. Thus, if one does not specifiy a codomain, it is not necessarily matter of being “sloppy”, as you despectively claim. And there is no “maybe”: it is a fact that whether you need to specify a codomain or not depends on your definition of function and your conventions. Something isn’t wrong just because you don’t do it. – Arturo Magidin Aug 05 '19 at 05:02
-
All I’m trying to get you to realize is that your answer and comments shouldn’t be that absolute or judgemental; what you describe as “sloppy” and “abuse of notation” is not necessarily either. – Arturo Magidin Aug 05 '19 at 05:06
-
It is very common that people specify the codomain in the very first definition and omit for the rest. It happens everywhere, in textbooks, exams, and papers. That are NOT using different definitions, they are just BEING SLOPPY. Besides, I am pretty sure the OP is in the context of calculus but not set theory, and also OP is confused since they saw functions with and without codomain specified in the same context, say in the same class or book. They are not trying to switch between alternative definitions. They are being SLOPPY. – froyooo Aug 05 '19 at 05:17
-
I do not want to extend this in comments. You could post an answer disagreeing with me. – froyooo Aug 05 '19 at 05:17
-
I’ll put up my 30+ years of experience writing and reading math against your impressions. But if you want to continue to be judgemental instead of correct, be my guest. Yelling doesn’t make you more right. Finally, in Calculus it is very common to specify that functions will be real valued of real variable, which means the codomain is given implicitly, and omitting it is not “sloppiness”, but a matter of conventions agreed upon ahead of time. – Arturo Magidin Aug 05 '19 at 05:19