# 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?

• The function are the same if and only if the domain, the codomain and the correspondence all agrees.
– xbh
Jul 30, 2018 at 11:17
• @nicomezi alright lemme change the question a little bit, that's not what I was asking for. Jul 30, 2018 at 11:22
• It is on the eye of the beholder. Following strictly the definition of function, these two are the same set of pairs. However, viewed as morphism (arrows) between sets, they are two arrows between two different pairs of sets. Whether to view it as one or the other, depends on whether you want to study the function in itself, or the arrow between sets.
– user580373
Jul 30, 2018 at 11:25
• @William That is because you haven't had enough experience with it. Many definitions very much depend on who you are talking with. I invite you to look at the definition of function and the definition of set, applied to the relation $f$, and see if it follows that these two are equal or not. The funny thing is, that probably your teacher gave you that definition of function and didn't notice that it does imply that those two are equal.
– user580373
Jul 30, 2018 at 11:34
• Depends on the definition of "function" that is given in your class. In some classes/books, a function is an ordered triple (f,A,B) where A and B are sets and f is a certain subset of the Cartesian product of A and B. (If this is the definition then f is sometimes called the "graph" of (f,A,B).) With this definition, changing the set B certainly changes the function since the ordered triple is changed. One reason for defining a function as an ordered triple like this is to make a sensible definition of a "surjective function." Whether or not (f,A,B) is surjective depends on the B chosen. Jul 30, 2018 at 14:55

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.

• In my opinion, the untyped version is a somewhat old fashioned notion, developed in a time before we really understood types and how to incorporate them in logic and calculation.
– user14972
Jul 30, 2018 at 11:41
• Untyped version is (still) very popular in set-theory. Jul 30, 2018 at 11:46
• @drhab: I don't find that surprising; I consider material set theory to basically be a foundation for untyped logic and reasoning. I imagine structural set theorists prefer the typed version, though.
– user14972
Jul 30, 2018 at 11:49
• Here's an example on math.stackexchange of set theorists discussing functions using only the untyped definition. The answer of @AsafKaragalia here includes both the typed and untyped versions. Jul 30, 2018 at 12:38
• @LeeMosher: Material set theory puts the focus on elements, structural set theory on the interrelationships between sets. Rather than try to explain in detail myself, I'll link to nLab's pages on structural set theory and material set theory.
– user14972
Jul 30, 2018 at 12:53

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.

• Good point in mentioning bijective. Every function is surjective onto its range, and for every function, we can give a codomain for which it is not surjective. Thus, the term "surjective" is meaningful only if the codomain is given.Although generally, if no codomain is given, it's assumed to be the same as the domain. Jul 30, 2018 at 16:19
• @Acccumulation Thanks for the appreciation! Bye
– user
Jul 30, 2018 at 16:38
• If we change the $[-5,5]$ in the original pair of functions to $[-1,1]$ then the first function is surjective (onto) but the second is not. If you regard them as the same function then you have to say that sometimes is surjective and sometimes it isn't. As Accumulation mentions, this could be done for any function so surjective would become a rather useless word. Jul 30, 2018 at 18:23
• @badjohn Exactly, thanks so much for your considerations! Bye
– user
Jul 30, 2018 at 22:48
• But in your example, the two functions have different ranges, so of course they are different. Jul 30, 2018 at 22:48

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.

• What if I've been just given the function without it's domain and co-domain, how will I figure out whether the function is invertible or not? Can't jjst assume it's invertible and proceed right? Aug 3, 2018 at 11:12
• Functions don't appear out of thin air: their creator or specifier will have a domain and co-domain in mind, else it's a poorly defined function. You need a domain and co-domain, else wise you're only guessing what they might be. Aug 4, 2018 at 13:58