Functions – Can Two Functions with Different Codomains Be Equal?

functions

I'm looking through some lecture notes, and found that the author defined two functions f and g to be equal if:

  • they have the same domain, say S,
  • they have the same codomain, and
  • f(x)=g(x) for all x in S.

This seems peculiar to me. In the notation of relations, for instance, this implies that

  • the relation $R=\{(t,\sqrt{t}): t \in \mathbb{R}^{\geq 0}\} \subseteq \mathbb{R}^{\geq 0} \times \mathbb{R}$ and
  • the relation $R'=\{(t,\sqrt{t}): t \in \mathbb{R}^{\geq 0}\} \subseteq \mathbb{R}^{\geq 0} \times \mathbb{R}^{\geq 0}$

are not equal (despite $R=R'$).

Question: Is there any reason to define two functions as non-equal based solely on their codomains?

Best Answer

It can be convenient to require that codomains are part of the definition of a function. For example, when speaking of surjectiveness: If $f=g$ and $f$ is surjective, then $g$ is surjective, but only if we are careful to require that equality implies having the same target set.

The first function you defined is not surjective. The second one is, and in fact it is invertible.

Similarly, the inclusion $\mathbb Z\to\mathbb R$ is for some purposes different from the identity map $\mathbb Z\to\mathbb Z$.

It is true that in many contexts it hardly matters. You might be interested in this MathOverflow question coming from a case where the distinction was considered important.