# Does the definition of a bijection and surjection not depend on our definition of the range?

I have been reading the real analysis textbook, and in Section 1.2 the definitions of injections, bijections and surjections are discussed. However, doesn't the definition of some of these terms rely on our definition of the domain and range of the function?

As far as I understand it, and correct me if I'm wrong, we can define the range in any way we like, so long as the image of the domain is a subset of this set.

For example, given the Dirichlet function, which maps the set of real numbers (domain) to the set $$\{0,1\}$$ (image), we could actually define the range as $$\mathbb{R}$$ or indeed anything else we liked so long as the image was contained within it. How does it then make sense to define the terms surjection and injection, given we could also conceivably define the range as the set $$\{0,1\}$$, changing the function from not being a surjection to being a surjection?

• regarding "changing the function from being an injection to being a surjection": injection is not the opposite of surjection, it means one-to-one Feb 27, 2020 at 19:51
• Yes, to define a bijection (injection, or surjection) from $X\to Y$ you need to specify $X$ and $Y$. In many contexts, of course, $X$ and $Y$ are understood, so people may neglect to specify them clearly.
– lulu
Feb 27, 2020 at 19:51
• @J.W.Tanner Yes... Thanks, sorry - I'll clarify this in the question. Feb 27, 2020 at 19:53
• @lulu Regarding this, are there a particular set of sets e.g. $\mathbb{R}$ that are commonly regarded as those we are assuming when looking at functions? Feb 27, 2020 at 19:54
• Oh, there are plenty of "commonly used" sets, but I would always look to the specific context.
– lulu
Feb 27, 2020 at 19:55

What you are calling the range would more commonly be called the codomain of the function (the range is then defined as the image of the domain, i.e. for $$f:A\to B$$, the set $$\{f(x) : x\in A\}$$. With this in mind, the answer is:

• yes, whether a function is surjective depends on the codomain.
• no, whether a function is injective does not depend on the codomain (it depends on the domain)*

For example, the function $$f:\mathbb R \to \mathbb R$$ defined by $$f(x)=x^2$$ is not a surjection. But the function $$g:\mathbb R \to \mathbb R^+ \cup \{0\}$$ defined by $$g(x)=x^2$$ is a surjection.

In general, this is why we ought to specify the domain and codomain whenever we define a function: the functions $$f$$ and $$g$$ above are different functions even though they map the same inputs to the same outputs. Surjectivity is a property of a function fully defined, rather than something that can be determined just from the inputs and outputs.

Indeed, sometimes we rely on these facts in order to make a function invertible. For example, $$\sin:\mathbb R \to \mathbb R$$ is neither injective nor surjective, and hence does not have an inverse function. However, if we restrict it to the function $$\sin: [-\frac{\pi}{2}, \frac{\pi}{2}] \to [-1,1]$$ the new function is bijective and we can obtain $$\sin^{-1}$$.

*A sketch proof. Consider $$f:A\to B_1$$ and $$g:A\to B_2$$ where $$f(x)=g(x)$$ for all $$x \in A$$, and ensuring that $$f(A)\subseteq B_1,B_2$$ (a function cannot be defined with a codomain that does not include the range, so this assumption is not problematic). $$f$$ is injective iff $$f(a_1)=f(a_2) \Rightarrow a_1=a_2$$, and $$g$$ is injective iff $$g(a_1)=g(a_2)\Rightarrow a_1=a_2$$. But since $$f$$ and $$g$$ map $$a_1$$ and $$a_2$$ to the same elements of the range, these criteria are equivalent so $$f$$ is injective iff $$g$$ is. Hence injectivity does not depend on the choice of codomain.

• Thanks for this answer. The sketch proof for injectivity not depending on the codomain also looks reasonable. Feb 27, 2020 at 20:30
• @Requiens Happy to help! It was good to refresh my thinking on these and get a bit of practice in. Feb 27, 2020 at 20:32