In category theory, an end of a functor                     S        :                              C                                              o              p                                      ×                  C                →                  X                         is a universal extranatural transformation from an object e of X to S.
More explicitly, this is a pair                     (        e        ,        ω        )                , where e is an object of X and
                    ω        :        e                                            →              ¨                                      S                is an extranatural transformation such that for every extranatural transformation
                    β        :        x                                            →              ¨                                      S                there exists a unique morphism
                    h        :        x        →        e                of X with
                              β                      a                          =                  ω                      a                          ∘        h                for every object a of C.
By abuse of language the object e is often called the end of the functor S (forgetting                     ω                ) and is written
                    e        =                  ∫                      c                                              S        (        c        ,        c        )                   or just                           ∫                                    C                                                          S        .                Characterization as limit: If X is complete, the end can be described as the equaliser in the diagram
                              ∫                      c                          S        (        c        ,        c        )        →                  ∏                      c            ∈            C                          S        (        c        ,        c        )        ⇉                  ∏                      c            →                          c              ′                                      S        (        c        ,                  c          ′                )        ,                where the first morphism is induced by                     S        (        c        ,        c        )        →        S        (        c        ,                  c          ′                )                 and the second morphism is induced by                     S        (                  c          ′                ,                  c          ′                )        →        S        (        c        ,                  c          ′                )                .
The definition of the coend of a functor                     S        :                              C                                              o              p                                      ×                  C                →                  X                         is the dual of the definition of an end.
Thus, a coend of S consists of a pair                     (        d        ,        ζ        )                , where d is an object of X and
                    ζ        :        S                                            →              ¨                                      d                is an extranatural transformation, such that for every extranatural transformation
                    γ        :        S                                            →              ¨                                      x                there exists a unique morphism
                    g        :        d        →        x                of X with
                              γ                      a                          =        g        ∘                  ζ                      a                                  for every object a of C.
The coend d of the functor S is written
                    d        =                  ∫                                          c                          S        (        c        ,        c        )                   or                           ∫                                                        C                                      S        .                Characterization as colimit: Dually, if X is cocomplete, then the coend can be described as the coequalizer in the diagram
                              ∫                      c                          S        (        c        ,        c        )        ←                  ∐                      c            ∈            C                          S        (        c        ,        c        )        ⇇                  ∐                      c            →                          c              ′                                      S        (                  c          ′                ,        c        )        .                Natural transformations:Suppose we have functors                     F        ,        G        :                  C                →                  X                         then
                                          H            o            m                                              X                                      (        F        (        −        )        ,        G        (        −        )        )        :                              C                                o            p                          ×                  C                →                  S          e          t                        .
In this case, the category of sets is complete, so we need only form the equalizer and in this case
                              ∫                      c                                                H            o            m                                              X                                      (        F        (        c        )        ,        G        (        c        )        )        =                  N          a          t                (        F        ,        G        )                the natural transformations from                     F                 to                     G                . Intuitively, a natural transformation from                     F                 to                     G                 is a morphism from                     F        (        c        )                 to                     G        (        c        )                 for every                     c                 in the category with compatibility conditions. Looking at the equalizer diagram defining the end makes the equivalence clear.
Geometric realizations:Let                     T                 be a simplicial set. That is,                     T                 is a functor                               Δ                                    o              p                                      →                  S          e          t                        . The discrete topology gives a functor                               S          e          t                →                  T          o          p                        , where                               T          o          p                         is the category of topological spaces. Moreover, there is a map                     γ        :        Δ        →                  T          o          p                         which sends the object                     [        n        ]                 of                     Δ                 to the standard                     n                 simplex inside                                           R                                n            +            1                                  . Finally there is a functor                               T          o          p                ×                  T          o          p                →                  T          o          p                         which takes the product of two topological spaces.
Define                     S                 to be the composition of this product functor with                     T        ×        γ                . The coend of                     S                 is the geometric realization of                     T                .