Canonical: https://knowlpedia.com/algebra-category-theory/category/

# Category

A structure of objects and morphisms with associative composition and identity morphisms.

A **category** \(\mathcal C\) consists of:

1. A collection \(\mathrm{Ob}(\mathcal C)\) of **[objects](https://knowlpedia.com/algebra-category-theory/object/)**.
2. For each pair \(X,Y \in \mathrm{Ob}(\mathcal C)\), a collection \(\mathrm{Hom}_{\mathcal C}(X,Y)\) of **[morphisms](https://knowlpedia.com/algebra-category-theory/morphism/)** \(X \to Y\).
3. For each triple \(X,Y,Z\), a **[composition](https://knowlpedia.com/algebra-category-theory/composition-category/)** operation
   \[
   \circ : \mathrm{Hom}_{\mathcal C}(Y,Z)\times \mathrm{Hom}_{\mathcal C}(X,Y)\to \mathrm{Hom}_{\mathcal C}(X,Z),
   \quad (g,f)\mapsto g\circ f.
   \]
4. For each object \(X\), an **[identity morphism](https://knowlpedia.com/algebra-category-theory/identity-morphism/)** \(1_X \in \mathrm{Hom}_{\mathcal C}(X,X)\).

These data satisfy:

- **Associativity:** \(h\circ(g\circ f)=(h\circ g)\circ f\) whenever the composites are defined.
- **Identity laws:** \(1_Y\circ f=f=f\circ 1_X\) for every \(f:X\to Y\).

These two laws are the **category axioms**. Associativity means a composite such as \(h\circ g\circ f\) can be written without parentheses.

## Guiding picture

The definition abstracts the behavior of [functions](https://knowlpedia.com/shared-foundations/function/) and their [composition](https://knowlpedia.com/shared-foundations/composition/).

## Examples

1. **\(\mathbf{Set}\)**: objects are [sets](https://knowlpedia.com/shared-foundations/set/), morphisms are [functions](https://knowlpedia.com/shared-foundations/function/), composition is ordinary function composition, and \(1_X\) is the [identity function](https://knowlpedia.com/shared-foundations/identity-function/) on \(X\).
2. **\(\mathbf{Grp}\)**: objects are groups, morphisms are group homomorphisms, with composition given by composing homomorphisms.
3. **\(\mathbf{Top}\)**: objects are topological spaces, morphisms are continuous maps, with composition the usual composition of continuous maps.
4. **\(R\text{-}\mathbf{Mod}\)**: objects are left \(R\)-[modules](https://knowlpedia.com/algebra-modules/module/), morphisms are \(R\)-linear maps, with the usual composition and identities.
