# Can two functions with different codomains be equal?

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?

-

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.
Similarly, the inclusion $\mathbb Z\to\mathbb R$ is for some purposes different from the identity map $\mathbb Z\to\mathbb Z$.