Why is $\sin : \mathbb{R} \to [-5,5] $ different from $\sin : \mathbb{R} \to \mathbb{R}$? My teacher says these two functions are different, why though?
$$\sin : \mathbb{R} \to [-5,5] \tag{1}$$
$$ \sin : \mathbb{R} \to \mathbb{R} \tag{2} $$
Both have the same domain and range. What difference does changing the codomain make here, so long as I keep the codomain as a superset of the range?
More generally speaking, $f : A \to B $ and $f: A \to C$ where $B$ and $C$ are the codomain of the same function $f$ and are supersets of range of $ f$
What difference would that make? How would changing the codomain (in this case) mean the functions are different? Isn't the function $f$ the same?
 A: The difference that changing the codomains make is that you've changed the codomain; you no longer have what you started with.

There are actually two main conceptions of the notion of "function" floating around. For lack of a better name, I will call them the "typed" and the "untyped" version.
In the typed notion of function, the types of the input and output argument of a function are part of its identity. The fundamental concept here is "a function from A to B", so if you change B you're talking about something different. When one just says "function", that there is an A and a B associated to the function is still implicit; e.g. the specific choice of A and B can be deduced from context, or maybe we're saying something that will be true no matter what A and B are.
In the untyped notion of function, which I will just call a "graph", it's not bound to types; it's often conceived simply as a set containing possible input-output pairs. Given any pair of sets $A$ and $B$, we can ask if a graph can be construed as a function from $A$ to $B$. This is, I think, the notion you have in mind.
Your teacher is using "function" in the typed sense; you have in mind the notion of a graph instead.
A: As discussed in detail here, a function is a triple


*

*a first set $A$ (domain)

*a second set $B$ (codomain)

*a law (i.e. a rule, a relationship, etc.) such that at each element of $A$ is associated one and only one element of $B$ that is 
$$\forall x\in A \quad \exists ! y\in B:\,y=f(x)$$
Therefore in that case


*

*$\sin : \mathbb{R} \to [-5,5] $

*$ \sin : \mathbb{R} \to \mathbb{R} $


are different functions since they have different codomain.
To appreciate that definition consider the case


*

*$f(x)=x^2 \quad \mathbb{R} \to \mathbb{R}$

*$f(x)=x^2 \quad \mathbb{R^+} \to \mathbb{R}$
in that case the "law" is the same but only the second one is bijective and invertible.
Therefore when we define a function it is always necessary, in order to have a complete definition, to declare also its domain and codomain.
A: To say that the two functions are the same is only telling half the story. Functions are described as injections, surjections, and bijections, and which of these depends on the function's invertibility.
When we talk about injections, etc, we focus on the co-domain because, by default, all the elements of the domain are subject to the function.
An injection is where an element of the co-domain has at most one element of the domain mapped to it. Note that "at most one" includes none. That is, all the elements of the domain are mapped to only one element of the co-domain, but there may be elements of the co-domain that have no mapping with the domain.
A surjection is where an element of the co-domain has at least one element of the domain mapped to it. Note that "at least one" implies that all elements of the co-domain are mapped by the domain, hence the alternative word for this being "onto". So with a surjection all the elements of the domain are mapped to all the elements of the co-domain but more than one element of the domain could be mapped to the same element of the co-domain.
A bijection is both an injection and a surjection. Hence, the phrases "at most one" and "at least one" can only be combined into the phrase "one, and only one".
When it comes to invertibility, remember that a function's domain, by default, includes all the elements. Thus, because an injection may not map the domain to all of the co-domain, invertibility may need modification of the co-domain to become the domain of the inverse. On the other hand, a surjection includes all the elements of the co-domain so the inverse has this as the domain, but these elements may map to more than one element in its co-domain, the previous domain. So, the elements of the inverse's co-domain would map to at least one element (in fact only one) of its domain, and so would be a surjection. Of course, a bijection would be a one-to-one mapping with the inverse.
Hence, a surjection and bijection should be easily inverted whereas an injection would need modification of the function's co-domain to become the inverse's domain.
In the case of the two functions quoted, clearly they are both injections not sur or bijections.
