The concept of a homomorphism is so powerful, that it has been generalized, almost to an extreme. I hinted at this in chapter 1 when I described a homomorphism as a "function" between two "things" that respects certain "operations". Yes, this is deliberately vague, but you've seen by now how it applies to groups, fields, vector spaces, and so on. Well a morphism is a homomorphism in its most general sense, and although it is entirely abstract, one can still prove some useful theorems.

A category is a collection of objects, along with morphisms between those objects. This definition would be helpful if we knew what an object was, but we don't, and the definition stands anyways. Objects are axiomatic, like points in a topological space. Sometimes we can assign coordinates to the points in a topological space, but sometimes we can't. They are just points, and we leave it at that. In the same way, objects are just objects. Yet even this analogy doesn't go far enough. The points of a topological space belong to a set, and topology is born of ZF set theory, but the objects in a category don't even have to be sets. They usually are, but they don't have to be. This is truly abstract.

A morphism is a labeled, directed connection from one object to another, like a directed arc in a digraph. But the digraph is not a perfect analogy either. Morphisms can connect an object to itself, and many different morphisms can connect one object to another. So a category is like a digraph that allows loops and multiple edges.

Beyond this, morphisms are transitive. If we have A → B → C, then there is a specific morphism, determined by the two morphisms in question, that connects A to C. Digraphs don't usually require transitivity.

Finally, morphisms must be associative. To illustrate this, you need three morphisms and four objects.

A → B → C → D

The implied morphism A → C, combined with C → D, gives the same morphism as A → B composed with B → D.

When the objects are based on sets, such as groups rings etc, and when the morphisms are functions from one set to another, then the composition of morphisms is uniquely determined by the composition of the underlying functions. Furthermore, morphism composition is automatically associative because the same is true of functions. If the functions of A → B → C → D are f g and h respectively, then for any x in A, the resulting function from A to D, no matter how composed, is, and has to be, h(g(f(x))), or fgh applied to x.

There is one more thing to prove, it's not a given; that the composition of morphisms is in fact another morphism. Does the resulting function satisfy the criteria of the category? For instance, is the composition of two group homomorphisms another group homomorphism? It is, because the composition of the two functions respects the group operators within the domain and range. (This is a bit like proving the composition of continuous functions is continuous, which you probably did in first year calculus.) Once this is established, then the collection of objects and morphisms becomes a valid category.

The class of sets, and functions on sets, is a valid category. I use the word "class" because the objects in this category won't fit into a set. There is no set of all sets. Nor is there a set of all groups, since each ordinal serves as a group, and the ordinals don't fit in a set. So we have gone beyond sets; even the objects themselves might not be sets, although they usually are.

A category requires an identity morphism for each object. This morphism takes the object into itself, and when it is composed with any other morphism, on either side, that morphism is unchanged. If morphisms are functions of any flavor, the identity morphism is typically the identity map on a set, mapping x to x. Verify that the identity map on a set A, composed with a function from A into B, is that same function from A into B. And a function from B into A is unchanged when it is followed by the identity map on A.

If there are two identity morphisms f and g, compose them, and the result must equal f and g simultaneously. Hence the identity morphism on a given object is unique.

An equivalence is a morphism that has an inverse morphism, so that when the two are composed, the identity morphism appears. For instance, f goes from A to B, and g goes from B to A, and fg is the identity on A, and gf is the identity on B.

Let f embed a set of 3 marbles into a set of 4 jacks, and let g map the first three jacks back to the first three marbles, and the fourth jack to the first marble. Now fg is the identity on marbles, but gf is not the identity on jacks.

If fg buildds the identity on A, then f and g are injective, and g is surjective. Since gf is the identity on B, f is also surjective. Both functions are bijections, and g is the inverse of f. Again, this reasoning holds when objects are sets and morphisms are functions on sets, but equivalence morphisms could exist in other categories as well.

Every identity morphism is an equivalence. It acts as its own inverse. That makes every object equivalent to itself.

Two objects that participate in an equivalence are equivalent to each other.

In groups rings and fields, an equivalence is an isomorphism, and the objects on either side of the equivalence are called isomorphic. An equivalence between sets is a bijection, and an equivalence between topological spaces is a homeomorphism.

Verify that equivalent objects are reflexive, symmetric, and transitive. Only the latter requires a little thought. If f takes A to B and g takes B to C, then consider the composition of f, g, g inverse, and f inverse. If h is f compose g, then our chain of morphisms implements h followed by h inverse, and that's suppose to be the identity morphism. Morphisms are associative, so regroup, and g compose g inverse is the identity morphism. It can be combined with f, and the result is still f. That leaves f compose f inverse, which is, happily, the identity on A. Apply the same reasoning for h inverse followed by h, to get the identity on C, whence A and C are equivalent.

As the name suggests, equivalent elements form equivalence classes. Sometimes the entire equivalence class collapses into one object. This is reflected in statements like, "There is one group of order p." Of course there are lots of groups of order p, but they are all isomorphic, so what we really mean is, there is one group of order p up to isomorphism. The canonical representative is Z/p, the integers 0 through p-1 under addition mod p. This is also the canonical representative for the unique ring of order p, and the unique field of order p, in their respective categories.

If you accept the axiom of choice, you can select a representative for each equivalence class, and build a category on these representatives. If there is a morphism between two equivalence classes, prepend a morphism in one class, and append a morphism in the other, to get a morphism between the two representatives. The morphism exists, and this is the one we will keep when we restrict our category to representatives. These morphisms are part of the original category, so they follow all the rules, and the category of representatives is valid. One might, for instance, reduce a category of groups down to a category of groups that are unique up to isomorphism. In such a category there is indeed one object of order p for each prime p.

