Are there standards for defining the codomain of a function? 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?
 A: 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.
A: 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}$.
