Category Theory/Printable version
This is the print version of Category Theory You won't see this message or any elements not part of the book's content when you print or preview this page. 
The current, editable version of this book is available in Wikibooks, the opencontent textbooks collection, at
https://en.wikibooks.org/wiki/Category_Theory
Definition, examples
Definition (category):
A category is a class of objects, together with a class of socalled morphisms, each of which have a domain and a target, and a composition of morphisms, such that the following set of axioms hold, if for any two objects and of the subclass of morphisms with domain and target is denoted :
 Whenever either or , and are disjoint
 For any objects of and any morphisms and , there exists a morphism , called the composition of and
 Composition is associative, ie.
 Whenever is an object of , then there exists a unique morphism
Exercises[edit  edit source]
 If is injective, prove that is injective.
Natural transformations
Definition (natural transformation):
Let be categories, and let be two functors. A natural transformation between these two functors is a collection of morphisms of , one for each object of , namely , such that for all morphisms of , the following diagram commutes:
 diagram placeholder
Old content[edit  edit source]
One further basic notion in the theory of categories, or, as it may be said, a basic item of categorical language, will now be introduced. This is the notion of a natural transformation of functors from one category to another. Indeed, the whole language and apparatus of categories and functors were developed initially by the U.S. mathematicians Samuel Eilenberg and Saunders MacLane in order to render precise the intuitive concept of naturality. First an example will be given, the example that may be said to have motivated the definition.
Motivating example[edit  edit source]
Let be a vector space over some field , and let be the dual space of ; that is, the space of linear functionals on . There is then a linear transformation that is given. There is an intuitive feeling that the linear transformation is natural because its description only involves the terms u and f. Now if is finitedimensional, then it is known that is an isomorphism in the category of vector spaces over and linear transformations. One way of proving that is then an isomorphism is to show that and are isomorphic and then to observe that is one–one. The usual proof that and are isomorphic would be to proceed by establishing an isomorphism between and , in the case when is finitedimensional. Now if a base for is given, then a basis for may be set up, called the dual basis, by defining to be that linear functional on given by certain rules (see 350). Then the correspondence sets up an isomorphism between and .
On the other hand, this isomorphism does not look natural, because it depends on the choice of bases. Of course, the argument above could be generalized to set up a linear transformation from to * even if is not finitedimensional over , but, again, this transformation would not appear to be natural. What is required is a formal and precise expression of the feeling that, for finitedimensional vector spaces over the field , and are naturally isomorphic, while and are isomorphic in some unnatural way. Eilenberg and MacLane solved this problem in their seminal article, “General Theory of Natural Equivalences,” published in 1945, which laid the foundation of the theory of categories.
Duality[edit  edit source]
For any category a new category can be formed by interchanging the domains and codomains of the morphisms of . More precisely, in the category the objects are simply those of and the effect of interchange of domains is expressed in an equation (see 359). Moreover, the composition in is simply that of , suitably interpreted. is called the category opposite to ; notice that = . This apparently trivial operation leads to highly significant results when specific categories are used. In the general setting it enables any concept in the language of categories to be dualized. For example, the coproduct in is simply the product in . Any theorem that holds in an arbitrary category has a dual form. For example, the theorem asserting that the product in an arbitrary category is associative may be effectively restated as asserting that the coproduct in an arbitrary category is associative. In the special cases, however, the second statement looks very different from the first. For example, in the category of sets, the coproduct becomes the disjoint union; in the category of groups it is the free product; and in a preordered set regarded as a category, the coproduct is the least upper bound. In particular, for the set of natural numbers, ordered by divisibility, the coproduct is the LCM. Thus, the same universal argument that led to the deduction that the GCD is associative also indicates that the LCM is associative. The duality principle has very wide ramifications indeed. Here it is merely noted that the important concept of a contravariant functor may be most simply defined as a functor . Thus the association of the dual vector space with yields a contravariant functor from to itself.
Definition of natural transformation[edit  edit source]
Suppose , are two functors, both from the category to the category .
Then a natural transformation is a rule that assigns to each object A of category a morphism .
The morphisms involved must be subject to the condition that the diagram
should be commutative for every (note is a morphism in the category ); that is, (note the commutative diagram is drawn in category ).
Natural isomorphisms[edit  edit source]
Further, if is invertible for each A, then is said to be natural isomorphism (or a natural equivalence). It is clear that if is a natural equivalence from functors to , then , given by an equation (see 352), is a natural equivalence from functors to . Thus the term equivalence used here is fully justified. Indeed, the functors from to may be collected into equivalence classes according to the existence of a natural equivalence between them.
Examples[edit  edit source]
This definition can be tested against the example. Consider two functors from KVect to KVect, in which KVect is the category of vector spaces over the field K and linear transformations. One functor is the identity functor. The other functor is the double dual functor ** that associates with every vector space V its double dual V** and with every linear transformation f : U → V in the linear transformation f**: U** → V** (see 353). A linear transformation T: V → V** was described above. It is easy to check that T is a natural transformation from the identity functor to the functor **. If the subcategory f of KVect that consists of finitedimensional vector spaces over K and their linear transformations is considered, then it turns out that the functor ** transforms f into itself; and the natural transformation T, restricted to f, is then a natural equivalence. Further examples of natural transformations of functors can be given:
 The category of Abelian groups and homomorphisms is considered. With every Abelian group may be associated its torsion subgroup. The torsion subgroup AT of the Abelian group A consists of those elements of A that are of finite order. A homomorphism from A to B must necessarily send AT to BT. Thus a functor f is obtained from to (or to T, the category of torsion Abelian groups and their homomorphisms), by associating with every Abelian group A the Abelian group FA = AT. Now AT is a subgroup of A. Thus there is always an embedding iA of AT in A. It is easy to see that i is a natural transformation from the torsion functor f to the identity functor. Further, the quotient group Afr = A/AT may be considered. It is a torsionfree Abelian group. This gives a functor g from to (or from to fr, the category of torsionfree Abelian groups) by associating with the Abelian group A the Abelian group GA = Afr. Then the projection of A onto Afr yields a natural transformation from the identity functor to the torsionfree functor g.
 With every group may be associated its commutator subgroup. It is then not difficult to see that the embedding of the commutator subgroup in the group is a natural transformation from the commutator subgroup functor to the identity functor. On the other hand, the centre of every group may be associated with the group. Here, however, there is not a functor because a homomorphism from one group to another does not necessarily map the centre of the first group to the centre of the second. On the other hand, if the category of groups and surjective homomorphisms (a surjective homomorphism is one in which the image coincides with the codomain) is considered, then in this category the centre is a functor. It is a functor, however, from the category of groups and surjective homomorphisms to the category of groups and all homomorphisms, because a surjective homomorphism does not necessarily map the centre surjectively. Then the embedding of the centre of a group in the group may be regarded as a natural transformation from the centre functor to the inclusion functor, both of which are functors from the category of groups and surjective homomorphisms to the category of groups and homomorphisms.
 In algebraic topology, the singular homology groups and the homotopy groups of a pointed topological space (X, x) are considered. A Hurewicz homomorphism (see 354) exists, from the homotopy groups to the homology groups. Then pn and hn, n ≥ 2, are functors from the category of pointed spaces and pointed continuous functions to the category of Abelian groups, and the Hurewicz homomorphism is a natural transformation of functors.
