Why is $\sin : \mathbb{R} \to [-5,5] $ different from $\sin : \mathbb{R} \to \mathbb{R}$? [duplicate]

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?


Solution 1:

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.

Solution 2:

As discussed in detail here, a function is a triple

  1. a first set $A$ (domain)

  2. a second set $B$ (codomain)

  3. 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.