By definition, the objects in a concrete category are sets. These sets follow certain rules, according to the category - while morphisms are functions on these sets, that also follow certain rules. For instance, groups have a certain structure, and so do group homomorphisms.

The morphism is completely described by the function on the underlying set, hence the identity map on a set has to be the identity morphism on the corresponding object, and a bijection between sets is usually an equivalence, provided the function and its inverse follow the rules for a morphism in the category. Often the forward direction implies the reverse, but this is not a given; it has to be proved. If a group homomorphism is a bijection on sets it is an isomorphism, and the inverse map is another group isomorphism, giving an equivalence. Not so for continuous functions among topological spaces. The inverse of a continuous map, even a continuous bijection, need not be continuous. Let A be the line wherein every set is open. Let B be the line with the usual topology based on open intervals. The bijection from A onto B is continuous, because every open interval in B pulls back to an open set in A. However, there are lots of open sets in A, like a single point, that do not become open sets in B. To recap, equivalence morphisms on sets are bijections, but you need to prove the inverse of a morphism is still a morphism.

As mentioned earlier, the morphisms of a concrete category are automatically associative, because function composition is associative.

A subcategory is a category within a category. It retains some of the objects, and some or all of the morphisms that exist between those objects. A full subcategory retains all the relevant morphisms. An example is the abelian groups within the larger category of groups.

If there is but one object, the category is called a monoid. There could be many morphisms from that object into itself, like the automorphisms of a field extension F/K.

Why is it called a monoid? Because the morphisms form a monoid under composition. Morphism composition is associative, and the identity morphism is the identity with respect to function composition, hence these morphisms combine to create a monoid of functions from F into itself. If the field extension F/K is finite then the set of automorphisms is actually a group, but if F is all the rational polynomials K(x), then the automorphism x → x2 has no inverse. Thus the structure is only half a group, i.e. a monoid.

Realize, however, that there is also a category of monoids, with many objects, one object for each monoid, and monoid homomorphisms as the connecting morphisms. I'll try to be clear - whether I mean a one object monoid or the category of monoids.

If there is at most one morphism between any two objects, the category is a pre ordering of objects.

A free object Q only makes sense in the context of a concrete category. That's because we're going to map a set X into the elements of Q, so Q better be a set. In fact Q is defined as being free on the set X. There may be many free objects on X, or there may be free objects on other sets. We shall see that the contents of X doesn't matter; only its size.

An object Q is free on the set X if there is a map h taking X into Q with the following property. For every object R, and for every function f(X) into R, there is a unique morphism g from Q to R such that hg = f.

X h
Q
f↓ ↓g
R

Note that f and h need not be morphisms. They are merely functions on sets. But g has to be a morphism between objects.

This definition is inspired by free groups and free modules. Let Q be Z3 in the category of abelian groups. Here Q is the direct product of three copies of the integers, with identity [0,0,0]. Let h map the set (α,β,γ) to the three generators of this group. For instance, h could map the three elements of X to [1,0,0], [0,1,0], and [0,0,1]. Now let R be another abelian group and let f map X into R. Let g map the 3 generators of Z3 to the same 3 images in R. Thus g carries h(X) over to f(X). The rest of g is defined by these three images in R. In other words, the morphism follows the generators. There is no inconsistency, because all the elements in Z3 are distinct, and they can land anywhere in R without producing a contradiction.

You can see that Z/n (the integers mod n) is not a free object, by mapping it into Z. When g(1) = 1, g(2) = 2, and so on, until g(n) = n, which means g(0) = n, which violates the definition of a group homomorphism. A free object has to be unconstrained, so that it can map into or around anything else.

It is often convenient to make X the set of generators in Q, whence h(X) is the identity map. Now every map f from X into R extends to a unique morphism from Q into R. Once again, the morphism follows the generators.

The word unique is important here. Consider our example of Z3 in the category of abelian groups. The set (α,β) maps to two generators of Z3, and g is free to follow these generators, but g can map the third generator [0,0,1] to anything in R. There are many possibilities. So Q is not free on 2 generators; it is free on 3 generators.

Suppose h maps α and β to the same generator c in Q. Let R be any object with more than one element. Let f map α and β to different elements in R. Since h*g carries α and β to the same element, hg can never equal f, and h is not a valid map from X into Q. If Q is free, h is an embedding of X into Q. Thus we can equate X with the generators of Q.

The above proof breaks down in the category of sets of cardinality 1, i.e. each set contains one element. Every object is free, on any set, of any cardinality. All of X maps to the single element in Q, which carries over to the single element of R. But that's not a very interesting category, so let's set that one to the side.

If Q1 and Q2 are free on sets of the same cardinality, they are equivalent.

Using a bijection between the two sets, let Q1 and Q2 be free on the same set X without loss of generality. Thus X maps onto the generators of Q1, and the generators of Q2, and since these objects are free, their generators map onto each other through unique morphisms. A unique morphism carries the generators of Q1 onto the generators of Q2, which I will call g, and another unique morphism carries the generators of Q2 back to the generators of Q1, which I will optimistically call g inverse. The composition of these morphisms produces the identity map on the generators of Q1. Since Q1 is free, There is a unique morphism on Q1 that agrees with this map, namely the identity morphism. Thus g followed by g inverse is indeed the identity map. This holds in the other direction as well, hence Q1 and Q2 are equivalent.

In summary, there is at most one free object, up to equivalence, for every cardinality.

Consider the category of vector spaces over a given field, where linear transformations act as morphisms. Every space is a free object. Given a vector space Q, build a basis for Q, and the basis becomes the generators of Q. The image of the basis elements into R completely defines the linear transformation. By linearity, the map has to follow the basis, and is unique; and it is free to follow the basis wherever it leads. Well this is rather a special category; we don't usually have every object as a free object. I showed earlier that Z/n is not free in the category of abelian groups.

