# Why it is necessary to mention the domain and codomain of function as part of its definition?

Relations are defined, without mentioning its domain and codomain, as,

Relation is a set of ordered pairs.

Intuitively a function is a non one-to-many relation. But additionally the definition of function has the domain and codomain in it. One possible definition is,

A function $f$ from $A$ to $B$ is a non one-to-many relation such that $\mathbf{Dom}(f) = A$ and $\mathbf{Ran}(f) \subseteq B$.

Why can't we just say

function is a non one-to-many relation

and then we may introduce the domain and codomain (as we usually do for relations). Afterwards we shall continue to speak about surjection, bijection, inverse, composition, etc.

• "Relations are defined, without mentioning its domain and codomain" No, they aren't. "Relation is a set of ordered pairs." Ordered pairs of what? If these are so defined it is because the domain and range are implicitly assumed. "But additionally the definition of function has the domain and codomain in it." They are required. They are also required for relations. But I've seen them both where it was implied."Why can't we just say "function is a non one-to-many relation". We can. And it is. But it's very confusing. Especially to novices. – fleablood May 27 '17 at 3:39
• @fleablood At least the condition $\mathbf{Dom}(f) = A$ is needed, because relations have no such restriction, right? – Durgadass S May 27 '17 at 6:59

## 1 Answer

The domain can be directly extracted from the set of ordered pairs version of the function. It is important enough that we usually prefer to isolate it anyway, but there would be no loss in the domain being a "function" of the function (namely $\operatorname{Dom}(f)=\{ \operatorname{First}(t) : t \in f \}$) rather than a "data field" in the definition of a function (e.g. $\operatorname{First}(f)$).

The codomain cannot be extracted from the ordered-pair version of the function. The range can, of course, but we like to think of the range and the codomain of a function as distinct objects. This simplifies a lot of things. In particular, the notion of surjection makes no sense without it. Moreover it allows us to speak of all functions with a given domain and codomain (e.g. all real-valued functions of a real variable) without regard to their range.

Note that all of the above is still true of relations; they should really be thought of as a triple of domain, codomain, and set of ordered pairs. But the issue is less important in the setting of general relations.

• Thanks. Don't we need an analogy of surjection for a relation? – Durgadass S May 27 '17 at 3:44
• @DurgadassS In fact relations also usually have separately defined domain and codomain, so that indeed you have a notion of a surjective relation (although I don't know of any applications of the concept). I didn't point this out because you gave a definition of relation in your question. – Ian May 27 '17 at 3:46
• Yes that's right. But I mistook that the codomain and range are same in relations. – Durgadass S May 27 '17 at 4:00