TITLE: Sin(x): surjective and non-surjective with different codomain?
QUESTION [5 upvotes]: Statement that $\operatorname{sin}(x)$ not surjective with codomain $\mathbb R$ and surjective with codomain $[-1,1]$ found here:

Non-surjective: $\mathbb{R}\rightarrow\mathbb{R}: x\mapsto\operatorname{sin}(x)$
Surjective: $\mathbb{R}\rightarrow[-1,1]: x\mapsto\operatorname{sin}(x)$

where the image $Im(f)=[-1,1]$ in both cases and the codomain is $\mathbb R$ and $[-1,1]$ for the case 1 and case 2, respectively. In the second case, $\forall x\in\mathbb R : \operatorname{sin}(x)\in [-1,1]$ where the codomain equals the image of $f$. Surjection means that the image of the function equals to the codomain.
Why is sin not surjection with one codomain and surjective with other codomain?

REPLY [8 votes]: The functions $\operatorname{sin}:\mathbb R\rightarrow \mathbb R$ and $\operatorname{sin}: \mathbb R\rightarrow [-1,1]$ are two different functions. In mathematics, a function is usually defined as the collection of the following data:

Specifying the domain X (a set)
Specifying the codomain Y (a set) 
A relation on $X\times Y$ satisfying certain properties

and so the mathematical function can be understood as an ordered triple set $\{X,Y,R\}$ where $R$ is the relation such as $X\times Y$. The usual notation is $f:X\to Y$.
In this strict sense, the string ''sin'' can represent infinitely many different functions, depending on the choice of domain and codomain. Some of them are surjective, injective, bijective, or none if that. For example, $\sin: [0,1]\to\Bbb R$ is injective but not surjective, $\sin: \Bbb R\to [-1,1]$ is surjective and not injective, $\sin: [-\pi/2,\pi/2]\to [-1,1]$ is bijective and so on.
However, that's not the whole story. In physics and engineering, one often ignores the specification of domain or/and codomain and assumes that it is understood from the context. In this sense, ''$\sin x$'' is an assignment that to a real number $x$ assigns $\sum_{i=0}^{\infty} (-1)^{i}\frac{x^{2i+1}}{(2i+1)!}$. Here you don't care about domains and codomains. This is often good enough for practical considerations. But from the formal viewpoint, it doesn't make sense to ask whether this ''function'' $\sin$ is surjective, if you don't specify the domain and codomain.