What exactly is an arrow in a category?

There are already many excellent answers, but I want to add another perspective, already partly found in other answers, but I hope distinct enough to stand on its own.

I like to explain by analogy. Consider the question, "What is a vector?"

What is a vector?

Well, you might get you any of the following informal definitions as a response:

(a) a list of numbers, (b) a quantity with magnitude and direction, (c) a quantity that transforms like a vector under a change of coordinates.

(I think I might know some physicists who would take issue with me calling (c) informal, but oh well).

And you might then ask, well ok, but what's a formal definition of a vector?

Let's think of some examples of vectors. The elements of $\Bbb{R}^3$, the elements of $\Bbb{R}[x]$, continuous functions from $X$ to $\Bbb{R}$, where $X$ is a topological space. These seem like fairly different objects, but the common factor here is that a vector is simply an element of a set $V$ with a specified vector space structure. I.e., the formal definition of vector is simply an element of a vector space.

Why is this useful as a definition? Well, all of the properties of vectors are already encoded in the definition of vector space. So if I tell you that $v,w$ are vectors in $V$, and $r\in\Bbb{R}$ is a scalar, then you know that $v+w$ is also a vector, and that $rv$ is a vector, and that $r(v+w)=rv+rw$. All the properties of a vector that we might find interesting are encoded in the vector space axioms.

Note also that part of this means that it's meaningless to say $v$ is a vector on its own. It's only meaningful to say that $v$ is a vector of some vector space $V$. This is good, because as an element $v$ might belong to many different vector spaces with different structures, but depending on the ambient vector space structure, $v$ might behave completely differently.

Bringing it back to arrows

Similarly, if I say $f:X\to Y$ is an arrow of a category $\mathcal{C}$. The rigorous definition of arrow here is simply that $f$ belongs to the collection of arrows $\operatorname{Arr}(\mathcal{C})$, and that the domain of $f$ is $X$ and the codomain of $f$ is $Y$. All of the other interesting properties of arrows (for example that I could compose $f:X\to Y$ with an arrow $g:Y\to Z$ to get an arrow $g\circ f:X\to Z$) are already encoded in the axioms of the category $\mathcal{C}$, and there's no need to say anything further to define arrows.

Edit:

Since comments are not permanent, I just want to edit in the link from Ethan Bolker's comment, to an excellent answer with a similar viewpoint to this one in reply to a similar (in spirit) question about "what actually is a polynomial?" The second paragraph in particular really captures what I wanted to say in my answer, (paraphrasing Ethan's answer) what really matters isn't what something actually is, but rather how it behaves.


$\text{Hom}_C(A,B)$ can be literally any set you want and has nothing at all to do with functions $A \rightarrow B$, as long as you define what "composing" arrows means and there is an identity arrow for each object you have a category, your set of arrows can be literally any set you want. Same goes for your collection of objects. Just to get my point across (risking sounding ridiculous) I will give an extreme example.

I can define a category $\mathcal C$ where there are two objects, "Apple" and "Banana" and we define

$$\text{Hom}(\text{Apple}, \text{Banana}) = \{x \in \mathbb N: \text{The word "father" is mentioned on page } x \text{ in the bible}\}$$

$$\text{Hom}(\text{Banana},\text{Apple}) = \emptyset$$

$$\text{Hom}(\text{Banana},\text{Banana}) = \text{Hom}(\text{Apple},\text{Apple}) = \{*\}$$

We define composition in the only way possible letting $*$ be an identity arrow for both "Apple" and "Banana".

Here an arrow in $\mathcal C$, $\text{Apple} \rightarrow \text{Banana}$ is a natural number.

An example of a collection of objects and arrows that does not form a category (again, at the risk of sounding ridiculous) is if the objects of $\mathcal D$ is the people on earth and an arrow $X \rightarrow Y$ is a date that $X$ has shaked $Y's$ hand on. Yesterday I met my professor so there is an arrow $$\text{(27th of march 2020)}: \text{Noel} \rightarrow \text{Noel's professor}$$

Let's say that there is an arrow $X \rightarrow Y$ and an arrow $Y \rightarrow Z$ in $\mathcal D$, can we even guarantee that there exists an arrow $X \rightarrow Z$? We can't since $X$ hasn't necessarily shaked $Z's$ hand.

Does this get my point across? I will give a more mathematical example of a category where morphisms aren't in any way functions. The category $\textbf{Set}^{op}$ has objects all the sets and we define an arrow in $\textbf{Set}^{op}$ $A \rightarrow B$ to be a function $B \rightarrow A$ in $\textbf{Set}$. That's enough examples! Hope you understood.


I recall a really fun talk at a topology conference sometime in the late 1980s/ early 1990s. The speaker said "we're going to take as objects in a category the set of finite collections of evenly-distributed points on the $x$-axis between $x = 1$ and $x = 2$ -- we might have 3 points or 12 points or ...whatever."

OK, so far I was following him. Then he said "and a morphism in this category will be a braid arranged thus":

enter image description here

where the locations and directions of over- and under-crossings was arbitrary. He then went on to talk about natural transformations from this category to various others, developing knot polynomials in a remarkably abstract way. I have no idea whether anyone still does this sort of thing, but at the time, it was kinda mindblowing to see something so very concrete as a 'morphism'. I leave it to you to guess how composition of morphisms was defined...