CATEGORIES-Functions of sets
We begin by considering functions between sets. I am not going to say here what a function is, anymore than what a set is. Instead, we will assume a working knowledge of these terms. They can in fact be defined using category theory, but that is not our purpose here.
Let f be a function from a set A to another set B, we write
f : A → B.
To be explicit, this means that f is defined on all of A and all the values of f are in B. In set theoretic terms,
range(f) ⊆ B.
Now suppose we also have a function g : B → C,

then there is a composite function g ◦ f : A → C, given by
(g ◦ f)(a) = g(f(a)) a ∈ A. (1.1)
Now this operation “◦” of composition of functions is associative, as follows. If we have a further function h : C → D
and form h ◦ g and g ◦ f, then we can compare (h ◦ g) ◦ f and h ◦ (g ◦ f) as indicated in the diagram given above. It turns out that these two functions are always identical,
(h ◦ g) ◦ f = h ◦ (g ◦ f)
since for any a ∈ A, we have
((h ◦ g) ◦ f)(a) = h(g(f(a))) = (h ◦ (g ◦ f))(a)
using (1.1).
By the way, this is, of course, what it means for two functions to be equal: for every argument, they have the same value. Finally, note that every set A has an identity function
1A : A → A given by 1A(a) = a.
These identity functions act as “units” for the operation ◦ of composition, in the sense of abstract algebra. That is to say,
f ◦ 1A = f = 1B ◦ f for any f : A → B.
These are all the properties of set functions that we want to consider for the abstract notion of function: composition and identities. Thus, we now want to “abstract away” everything else, so to speak. That is what is accomplished by the following definition.