Category theory is the mathematical field that studies categories, which are a certain kind of mathematical structure. Categories are found throughout mathematics, and category theory thus has many mathematical applications. It is a basis for intuitionistic type theory, and as such has applications in computer science as a basis for functional programming semantics.
To constitute a category, some things (called the morphisms of the category) must have three main features:
The canonical example (which most of the above terminology and notation is derived from) is functions, where the objects are sets, the source is the domain and the target is the range and, unsurprisingly, the composition operation is function composition and the identity morphism for a set A is the identity function on A.[1] Many special kinds of function are closed under composition (i.e. the composition of two functions of that kind is also of that kind), and will therefore form a category in their own right. For example the composition of two injective functions is itself injective. Generally the composition of two structure-preserving maps (e.g. two group homomorphisms, two linear maps, two isometries, two diffeomorphisms etc etc) will preserve the same structure, so each of these forms a category. Although it is the morphisms that determine the category, it is often the objects that mathematicians are interested in, and so many categories are named after the objects. The category whose morphisms are all the group homomorphisms is denoted Grp for example. A simple example where the composition is not function composition is paths in the plane, where the source is the initial point and the target is the terminal point. If one path starts where the other finishes then the two paths can be juxtaposed to get a composite path. Here the objects are points and the identity morphisms are constant paths.
A more elementary example is Category 2, the skeletal version of the full category of sets of cardinality < 2[2].
A more concrete example would be geometric transformations. Think of a thing on a table, say a tray. The tray can be shifted across the table S and then rotated R, and these can be viewed as morphisms in a category of just one object: the tray[3]. Composition simply means that two actions such as F and R can be thought of as combined into a single action R∘F, which is the act of performing both consecutively, F and then R (note the annoying change in order that the notation requires: "F then R" is R∘F).
These actions are indeed associative. Think of three motions of the tray:
If we perform all three, the flip and rotation can be thought of as combined into a single motion, then followed by the shift; this would be denoted S∘(R∘F). Alternatively, the rotation and shift can be thought of as a single motion following the flip: (S∘R)∘F. Associativity simply means that S∘(R∘F) = (S∘R)∘F, which is true, as both correspond to doing all three in order. The identity motion for the tray is to leave it where it is, that is the tray starts and ends up in the same position. For example if T denotes shifting the tray 1m South then T∘S and S∘T are identity motions. We say in these circumstances that T is an inverse for S.
Many applications of category theory such as this can be thought of as based on two concepts: objects and the things which act on objects. When diverse mathematical structures are recognized to be categorial objects and the relationships between objects to be categorial morphisms, the theory expresses features shared by diverse subjects. For example, arithmetic has the product of a pair of numbers, set theory has the Cartesian product of a pair of sets and logic has the conjunction of a pair of assertions. These three products and many others are instances of the categorial product. Furthermore, the product is a specific instance of the more general notion of a limit and a limit is a specific universal property. By such generalizations, category theory unifies mathematics at a high level of abstraction.