Hi,

I have a question on Category Theory.

An identity morphism just maps an object back to itself but apparently, it’s not the only morphism that maps back to an object from the same object (right?). Can anyone explain what the other morphisms that map back to the same object do? How are they different from identity? Can they return a different value and how would that be possible?

Morphisms mapping an object to itself are the *automorphisms*. For example if your category is groups and object the integers, then `x`

mapping to `-x`

is an automorphism.

regards,

Siddhartha

If I’m correct, the identity has a specific property to satisfy, it’s that one morphism that from each object gets back to itself *and* composed with any other morphism `m`

will get you back that morphism, i.e.

```
id . m = m . id = m
```

Not every automorphism is an identity wrt composition.

As another quite common example, a *monoid* is any category where you only have 1 object, hence any morphism starts and ends on that object, but only 1 of them is the (required) identity

@ivanopagano dusting off the following slide as I read the monoid part of your comment: https://www2.slideshare.net/pjschwarz/how-monoids-map-onto-category-theory

A morphism from an object back to itself is an **endomorphism**. An **identity morphism** is an endomorphism with the property mentioned by @ivanopagano in which composing with it has no effect. Every object has at least one endomorphism (its identity) but it is not necessarily unique. Let’s take some examples.

- In the category of Scala types and functions (sometimes called
**Scal**) the objects are Scala types, the morphisms are functions, and composition is normal function composition. In this category the object`Int`

has an identity arrow`(a: Int) => a`

but it also has many other morphisms, like`(a: Int) => a + 42`

. - A
**monoid**is a category with a single object (therefore all morphisms are endomorphisms) of no interest, morphisms which are elements of the monoid, and composition which is some kind of combining operation. Concretely the integer monoid for addition has integers for morphisms and addition for composition. Zero is the identity morphsm, and every other integer is a non-identity morphism. - A
**preorder**is a category where there is at most one morphism between any pair of objects. The category of Scala types and subtypes (where objects are Scala types, morphisms are the subtyping relationship`<:`

, and composition is transitivity of subtyping) is an example of a preorder. In preorders the identities are the only endomorphisms, because they must exist but there can be no more than one.

Hope this helps.

rob

PS - A morphism that has an inverse (such that `f . f⁻¹ = id`

) is an **isomorphism**. An endomorphism that is also an isomorphism is an **automorphism**. What we’re talking about here applies to endomorphisms in general, not just automorphisms.