A function must have to consider about its domain and codomain

functionsgeneral-topology

From the book principle of mathematical analysis define 2.1:

Consider two sets $A$ and $B$, whose elements may be any objects whatsoever, and suppose that with each element $x$ of $A$ there is associated, in some manner, an element of $B$, which we denote by $f(x)$. $f$ is said to be a function from A to B(or a mapping of A into B )

My understanding:
when we talk about a function, formally, we have to specify the domain $A$ and the codomain $B$.

Example:

  1. the function $f(x)=2x$, with the domain A=[1,2] and codomain B=[2,4]
  2. the function $f(x)=2x$, with the domain A=[1,2] and codomain B=[0,100].
  3. Strictly, formally, that is two different functions, right?
  4. Actually the former one is a surjective function, and the latter is not, right?

Best Answer

To a set theorist the examples are the same function. In set theory a function IS its graph (as set theorists want everything to be a set). With this definition, a function can be said to be injective/surjective/bijective from its domain to a specified co-domain.

Your example is surjective to $[2,4]$ but not to any other set.

Anther term is the image of a function $f$, which is $\{y: \exists x\,(\,(x,y)\in f\}$. Note that "$\in f \,$" means "in the graph of $f $ ".