If Q is free on X, the rank of Q is defined as the cardinality of X. Rank may not be well defined for every category, but it usually is. Returning to vector spaces, every space has a specific dimension, and no larger or smaller basis will do. The dimension of the space becomes the rank of that space as a free object.

Here is an interesting exercise in the category of abelian groups. If a generator of Q wraps around to 0 then Q is not free. We saw this with the integers mod n. Map this cycle into anything larger and derive a contradiction. But what if everything in Q goes on forever? This is called a torsion free group. Is Q free? Is every torsion free group free?

It need not be, and there is a simple counterexample. Let Q be the rationals under addition. If Q is free then let u be one of its generators, and map u to 1 in Z. What is the image of ½u? There isn't one, hence Q is not free.

A field extension F/K cannot be free in the category of field extensions of K, because a field homomorphism embeds, and F can only map into something larger. Map a generator of F into something smaller, even into K itself, and you're in trouble. I suppose K is free on 0 generators, but that is rather trivial.

If the category is ring extensions of R, the polynomial ring R[x] is free on one generator. Map x to anything in S and the rest of R[x] follows from there. R[x,y] is free on two generators, and so on. If the category is noncommutative rings, that's no problem; r[x,y] is free on two generators, assuming x and y do not commute.

When a morphism is monic it probably implements a monomorphism, and when a morphism is epic it probably implements an epimorphism. Hence the nomenclature.

A morphism is monic if it admits a form of cancellation. Whenever two morphisms g and h lead into the source of a third morphism f, and gf = hf, then g = h.

If f is a function on T, and g and h map an arbitrary set S in to T, we can write it this way, using functional notation.

f(g(S)) = f(h(S)) → g(S) = h(S)

Expressing it as functions can clear things up a bit, but remember, the definition transcends concrete categories.

In a concrete category, it is enough to know that f is injective. The action of f can be reversed, i.e. undone, to show that g = h. Every monomorphism, or injection, is monic.

If a concrete category includes a free object on two generators, and it usually does, then monic morphisms are monomorphisms. We already showed injective implies monic; let's demonstrate the converse. Suppose f is monic, yet it maps x and y to z. Let P be a free object with generators a and b. Map a and b to x and y respectively. Since P is free, the morphism follows from there. Call this morphism g. Another morphism, h, carries a to y and b to x. These are different morphisms, yet gf and hf both map a and b to z, building the same morphism on P. This is a contradiction. As long as there is a free object on two or more generators, monic and monomorphism are synonymous.

axz
by
ayz
bx

An epic morphism admits cancellation on the other side. Let f be a morphism into an object T. If g and h are morphisms from T to some other object, and fg = fh then g = h. If the category is concrete, and f is onto, or an epimorphism, then f is epic. If g and h map x to different points, and y is in the preimage of x, then g(f(y)) will not equal h(f(y)).

The converse is almost always true, but you have to take it case by case. Look at sets first. If f maps the set S into T, missing the element v, build a new set U containing w x and y. Let g map all of T to w except for v, which maps to x. Let h map all of T to w except for v, which maps to y. Now fg = fh, yet g ≠ h. Therefore epic and surjective are synonymous.

The same proof works for topological spaces, as long as you give the 3 element set the indiscrete topology, so that g and h are continuous.

For groups, modules, rings, ring extensions of a base ring K, or vector spaces, realize that the image of f follows all the rules, and is a proper substructure within T. Let J be the image of f. Let U be the direct product T*T, with the instances of J sewn together. If T is the cyclic group of order 25, and J is the multiples of 5 within T, then U would be a group with 2 generators, but both generators, when multiplied by 5, lead to the single generator of J. This form of sewing can be done for the aforementioned structures. Let g and h map J into J inside U. Let g map the rest of T onto the first copy of T, and let h map the rest of T onto the second copy of T. Now fg = fh, but g is not equal to h. Therefore f is not epic.

Consider the category of field extensions of K, with K isomorphisms as morphisms. If T is a proper extension of the image of f, map T into its normal closure, such that g maps v to v, and h maps v to one of its conjugates, or to v2 if v is transcendental over the image of f. That takes care of separable field extensions of K.

Suppose however that vp = x for some x in the image of f, making T a purely inseparable extension. If g and h agree on the image of f, carrying it into some field U/K, then extend each isomorphism up to v. There is only one extension; v has to map to the unique pth root of g(x). Thus g and h are the same on all of T. The morphism f is not onto, but it is epic. This is an unusual case.

The composition of monic/epic morphisms is monic/epic. Start with gef = hef, regroup, and cancel twice, leaving g = h, whence ef is monic.

The identity map is both monic and epic.

If f is an equivalence, compose f with f inverse to demonstrate cancellation on either side, hence f is both monic and epic. This is not surprising; an isomorphism is both a monomorphism and an epimorphism.

The purely inseparable example given above shows that a monic&epic morphism might not be an equivalence; it might not even be a bijection.

In chapter 1 I defined a function f as injective if f maps everything in its domain to a unique value in the range. Nothing is repeated. This section defines an injective object, and yes, injective objects and injective functions are related.

Remember that in a concrete category, an injective function is the same as a monic morphism. We'll see below that an injective object has a certain relationship to monic morphisms. Similarly, a projective object is related to epic morphisms, and in a concrete category a projective object is related to epimorphisms.

An object P is projective if, for any pair of objects A and B, and any epic morphism f from A to B, and any morphism g from P to B, there is at least one morphism h from P to A such that hf = g.

P
h↓ ↓g
A
f
B

