Let's consider a relation $R \subset N \times N$, where $N$ is the set of natural numbers.

According to the definition (correct me if I'm wrong) a function is a special case of relation, which satisfies an additional condition that each element of the domain is related to exactly one element of the codomain.

Now, let's assume $R = \{(a,a) | a \in N\}$, so $R$ is basically an equality relation on natural numbers. It's easy to check that it also meets the condition mentioned above. So, in my understanding, it should be a function. Still I was told that it's actually not (and apparently it has something to do with the reference).

So, is it a function, or not? If not, why?

  • 3
    $\begingroup$ Not sure who told you this, but it is definitely a function (called the identity function). $\endgroup$ Commented Sep 23, 2016 at 12:24
  • $\begingroup$ If we think of functions as being a special kind of relation, then yes, the equality relation is a function, and it is more commonly called the identity function in this context. Some caveats: 1. sometimes it is awkward to think of functions as a special kind of relation, and it is easier to think of them as their own "primitive". From this perspective the equality relation and identity function are "different objects". 2. it is useful to think of the equality relation as a relation sometimes, because you can imagine relations which are "$xRy$ if $x=y$ or ...". $\endgroup$
    – Ian
    Commented Sep 23, 2016 at 12:29
  • $\begingroup$ see: en.wikipedia.org/wiki/Identity_function $\endgroup$ Commented Sep 23, 2016 at 12:30
  • $\begingroup$ It seems redundant to call the identity relation an equivalence relation. But yes, 'identity' is an equivalence relation on pretty much any object. I mean, what object isn't identical or equal to itself? $\endgroup$
    – john
    Commented Sep 16, 2022 at 7:35

1 Answer 1


If you have defined equality on a domain and codomain, where the domain is equal to the codomain, then you have a function. It is called an identity function, and is often denoted $I$, $\mathbf I$, or $\operatorname {id}$, or similar.


$$I: X \to X; I(x) = x$$

However, the symbol $=$ is often defined on everything, even things that are "too big" to be sets. So the "relation": $\mathcal{R}(x,y) : x=y$ might work even if the "domain" of $\mathcal R$ is something like "everything", in which case $\mathcal R$ might not be a relation in the typical sense.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .