2

If I define a function with a domain such that its range is bigger than its codomain, is it necessarily ill-defined?

For example, consider $f: \mathbb{R} \rightarrow \mathbb{Z}\\ f(x) = x.$

Clearly, some values of $f(x)$ are not in the codomain; can I ignore/forbid these values by restricting the codomain to the integers, that is, can I allow the function to return outputs only when they are integers? Or would this function not be well-defined or, indeed, a function at all?

ryang
  • 38,879
  • 14
  • 81
  • 179
  • No. Each point in the domain needs to have an image. – K. Jiang Sep 08 '23 at 03:21
  • 1
    That is not a function. – user10354138 Sep 08 '23 at 03:21
  • 2
    For your function $f : {\bf R} \rightarrow {\bf Z}$, what value would, say, $f(\pi)$ have? – Paul Tanenbaum Sep 08 '23 at 03:22
  • 2
    By "restricting the codomain to the integers", you probably mean "restricting the domain to the integers". – Anne Bauval Sep 08 '23 at 03:23
  • @PaulTanenbaum I wondered whether it was permissible for a function to just "not return/output anything", but I now realise that wouldn't be at all well-defined. Thank you all for your comments. – Gonzalo Mugarra Sep 08 '23 at 03:27
  • @AnneBauval I did mean for the codomain to be restricted without necessarily restricting the domain, but I realise now that it would lead to issues (i.e., what would the output be should the input not be an integer) and would therefore not result in a well-defined function – Gonzalo Mugarra Sep 08 '23 at 03:29

3 Answers3

0

You cannot define a function formula "$f$" first, and then "restrict" to the "codomain".

The range must be smaller than the codomain.

To define a function, first you define the domain and codomain:

$f:R\to Z$

Then you define the actual variables and forumla that entails the relation:

$f:x\mapsto y.$ where $y=f(x)$.

You cannot do step 2 first and then step 1.

The codomain is the set that $y$ belongs to, which is $Z$ in your case. The range is the collection of all $y$

$f(x)=x$ is not part of $f:R\to Z$. Your example is not function.

dodo
  • 766
  • 1
    Why talk about defining a function, let alone doing so in steps? A function is simply a set $f$ of ordered pairs $(a,b) \in A \times B$ for sets $A$ and $B$ such that whenever $(a,b), (a,c) \in f$, we have $b=c$. Its range is ${y|(x,y)\in f ; \mbox{for some} ; x\in A}$, and can be equal to $B$. – Paul Tanenbaum Sep 08 '23 at 03:40
  • @PaulTanenbaum You are correct. My point is you have to define sets $A$ and $B$ first, then you define the product $A\times B$, then you define a 2-tuple $(a,b)$ and their relation. – dodo Sep 08 '23 at 03:41
  • No, you don’t. Any set of ordered pairs that “passes the vertical-line test,” as it were, can be thought of as a function. Its domain is simply the set of all the first elements and its range is the set of all the second elements. Some authors wouldn’t distinguish, for instance, between $f:{\bf Z}\rightarrow{\bf Z}$ with $f(n) = n$ and $g:{\bf Z}\rightarrow{\bf R}$ with $g(n) =n$. – Paul Tanenbaum Sep 08 '23 at 03:49
  • This answer seems incomplete without the definition of a function; it is unclear from this answer why this "function" isn't a valid function. – David Raveh Sep 08 '23 at 05:33
  • @PaulTanenbaum They are not distinguished for convenience. I'd say it is the usual abuse of notation. They are clearly different functions. – dodo Sep 08 '23 at 08:49
0

Can a well-defined function have a smaller codomain than range?

No well-defined function has a smaller codomain than range.

Consider $f: \mathbb{R} \rightarrow \mathbb{Z}\\f(x) = x.$

can I ignore/forbid these values by restricting the codomain to the integers, that is, can I allow the function to return outputs only when they are integers?

Given the above ill-given "function" $f$ with its codomain $\mathbb Z,$ how exactly would you forbid non-integral outputs like $7.5?$

We can essentially do this by simply narrowing down its domain $\mathbb R:$ $$f_\text{well-defined I}: \mathbb{Z} \rightarrow \mathbb{Z}.$$

We can even expand its codomain $\mathbb Z$ so that it contains superfluous values: $$f_\text{well-defined II}: \mathbb{Z} \rightarrow \mathbb{R}.$$

ryang
  • 38,879
  • 14
  • 81
  • 179
0

To properly answer this question, one needs to define what a function is. Given two sets $A,B$ , a relation between $A$ and $B$ is a a subset of the cartesian product of $A$ and $B$: $$R\subset A\times B=\{(a,b)\,|\,a\in A,\,b\in B\}.$$ A function is a relation with the properties: $$\text{for all } a\in A,\text{there exists }b\in B\text{ such that }(a,b)\in R$$ $$\text{for all } a\in A,\text{ if both } (a,b) \text{ and } (a,b')\in R,\text{then }b=b'$$ The latter property guarantees unique output $b$ for given input $a$ (vertical line test), while the former property guarantees that every $a\in A$ is mapped to some $b\in B$.

Clearly, what you propose violates the second property of a function.

David Raveh
  • 1,795
  • First you need to define what is $A$ and what is $B$. Then you define the relation $R$. – dodo Sep 08 '23 at 08:52