If the category admits free objects, and if epic is the same as onto, every free object is projective. If P is free, follow its generators to B, and then take preimages under the epic morphism f. It doesn't matter which preimages you choose. You now have a map from the generators of P into the elements of A. This map defines a morphism h from P to A. The composition hf gives a morphism from P to B, and this morphism agrees with g, at least on the generators of P. Yet if morphisms agree on the generators of a free object, they are the same. A morphism h has been constructed such that hf = g, the diagram commutes, and P is projective.

Every vector space is projective, because every vector space is free. Follow the basis of P to B, and back through f to A, and build h from there.

An object J is injective if, for any pair of objects A and B, and any monic morphism f from A to B, and any morphism g from A to J, there is at least one morphism h from B to J such that fh = g. These morphisms run up towards J, while the projective morphisms ran down and away from P.

J
g↑ ↑h
A
f
B

A free object need not be injective. Consider the category of abelian groups. Set J = A = B = Z. Clearly J is a free object. Let f map 1 to 2, which is monic, and let g map 1 to 1. Since fh always maps 1 to an even number, it cannot equal g.

A projective object could support many different morphisms h for a given f and g, but an injective object only has one function h that completes the diagram, at least for the image of f. If x ∈ B is in the image of f, take the preimage of x under f, which is well defined since f is monic, then apply g to find y in J. Now h(x) has to equal y.

Assuming f inverse is another morphism, then f inverse g is a morphism, as is h. The only question is whether h can be extended from the range of f to all of B. In other words, a substructure of B maps into J; can this map be extended to cover all of B?

If the category is abelian groups, and J is the rationals, then J is injective. Let S be a subgroup of B, such that h(S) is a predefined homomorphism from S into Q. Remember that S is a normal subgroup of B, with well defined cosets. Let x represent a coset of S in B. Assume x has order n in B/S. If nx = v in S, then let h(x) = h(v)/n. This extends h to S join x. If the multiples of x never return to S then map x to anything you like, such as h(x) = 0.

Adjoin generators, one after another, and map each generator into Q, consistent with the previous map. If B/S is countable then you can build h(B) in this fashion. If B/S is uncountable then apply zorn's lemma to find a map h from a maximal subgroup of B into Q, whence this maximal map has to cover all of B, else you could bring in another generator. That completes the proof; Q is injective in the category of abelian groups.

Q is however not projective, which is not surprising, since it is not free. Let B be another copy of the rationals, with g(x) = x. Let A be an infinite direct sum of copies of Z. Let f map 1 in the nth copy to 1/n in B. Since the nth copy covers all the fractions with denominator n, f maps A onto B. Suppose h(1) = y in A. Now y is a finite set ai, up to a certain index n, such that ∑ ai/i = 1. It follows that h(½) is this same set with each ai divided by 2. That's fine as long as each ai is even. If so then h(¼) is the same set with each ai divided by 4. Eventually some ai becomes odd, and h cannot continue. Q is injective, but not projective.

An object Q is universal, or initial, if for every object R in the category, there is one and only one morphism from Q to R.

An object Q is couniversal, or terminal, if for every object R in the category, there is one and only one morphism from R to Q.

If Q and R are both initial there is one morphism from each to the other, and the composition has to be the unique morphism from Q into itself, which is the identity morphism. In other words, the two objects are equivalent. There is only one initial object, and one terminal object, up to equivalence.

A zero object is both initial and terminal.

A category need not have all these objects. For instance, in the category of sets, the empty set is initial, a set with 1 element is terminal, and since these objects have different cardinalities, there is no zero object. If the empty function is not considered a valid morphism, there is no initial object either. Categories such as groups and modules have a zero object, namely the identity element.

These objects don't become interesting until the category gets a bit more complicated. Let G be a fixed group and let the objects of a category be the quotients of G that are abelian. This is a subcategory of abelian groups. If A and B are two quotients of G, then f is a morphism from A to B if the map from G to A to B (passing through F) agrees with the map from G to B. In other words, morphisms make the diagram commute. Verify that the composition of morphisms is another morphism.

G
A B

Suppose there are two morphisms from A to B, that differ on some point y in A. Let x be any point in G that maps to y in A. Map x to A and then to B, and get two different values, but the direct map from G to B has only one value for x. Thus there is at most one morphism between any two objects in this category.

The terminal object is 1, the trivial group. Certainly G maps onto 1, and 1 is abelian. Any other quotient group A maps onto 1 in exactly 1 way, and the composition of these maps is the same as mapping G to 1 directly.

Let U be the abelianization of G. I call it U because it is a universal object. There is exactly one morphism from U to B.

These constructed categories are not uncommon. Given a reference object R, build a new category of objects that are epic from R (like the quotient groups of G), and follow certain constraints (e.g. quotients are abelian). If there are different epic morphisms from R to B, you need to include different copies of B, so that each has one morphism from R. Or let B represent all the objects equivalent to B, so there is but one canonical morphism from R to B. This was the case with groups; a canonical map carries G onto a quotient group using the cosets of the kernel. With this in place, there is at most one morphism from A to B that makes R to A to B the same as R to B. And there might be one (up to equivalence) universal object in this category.

Another example is the quotient rings of a commutative ring R that are integral domains. These correspond to the prime ideals of R, and there is a universal object iff there is a minimum prime ideal.

An example from algebraic topology is a universal covering space for a given space S, the way the real line wraps around the circle. This exists if S is locally simply connected.

Within the context of a category, a diagram is a digraph, with objects as vertices, and morphisms as directed edges. The digraph may have infinitely many vertices and edges. As you might expect, an arc from one vertex to another must represent a morphism between the corresponding objects.

In this and subsequent sections I will abuse the terminology just a bit and simply call the structure a graph, even though it is a digraph (directed graph).

The graph allows loops and multiple edges. You can represent a morphism from an object into itself, or several different morphisms between two objects.

