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:
- the function $f(x)=2x$, with the domain A=[1,2] and codomain B=[2,4]
- the function $f(x)=2x$, with the domain A=[1,2] and codomain B=[0,100].
- Strictly, formally, that is two different functions, right?
- Actually the former one is a surjective function, and the latter is not, right?