# Is equality relation a function?

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?

• Not sure who told you this, but it is definitely a function (called the identity function). Commented Sep 23, 2016 at 12:24
• 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 ...".
– Ian
Commented Sep 23, 2016 at 12:29
• Commented Sep 23, 2016 at 12:30
• 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?
– john
Commented Sep 16, 2022 at 7:35

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.