Since the identity morphism must exist, every vertex has at least one arc that loops around and runs back into itself. This is the identity arc.

A commutative diagram is a diagram on a selected set of objects, with a particular set of morphisms, that exhibits path independence. This means there is at most one morphism, implied by the graph, connecting any ordered pair of vertices. Note that this morphism could be implied by transitivity. If the graph contains A → B → D, there is an implied morphism from A to D, produced by composing the two morphisms in the chain. By path independence, any other chain from A to D must produce the same morphism. The simplest example is a square with two paths from A to D, one through B and one through C; yet the implied morphism from either path is the same.
AB
CD

As a corollary, there is at most one arc directly connecting any two vertices. You can't have two different morphisms from A to B. Multiple edges have just disappeared. And a literal interpretation means there is at most one arc joining a vertex to itself, and we already have that; it's the identity map. There are no other loops.

If a cycle starts and ends at V, the composition of those morphisms has to produce the morphism on V, which is the identity map. If U and V are connected by antiparallel arcs, that forms a cycle of length 2. The composition is the identity map, the morphisms are inverses, and the points are equivalent.

Note that an endomorphism can be included in a commutative diagram; you just need to vertices that represent the same object. Draw an arc between them, and it won't conflict with the identity arc, which is a loop at either vertex. If you want to depict multiple morphisms between two objects, use several vertices to represent those objects.

Commutative diagrams become very important in module homology, and then in algebraic topology, leading to theorems like the 5 lemma, the short 5 lemma, and the serpent lemma.

The product in a category is inspired by the direct product of groups, rings, and modules. Projections map the product onto its components, and a function into the product defines, and is defined by, a function into each of the components. Let's rephrase this in terms of objects and morphisms.

If Ai is an indexed set of objects in a category, its product is an object C, along with projection morphisms pi taking C to each Ai. Furthermore, for every object B, and collection of morphisms fi from B into Ai, there is a unique morphism f from B to C such that fpi = fi. In other words, there is some f so that each triangle commutes, taking B to Ai directly via fi or indirectly via f followed by pi.

CB
f
C
A1a2a3a4a5
fi
Ai

If the category is concrete, and the index is finite, the product is simply the direct product, with the usual component projections. There can be only one function f that makes the triangles commute, built from each fi acting on its component. You need to verify that f, so constructed, is a morphism in the category, but this is usually the case. For instance, if each fi is a group homomorphism, then the direct product C is a group, and f is also a group homomorphism into C.

If the indexing set is infinite, the product must be a direct product, not a direct sum. This is necessary if f is to implement each fi simultaneously.

The product of topological spaces is also valid, assuming the weak product topology. In fact that is the default topology, so that the product of spaces becomes a product in the categorical sense.

There is one product, up to equivalence. Assume C and D are both products, with projections pi and qi onto the same components Ai. Let C play the role of B in the earlier diagram. There is a map pi from C into Ai, for each i, hence there is a morphism f from C to D such that pi = fqi. Run the projection pi from C, or go over to D via f and then run its projection qi. There is likewise a morphism g from D to C such that qi = gpi. Compose these to get pi = fgpi for each i.

If I is the identity morphism on C, we have pi = Ipi. The definition of product says there is a unique morphism from C into C that makes all the triangles commute. That function has to be I, hence fg = I. Run this argument in both directions and C and D are equivalent. The product of a collection of objects is unique up to equivalence.

The order of objects in the sequence Ai is not significant. The proof is essentially the same as that given above. Let C be the product of objects Ai, and let D be the product over the same objects in a different order, according to a permutation s. Again, C maps into the components of D, and then into D directly since D is a product. Rearrange the projections from C, so that they look like functions from C into the components of D in the prescribed order. If A7 comes first in D, then f1 = p7. Formally, fi = ps(i), where s is the permutation function. This lifts to a compatible function f from C to D, so that fqi = fi = ps(i). Let t be the inverse permutation of s, and write fqt(i) = pi. Build g in the other direction, and qt(i) = gpi. Compose these to get pi = fgpi. This sets fg = I, as shown above. Do this in both directions and C and D are equivalent.

The coproduct is the obverse of the product. The arrows in the commutative diagrams are reversed. Let's see how this works.

Injections pi carry each Ai into C, and for every B and family of morphisms fi from Ai to B, we have a unique morphism f from C to B such that fi = pif. Go straight from Ai over to B, via fi, or inject Ai into C via pi, and then apply f. The triangle commutes.

CB
f
C
A1a2a3a4a5
fi
Ai

A proof, similar to the one given above, shows that the coproduct is unique up to equivalence, and the order of the objects is not significant.

In the category of sets, the coproduct is the disjoint union. The injection pi maps Ai into a copy of itself in C. Let f map this copy of Ai into B just as fi maps Ai into B. This definition holds for each i, hence f is defined on all of C. And if f is defined any other way, on any point, one of the triangles will not commute; hence the morphism is unique. This makes C the coproduct.

In other categories such as abelian groups, rings, modules, and vector spaces, the coproduct is the direct product, or the direct sum if the indexing set is infinite. The injection pi from Ai into C embeds the ith component, and sets everything else to 0. The composite function f looks like fi on each component, and by linearity, this determines f uniquely on all of C. That's why C is a direct sum, rather than a direct product; the images under f are determined for finite sums of elements, from finitely many components, and that corresponds to the direct sum.

If the list is finite, the product and the coproduct are the same.

In the category of groups, the product is not the coproduct. Consider Z and Z, with a product of Z2. Can Z2 be the coproduct? Let B be a group containing x and y, such that x and y do not commute. Map 1 (in the first component) to x and map 1 (in the second component) to y. This means f(1,0) = x and f(0,1) = y. However, f(1,1) forces xy = yx, which is a contradiction. Thus Z2 is not the coproduct. There is a coproduct however, namely the free group on two generators. This will be described in the next chapter.

The direct product of two fields is not a field. [1,0] * [0,1] = [0,0], giving zero divisors. So what to do?

Assume L and M are linearly disjoint field extensions of K. Let C be the compositum L+M. A morphism in this category is a field homomorphism fixing K, which necessarily embeds the domain into the range. C, a larger K vector space, cannot map back down to L, hence C is not the product. But C is the coproduct. Injections embed L and M into L+M. Let f1 embed L into B, and let f2 embed M into B. Let f carry L (subfield of L+M) into B according to f1, and let f carry M into B according to f2. Of course f must do this; it can't do anything else. Assume L/K is finite, with generators g1, g2, and g3. Thus f maps g1 to h1 in B, both having the same irreducible polynomial p1 over K. Yet g1 is a root of this very same polynomial whether it is adjoined to K or to M. The field homomorphism extends to M(g1). Do the same for g2 and g3, and the homomorphism extends all the way up to L+M.

Let D be a commutative diagram, and designate some or all of the points of D as "receiving", ready to receive morphisms from the outside. Build a new category as follows.

Add V to the graph D and draw arcs, i.e. morphisms, from V to the receiving points of D. The edges internal to D remain. If this augmented diagram commutes, we have an object in the new category. The object is V along with its morphisms to D.

Let two such diagrams, built from V0 and V1, have a morphism for every morphism from V0 to V1 that makes the composite diagram on D∪V0∪V1 commute. Remember, vertices need not be assigned distinct objects, so V0 and V1 could be the same entity. Let's see if this category makes sense.

Let V0 and V1 represent the same object, with the same arcs into D, and run the identity morphism between them. The composite D∪V0∪V1 is commutative. The only new path to check starts at V0, goes to V1 (which is really the same as V0), and winds up at a destination Y in D. The resulting morphism is the identity followed by the morphism from V1 to Y, which is the same as the path from V0 to Y, which is path independent. The identity morphism in the original category becomes an identity morphism in the new category. You'll see this as we compose morphisms below.

Next verify composition, from V0 to V1 to V2. We need to show the composite D∪V0∪V2 is a commutative diagram. Suppose two paths start at X and end at Y, and imply different morphisms. If X is not V0 then there is no way to get to V0, so V0 is not part of either path. Both paths live in D∪V2, which is commutative. So we can assume X = V0.

If neither path moves through V2 then they both live in D∪V0, which is commutative. Let the first path include V2, and the only way to do that is to go from V0 to V2, which is the same as going from V0 to V1 to V2. Meantime the second path might go directly from X into D. Yet that is the same as going from X to V1 and into D, and that in turn is the same as going from X to V1 and then from V1 to V2 and into D. Now the second path has become the first path, and the diagram commutes. Morphism composition is well defined. Furthermore, morphism composition inherits associativity from the original category.

If D has no receiving points then there are no arcs into D. The new category is the same as the original category, which isn't very interesting.

Finally we are ready to define the limit of D. A terminal object T in the new category is the limit of D.

Remember that T specifies an object V, and morphisms from V to all the objects in D. In other words, the edges from V to D are part of T.

Let D be a graph of isolated points with no internal edges, but all points can receive arcs from outside. Let T be a terminal object. Call the arcs from V into D projections. Let S be another object D∪U. Now the morphisms from S to T are derived from the morphisms from U to V. There is one such morphism, since T is terminal. In other words, there is one morphism from U to V that makes the diagram commute. Since T is terminal, this holds for every S. This is the definition of a product in the original category. V is the product and the arcs into D are the projections. The objects in D are the components of the product. Thus product is a special case of limit.

As you might surmise, we can create yet another category on D by letting the arrows run from D out to V. A morphism in the new category is derived from a morphism from V0 to V1 that makes the diagram commute. The result is indeed a new category, and the proof is the same as that shown above.

The initial object in the new category is the colimit of D. If D is merely a collection of objects with no internal edges, the colimit is the coproduct in the original category.

Product and coproduct are unique (up to equivalence), so you might think that the limit and colimit, which are generalizations of the product and coproduct, are also unique - and you'd be right. Actually the initial and terminal objects in any category are unique, so that covers the limit and colimit. Perhaps less obvious, the underlying objects in the original category have to be equivalent as well. Let S and T be equivalent limits via f and g, whence they are based on objects U and V with morphisms f and g. Remember that fg builds the identity morphism on S, and there can only be one such morphism, which comes from the identity on U, hence fg (beneath) becomes the identity on U. Do the save for V, and U and V are equivalent.

The pushout is a special case of the colimit, which was described in the previous section. Start with a morphism f from Z into X, and another morphism g from Z into Y. The pushout, if it exists, is an object P, and morphisms from X into P and from Y into P, such that the entire square commutes. In other words, you can go from Z to X to P, or from Z to Y to P, and the result is the same. Furthermore, P is an initial object having this property. If Q also builds a commutative square, a unique morphism from P to Q makes the entire diagram commute. Being a colimit, the pushout is unique up to equivalence.
YP→Q
ZX

The simplest example comes from sets and arbitrary functions on sets. Let Z be a subset of both X and Y, so that the morphisms into X and Y are inclusion. Let P be X union Y, with inclusion from X or Y into P as the pushout morphisms. If Q is some other set that makes the square commute, then map c ∈ Z to X or Y, then to d in Q; the image of c in P has to be d in Q. The compatible function exists and is unique. Hence P is initial, and is the pushout of X and Y.

If X and Y are abelian groups, or modules, or ring extensions, or vector spaces, the pushout P is the direct product of X and Y, mod the relations f(c)-g(c) for each c in Z. Both X and Y embed in the direct product, and map into the quotient module. These are the pushout morphisms. Verify that P is an initial object.