The Yoneda lemma[edit  edit source]
Let be a locally small category, let be an object in , let , let denote the covariant Hom functor, and let denote the natural transformations from to . Then . In addition, if is another Hom functor , then .
(Co)cones and (co)limits
Definition (cone):
Let be a category and let be a diagram in . A cone over is an object of , together with morphisms for each , so that for each (so that ) we have
 .
Definition (limit):
Let be a category, let be a diagram in and let
Definition (diagonal):
Let be a category, and let be an object of . Further, suppose that the object and the morphisms and constitute a product of with itself in . Then the diagonal (also called "diagonal morphism") is the unique morphism
such that .
Definition (antidiagonal):
Let be a category, and let be an object of . Further, suppose that the object and the morphisms and constitute a coproduct of with itself in . Then the antidiagonal (also called "antidiagonal morphism") is the unique morphism
such that .
Exercises[edit  edit source]

 Let be a category such that every two objects of have a product. Suppose further that is another category, and that is a functor. Let be an object of . Use the universal property of the product in order to show that there exists a functor that sends an object of to the object of .
 Prove that any morphism in gives rise to a natural transformation .
 Can we weaken the assumption that every two objects of have a product? (Hint: Consider the image of the class function on objects associated to the functor .)
Adjoint functors
Definition (adjoint functors):
Let be categories. A pair of adjoint functors consists of two functors and (where is the left adjoint and is the right adjoint) such that the two bifunctors
 and