The pullback is just like the pushout, but the arrows are reversed. Let X and Y map into Z, and the pullback P maps into X and Y, such that the square commutes, and P is terminal. In other words, P is the limit of our 3 object diagram. These are not as common as pushouts, though they are sometimes used in connection with fiber bundles.
YP←Q
ZX

Let a commutative diagram have a graph that reflects a partial ordering on the underlying objects. In other words, the objects of the diagram can be partially ordered in such a way that an arc from U to V implies U < V. If you follow the arcs, i.e. the morphisms, there is no way to get back. There are no cycles. You move inexorably up.

Assume any two vertices are bounded above. There are paths from each that lead to a common vertex higher up.

The colimit of this diagram, if it exists, is called the direct limit, or the injective limit.

Consider the category of sets, partially ordered by inclusion. Morphisms are functions from one set into another, and inclusion is a special kind of morphism.

Consider a set S and create a vertex for each finite subset. Let embeddings act as morphisms among these subsets, and the diagram represents a partial ordering, and it commutes, and every two vertices are bounded above. This system meets our criteria, but smaller systems meet our criteria as well. We don't actually need all the finite subsets of S. The collection must span S, and every pair of vertices must be bounded above. That's all we need. We will show that the set S, represented by the vertex S, along with the embeddings from the finite subsets of S into S, is the direct limit. In other words, S is the colimit of the diagram.

Augment our diagram with another set T. In other words, various functions map our finite subsets into T, and the diagram commutes. We need a function f from S to T that makes everything commute.

Let x be an element of S and start with any finite set containing x, and follow the morphism over to T. Let x map to y in T. Let f(x) = y. But is this well defined? Suppose there are different finite sets, and in one, x maps to y in T, and in another x maps to z. Our two finite sets are bounded above by a third finite set, which is part of the diagram. These maps are embeddings, so the map from the third set into T dictates the image of x. It cannot have two different values, hence f(x) = y, and f is well defined.

Does the composite diagram commute? We can follow a chain from x to y in T, or we can follow a chain up to S, which is always an embedding, and maps x to x, then invoke f to get f(x) = y. Yes, the diagram commutes. There is a unique morphism for every T, and S is the colimit, or the direct limit.

A similar proof shows that a module is the direct limit of its finitely generated submodules.

Let's see what goes wrong when pairs are not bounded above. Let M be the abelian group Z3, which is a Z module. Select three finitely generated submodules, each using two of the three generators. Let T = Z, and map our three submodules to T as follows.

[1,0,0] → 1 & [0,1,0] → 1
[0,1,0] → 2 & [0,0,1] → 2
[1,0,0] → 3 & [0,0,1] → 3

We cannot build a group homomorphism from M into T that is consistent with all three maps, hence M is not the direct limit.

Reverse the arrows, and let morphisms run down the lattice, always pointing to "lesser" objects. Let any two vertices be bounded below. The limit of this diagram, if it exists, is called the inverse limit, or the projective limit.

To explore the inverse limit, move to the category of topological spaces and continuous functions. Remember that arcs, or functions, take you down the lattice. Assume all the spaces in the diagram are disjoint from each other.

Let P be the direct product of the spaces in the diagram. We will build a subspace Q, which inherits its topology from P. Select a morphism in our diagram, which represents a function from U to V. If this function maps a to b, Restrict Q so that the point selected from V = b whenever the point selected from U = a. We have tied two components together. The value of the component U determines the value of the component V. Do this for all functions in the diagram and call the resulting space Q.

We need morphisms from Q down to all these spaces. In other words, Q sits above the diagram and projects downward. In fact, projection is the key. Map Q into V by extracting that particular component, just as we would do with P. If W is an open set in V, its preimage is open in P. This restricts V to W and leaves the other components unconstrained. Restrict this to Q and find an open set in Q, under the subspace topology. This is the preimage of W under the projection from Q to V. Thus the projections from Q down to the various subspaces are all continuous, and are valid morphisms.

Let R be another space with continuous maps to the spaces in our diagram. By construction, the augmented diagram is commutative. We need a function f from R to Q that makes everything commute.

Given a point x in R, follow the function from R to V, and let x map to y in this component V. This establishes the image of x in P, at least for one of the components. Do this for all components and x has an image in P.

Use the fact that the diagram, with R adjoined, is commutative, to show that f(x) lies in Q.

Is f(R) continuous into Q? If it's continuous into P then it's continuous into Q. A base open set in P restricts finitely many components to open sets within those components. Let x ∈ R be in the preimage. Let V be one of the restricted components; say we are restricting to an open set W in V. Follow the morphism from R directly to V, and x is in the preimage of W. Thus x is in an open set in R. This happens across finitely many components, so take the finite intersection of these open sets in R to produce an open set. Therefore f is continuous, and Q is the inverse limit.

We did not use the fact that pairs of vertices are bounded below; it was not necessary for this example.

As a corollary, give each space the discrete topology. Now every function is continuous, so we are really talking about arbitrary functions among disjoint sets. The inverse limit Q exists, and is a subset of the cross product of the underlying sets, as described above.

Once again we are going to convert an existing category C into a larger category G.

Let sequences of objects in C become objects in a new category G. Here G is a graded category with respect to C. If C is groups, G is graded groups, and so on.

At the outset, let's assume there are no restrictions on the sequences; any sequence of objects is fair game. We may place restrictions on the sequences later.

A morphism m from U to V in G is a sequence of morphisms in C, such that mi maps Ui into Vi. Morphisms in G are composed by composing the individual morphisms in C. Associativity is inherited. Set mi to the identity morphism on Ui and find the identity morphism on U in G. We have a valid category.