from to are naturally isomorphic to each other.
Proposition (left adjoint functors preserve epimorphisms):
Let be categories, and let and be an adjoint pair of functors. Suppose that and is an epimorphism. Then is also an epimorphism.
Proof: Let be arrows in so that .
Proposition (right adjoint functors preserve monomorphisms):
Subcategories
Definition (subcategory):
Let be a category. Then a subcategory of is a category such that and .
Definition (full):
A subcategory of a category is called full iff for all , we have
 .
Proposition (limits are preserved when restricting to a full subcategory):
Let be a category, let be a diagram in , and let be a full subcategory of . Suppose that is a limit over in such that and all targets of the are in . Then is a limit over in .
Proof: Certainly, the underlying cone of is contained within , because the subcategory is full. Now let another cone in over the diagram (which, analogously, is a diagram in ) be given. By the universal property of in , there exists a unique morphism which satisfies for all . Since is full, is in .
Analogously, we have:
Proposition (colimits are preserved when restricting to a full subcategory):
Let be a category, let be a diagram in , and let be a full subcategory of . Suppose that is a colimit over in such that and all domains of the are in . Then is a colimit over in .
Proof: This follows from its "dual" proposition, reversing all arrows in its statement and proof except the direction of the diagram functor.
Categories of ordered sets
Definition (category of preordered sets):
The category of preordered sets is the category whose objects are given by the preordered sets and whose morphisms are given by the order homomorphisms.
Definition (category of posets):
The category of posets is the category whose objects are the posets and whose morphisms are the order homomorphisms.
Directly from the definitions, we have:
Proposition (posets form full subcategory of preordered sets):
is a full subcategory of .
Proposition (products in the category of preordered sets):
Let be a family of preordered sets. Then a product of this family in the category is given by the set together with the product order, where the projections are given by the functions
 .
Proof: The functions are order homomorphisms, because if and , then by definition. Thus, we have a cone. Moreover, if the order homomorphisms define another cone, then as for the set product, the function given by
is the unique function from to such that for all , and it is an order homomorphism, because if , then for all we have .
Proposition (coproducts in the category of preordered sets):
Let be a family of preordered sets. Then a coproduct of this family in the category is given by the parallel composition of the , where the inclusions are given by the functions
 .
Proof: The are order homomorphisms by definition of the parallel order, so that we do have a cocone. Suppose now that the maps define another cocone in the category . Then the unique function such that for all is given by
as in set theory, and it is an order homomorphism because if , then by def. of the parallel order and consequently .
Proposition (products and coproducts in the category of posets):
In the category , products and coproducts are given by the respective products and coproducts in the category .
Proof: This follows since limits and colimits are preserved when restricting to a full subcategory.
Additive categories
Definition (biproduct):
Let be a category, and let be a family of objects in . A biproduct of is an object of that is usually denoted as
and for which there exist arrows
 and