Here is an example of a morphism between two objects in a graded group of height 7. This is an epimorphism; though any homomorphism from one group into another is fair game.

UmV
Z/15Z/5
D9Z/2
Q24Z/3
S7Z/2
A61
SL4SL4/±1
Z/7*Z/8Z/4

If C is concrete then the objects in G are sequences of sets, which are also sets. A morphism in G is defined by morphisms in C, which are defined by functions obeying certain constraints. Thus functions from sequences of sets to sequences of sets determine morphisms in G. In short, G is a concrete category.

An object in G is free iff it is a sequence of free objects in C. The disjoint union of all the generators of all the free objects in the sequence builds the set X of generators for the free object in G. Conversely, the generators of a free object F in G, that happen to live in Fi, become generators for Fi, and every morphism restricted to Fi follows these generators, hence Fi is free. Here is an example from abelian groups, wherein U is free.
UmV
ZZ/5
Z*ZZ/17
ZQ

Build a commutative diagram D1, with receiving points, from the category C. Then build D2, having the same structure, the same connections between points, but possibly using different objects and morphisms from C. Build D3, D4, and so on. These diagrams stack up like parallel pancakes on a plate. Now the column above each vertex is an object in G, and the stack of morphisms from one vertex to another is a morphism in G. The result is a commutative diagram D in G.

Conversely, each slice of a commutative diagram D in G implies a commutative diagram Di in C.

Let H be a new category, derived from D in the category G. This process was described in the previous section. Objects in H are objects in G and morphisms into the graph such that D commutes. Each slice is an object in C and morphisms into Di such that the augmented diagram commutes. A morphism in H is a morphism from U to V that makes D∪U∪V commute. It has to commute at every level.

An object V in H is the limit of D iff each Vi is the limit of Di. The same holds for colimit.

Remember that the product is a special case of the limit, where the underlying graph has no edges. If every collection of objects in C has a product, then the same must be true in G. Similarly, coproducts in C imply coproducts in G.

Sometimes graded objects are restricted, so that a morphism must tie each object to the next. And these morphisms may be restricted in other ways, e.g. an embedding. You've seen this before. A descending chain of subgroups determines whether a group is solvable. Turn this chain around and each group embeds in the next. This is a graded group with a homomorphism (in this case a monomorphism) carrying each group into the next.

Let G consist of sequences of objects in C, with morphisms in C connecting each object to the next. Since the objects of C are now tied together, the resulting sequences are called chains. In other words, G consists of chains of objects from C. These are written in columns, with vertical arrows indicating the morphisms in the chain.

Place two chains next to each other, and a morphism in G is a morphism from C at each level. The morphism fills in the rungs of the ladder. But sometimes there is an additional constraint; the ladder must be a commutative diagram. I'll illustrate with X and Y objects of G, and f a morphism from X to Y. You can follow the morphism from X3 to X4, then apply f4 to Y4, or you can follow f3 from X3 to Y3, then use the morphism from Y3 to Y4. The result is the same.
X1Y1
X2Y2
X3Y3
X4Y4

The existence of a limit for each diagram on a given graph in C might not imply a limit in in G. Given a stack of commutative diagrams on the given graph, and a limit Vi for each Di, We can build a sequence V using the objects Vi, but there may not be a chain of morphisms connecting each Vi to Vi+1, that makes everything commute between the layers. Fortunately, such a chain often exists in practice.

Return to the example of groups and group homomorphisms, and look at products. At each level, the product is the direct product of the groups. To go from one level to the next, there is a homomorphism from each component group into the next. This implies a homomorphism from the first product into the second. Run the individual homomorphisms within their components, and the result is a group homomorphism. Furthermore, the map between products commutes with projections and the maps on component groups. Within the categories of graded groups, graded rings, and graded modules, direct product is well defined.

A functor is a map from one category into another that is compatible with the morphisms of both categories.

Let f be a functor from the category C into the category D. If X and Y are objects in C, with a morphism from X to Y, then there is a morphism in D from f(X) to f(Y), and the functor implies a correspondence between the morphism from X to Y and the morphism from f(X) to f(Y). In other words, the functor carries objects to objects and morphisms to morphisms, so that the diagram commutes.

A functor is a bit like a homomorphism, but at a higher level. What happens upstairs corresponds to what happens downstairs.

A functor must be compatible with composition. Consider the objects X Y and Z in C. A morphism from X to Y, and a morphism from Y to Z, implies a specific morphism from X to Z. This is usually function composition in a concrete category. Apply f, and find three objects and three morphisms in D. The third morphism in D must be the composition of the first two morphisms in D. This usually follows, in a natural way, from the construction of f, but you should always take a moment to prove it.

Algebraic topology is full of functors. The most familiar is the fundamental group of a topological space, denoted π(S). A continuous function from S into T induces a group homomorphism from π(S) into π(T).

I have described, thus far, a covariant functor. If f is a contravariant functor, then each morphism from X to Y implies a reverse morphism from f(Y) to f(X). Again, f must respect composition, so that X → Y and Y → Z implies X → Z maps to f(Z) → f(Y) and f(Y) → f(X) implies f(Z) → f(X). A classic example is galois theory, where embedding of field extensions corresponds to embedding of galois groups in reverse.

When inclusion corresponds to inclusion (covariant), or containment (contravariant), composition is never a problem. More generally, if there is at most one morphism between any two objects in the category, such as embedding, then the morphism from X to Z maps to the only possible morphism from f(X) to f(Z), which is the correct one, as dictated by composition.

There is much more to say about categories and functors, entire textbooks in fact, but in most branches of mathematics you only need a working knowledge of these topics to get by. We have enough machinery to describe spec-R as a contravariant functor, and that will do for now.