for all that have the following properties:
 and
 , together with the morphisms , constitutes a coproduct in the category
 , together with the morphisms , constitutes a product in the category
Definition (additive category):
An additive category is a category that satisfies each of the following requirements:
 Every morphism in has a kernel and a cokernel
 For every two objects of , there exists a biproduct
 For every two objects of , the assignment , where is the morphism that arises from postcomposing the morphism (where shall denote the diagonal) with the antidiagonal , turns into an abelian group
Abelian categories
Proposition (object in abelian category is decomposed into sum by subobject):
Let be an abelian category, and let be an object. Let be a subobject, and let be the corresponding quotient object. Moreover, denote . Then there exists a unique isomorphism such that
 and .
Proof: is a biproduct. First we apply the universal property of a product in order to obtain a morphism
 such that and .
Then we apply the universal property of a coproduct in order to obtain a morphism
 such that and .
Moreover, we get a morphism from the projection to , and a morphism from the inclusion of . The latter morphism is the kernel of , and the cokernel of that kernel is
Categories
This is the Categories chapter of Category Theory.
Definition[edit  edit source]
A category consists of four kinds of data subject to three axioms, as listed below:
Data[edit  edit source]
 Objects
 has objects denoted by , , ,…
 Morphisms
 For each ordered pair of objects , in , there is a class of morphisms or arrows from to . The notation means that is a morphism from to . The class of all morphisms from to is denoted by or sometimes simply .
 Composition
 For each ordered triple of objects , , in , there is a law of composition: If and , then the composite of and is a morphism
 Identity
 For each object there is a designated identity morphism on , notated as , from to .
Axioms[edit  edit source]
These data satisfy the following three axioms, of which the first is in the nature of a convention, while the remaining two are more substantial:
 Unique typing
 and are disjoint unless , .
 Associative Law
 if the composites are defined. Note that if one composite is defined, the other is necessarily defined.
 Identity is a “neutral element”
 For the identity morphism associated to each object , two equations must hold for each pair of objects and and each pair of arrows , :
Terminology and fine points[edit  edit source]
 If in a category, is called the domain or source of , and is called the codomain or target of .
 is called a hom class (or a hom set if it is indeed a set). In general a hom set may be empty, but for any object , is not empty because it contains the identity morphism.
 The hom class may be denoted by or if it is necessary to specify which category is referred to.
 An object in a category need not be a set; the object need not have anything called elements.
 Morphisms may also be called maps. This does not mean that every morphism in any category is a set function (see #Baby examples and #Preorders). Arrow is a less misleading name.
 The composite may be written .
 It might be more natural to write the composite of and as instead of but the usage given here is by far the most common. This stems from the fact that if the arrows are set functions and , then . Thus is best read as "do after ".
Large and small[edit  edit source]
The definition says that a category 'has' objects and 'has' morphisms. This means that for any category and is any mathematical object, the statement ' is an object of ' is either true or false, and similarly for the statement ' is a morphism of '. The objects (or arrows) of a category need not constitute a set. If they do, the category is said to be small. If they don't, the category is large.
The requirement that the collection of morphisms from to be a set makes a category locally small. In this book, all categories are locally small.
Discrete[edit  edit source]
A category is discrete if every morphism is an identity.
Preorder[edit  edit source]
A category is a preorder if for every pair of objects , there exists at most one morphism .
Examples of categories[edit  edit source]
Baby examples[edit  edit source]
These examples are trivial and maybe uninteresting. But do not underestimate the power of baby examples. For one thing, they are sometimes counterexamples to possible theorems.
 0 (the empty category)
 This category has no objects and no morphisms.
 1
 The category 1 has one object and one morphism, which must necessarily be the object's identity arrow.
 1+1
 This category has two objects and two morphisms: the identities on each object.
 2
 This category has two objects and three morphisms. The third morphism goes from one object to the other.
 The objects of these baby categories are nodes in a graph (not sets) and the morphisms are arrows in the graph (not functions).
 For these baby categories we don't have to say what the composition operation does: it is always forced.
 It is impolite to say that categorists think that 1 + 1 is not equal to 2.
The category of sets[edit  edit source]
The category of sets, denoted by Set, is this category:
 The objects are all sets
 A morphism from a set to a set is a function with domain and codomain .
 The composition is the usual composition: If and then is defined by for all .
 The identity morphism on a set is the identity function defined by for .
 In order to preserve the unique typing in a function definition, it is necessary to include its codomain. For example, is a different function from the inclusion function to some set properly including .
 In most approaches to the foundations of math, the collection of all sets is not a set. This makes Set a large category. However, it is still locally small since the class of all functions between two sets, and is a subclass of the power set of their Cartesian product which is by definition a set.
Mathematical structures as categories[edit  edit source]
Preorders[edit  edit source]
A preorder on a set is a reflexive and transitive relation on , which means that for all , and for all , , in , if and , then .
A preorder "is" a category in the following sense: Given a preorder (, ) the category structure is this:
 The objects of the category are the elements of .
 There is exactly one morphism from to if and only if .
The existence of identities is forced by reflexivity and the composition law is forced by transitivity. It follows that the category structure has the property that there is at most one morphism from any object to any object .
Conversely, suppose you have a category with set of objects, with the property that there is at most one morphism between any two objects. Define a relation on by requiring that if and only if there is a morphism from to . Then (, ) is a preorder.
The statements in the two preceding paragraphs describe an equivalence of categories between the category of small categories with at most one morphism between any two objects and all functors between such categories, and the category of preorders and orderpreserving maps.
Remark: Given a preorder, the morphisms of the corresponding category exist by definition. There is exactly one morphism from to if and only if . This is an axiomatic definition; in a model a morphism from to could be anything, for example the pair (, ). In no sense is the morphism required to be a function.
Groups[edit  edit source]
Every group can be viewed as a category as follows: has one single object; call it . Therefore it has only one homset , which is defined to be the underlying set of the group (in other words, the arrows are the group elements.) We take as composition the group multiplication. It follows that the identity element of is . Notice that in the category , every morphism is an isomorphism (invertible under composition). Conversely, any oneobject category in which all arrows are isomorphisms can be viewed as a group; the elements of the group are the arrows and the multiplication is the composition of the category. This describes an equivalence between the category of groups and homomorphisms and the category of small categories with a single object in which every morphism is an isomorphism.
This can be generalized in two ways.
A category is called a groupoid if every morphism is an isomorphism. Thus a groupoid can be called "a group with many objects."
A monoid is a set with an associative binary operation that has an identity element. By the same technique as for groups, any monoid "is" a category with exactly one object and any category with exactly one object "is" a monoid.
Matrices[edit  edit source]
This is a good example of a category whose objects are not sets and whose arrows are not functions. is the category whose objects are the positive integers and whose arrows are matrices where composition is matrix multiplication, for any commutative ring . For any object , , the identity matrix.
Categories of sets with structure[edit  edit source]
This section is a stub. You can help Wikibooks by expanding it. 
 finite sets and functions; denoted FinSet.
 monoids and morphisms; denoted Mon.
 groups and homomorphisms; denoted Grp.
 abelian groups and homomorphisms; denoted Ab.
 rings and unitpreserving homomorphisms; denoted Rng.
 commutative rings and unitpreserving homomorphisms; denoted CRng.
 left modules over a ring and linear maps; denoted Mod.
 right modules over a ring and linear maps; denoted Mod.
 modules over a commutative ring and linear maps; denoted Mod.
 subsets of Euclidean space of 3 dimensions and Euclidean movements
 subsets of Euclidean space of n dimensions and continuous functions
 topological spaces and continuous functions; denoted Top.
 topological spaces and homotopy classes of functions; denoted Toph.
The law of composition is not specified explicitly in describing these categories. This is the custom when the objects have underlying setstructure, the morphisms are functions of the underlying sets (transporting the additional structure), and the law of composition is merely ordinary functioncomposition. Indeed, sometimes even the specification of the morphisms is suppressed if no confusion would arise—thus one speaks of the category of groups.
The examples of sets with structure suggest a conceptual framework. For example, the concept of group may be regarded as constituting a firstorder abstraction or generalization from various concrete, familiar realizations such as the additive group of integers, the multiplicative group of nonzero rationals, groups of permutations, symmetry groups, groups of Euclidean motions, and so on. Then, again, the notion of a category constitutes a secondorder abstraction, the concrete realizations of which consist of such firstorder abstractions as the category of groups, the category of rings, the category of topological spaces, and so on.
Properties of objects and morphisms[edit  edit source]
This section is a stub. You can help Wikibooks by expanding it. 
Isomorphisms[edit  edit source]
A morphism in a category is said to be an isomorphism if there is a morphism in the category with , . It is easy to prove that is then uniquely determined by . The morphism is called the inverse of f, written . It follows that . If there is an isomorphism from to , we say is isomorphic to , and it is easy to prove that "isomorphism" is an equivalence relation on the objects of the category.
Examples[edit  edit source]
 A function from to in the category of sets is an isomorphism if and only if it is bijective.
 A homomorphism of groups is an isomorphism if and only if it is bijective.
 The isomorphisms of the category of topological spaces and continuous maps are the homeomorphisms. In contrast to the preceding example, a bijective continuous map from one topological space to another need not be a homeomorphism because its inverse (as a set function) may not be continuous. An example is the identity map on the set of real numbers, with the domain having the discrete topology and the codomain having the usual topology.
Monomorphisms and Epimorphisms[edit  edit source]
A morphism in a category is a monomorphism if, for any morphisms and , if and are defined and then .
A morphism in a category is an epimorphism if, for any morphisms and , if and are defined and then .
Initial and terminal objects[edit  edit source]
is said to be a terminal (or final) object when is a unique morphism for any in . The law of composition ensures that if and are terminal objects in , they are isomorphic, i.e., is unique up to isomorphism. In the categories of sets, groups, and topological spaces, the terminal objects are singletons, trivial groups, and onepoint spaces, respectively. "b" is the terminal object in 2 as depicted above.
Constructions on categories[edit  edit source]
This section is a stub. You can help Wikibooks by expanding it. 
Subcategories[edit  edit source]
A subcategory of a category is a category in which:
 The class of objects of is contained in the class of objects of .
 The class of arrows of is contained in the class of arrows of .
 For every arrow in , the domain and codomain of are in .
 For every object in , the identity arrow is in .
 For every pair of arrows in , the arrow is in where it is defined.
Opposite category[edit  edit source]
Given a category , the opposite (or dual) category has the same objects as and for every arrow in , the arrow is in . In other words, it has the same objects, and arrows are reversed.
The product of two categories[edit  edit source]
Given two categories and , the product category, denoted , is given by the following data:
 The objects of are where is an object of and is an object of .
 The arrows of are where is an arrow of and is an arrow of .
 Composition is given by .
The product is called the cylinder category, denoted .
Arrow categories[edit  edit source]
 A functor category is a category whose objects are functors and arrows are natural transformations.
 A functor category is called an arrow category, denoted . Its objects are arrows in and its arrows are pairs of arrows such that .
Comma categories[edit  edit source]
 Given categories and functors and , the comma category has objects where is an object in , is an object in , and is an arrow in . Its arrows are where is an arrow in and is an arrow in such that . Composition is given by . The identity is .
Special types of comma categories[edit  edit source]
Using the definition of comma category above, assume that we have , , and . Let denote the object in . Then for some object in . In this case, we write the comma category as and call it the slice category of (or the category of objects over ).
Now assume, instead, that we have , , and . Let denote the object in . Then for some object in . In this case, we write the comma category as and call it the coslice category of (or the category of objects under ).
Finally, if we have and , then the comma category .