---
title: "The Hom Functor"
canonical: "https://docs.magma-maths.org/v2.30-1/FinitelyPresentedGroups/AbelianGroups/hom.html"
source: "https://docs.magma-maths.org/v2.30-1/FinitelyPresentedGroups/AbelianGroups/hom.md"
part: "Finitely Presented Groups"
chapter: "Abelian Groups"
breadcrumbs:
  - {"title": "Magma Handbook", "source": "https://docs.magma-maths.org/v2.30-1/index.md"}
  - {"title": "Finitely Presented Groups", "source": "https://docs.magma-maths.org/v2.30-1/FinitelyPresentedGroups/index-finitely-presented-groups.md"}
  - {"title": "Abelian Groups", "source": "https://docs.magma-maths.org/v2.30-1/FinitelyPresentedGroups/AbelianGroups/index-abelian-groups.md"}
prev: {"title": "Representation Theory", "source": "https://docs.magma-maths.org/v2.30-1/FinitelyPresentedGroups/AbelianGroups/character-representation.md"}
next: {"title": "Automorphism Groups", "source": "https://docs.magma-maths.org/v2.30-1/FinitelyPresentedGroups/AbelianGroups/autgp.md"}
intrinsics:
  - {"name": "Hom", "signature": "Hom(G, H): GrpPC, GrpPC -> GrpAb, Map"}
  - {"name": "Hom", "signature": "Hom(G, H): GrpAb, GrpAb -> GrpAb, Map"}
  - {"name": "HomGenerators", "signature": "HomGenerators(G, H): GrpAb, GrpAb -> GrpAb, Map"}
  - {"name": "AllHomomorphisms", "signature": "AllHomomorphisms(G, H): GrpAb, GrpAb -> [Map]"}
  - {"name": "AllHomomorphisms", "signature": "AllHomomorphisms(G, H): GrpPC, GrpPC -> [Map]"}
  - {"name": "Homomorphisms", "signature": "Homomorphisms(G, H): GrpAb, GrpAb -> [Map]"}
examples:
  - "ex-0d5388"
---

# The Hom Functor

<a id="function-hom-grppc-grppc"></a>
## `Hom(G, H): GrpPC, GrpPC -> GrpAb, Map`

<a id="function-hom-grpab-grpab"></a>
## `Hom(G, H): GrpAb, GrpAb -> GrpAb, Map`

Given finite abelian groups $G$ and $H$, return an abelian group $A$ isomorphic to ${\rm Hom}(G, H)$, and a transfer map $t$ such that, given an element $a$ of $A$, $t(a)$ yields the corresponding (Magma `Map` type) homomorphism from $G$ to $H$. The structure of ${\rm Hom}(G, H)$ may thus be analyzed by examining $A$.

<a id="function-homgenerators-grpab-grpab"></a>
## `HomGenerators(G, H): GrpAb, GrpAb -> GrpAb, Map`

Given finite abelian groups $G$ and $H$, return a sequence of ($Z$-module) generators of ${\rm Hom}(G, H)$. The generators are returned as actual (Magma `Map` type) homomorphisms. Note that ${\rm Hom}(G, H)$ is usually not free, so it is difficult to generate all homomorphisms uniquely using the generators alone (use `Hom` or `Homomorphisms` if that is desired).

<a id="function-allhomomorphisms-grpab-grpab"></a>
## `AllHomomorphisms(G, H): GrpAb, GrpAb -> [Map]`

<a id="function-allhomomorphisms-grppc-grppc"></a>
## `AllHomomorphisms(G, H): GrpPC, GrpPC -> [Map]`

<a id="function-homomorphisms-grpab-grpab"></a>
## `Homomorphisms(G, H): GrpAb, GrpAb -> [Map]`

Given finite abelian groups $G$ and $H$, return a sequence containing all elements of ${\rm Hom}(G, H)$. The elements are returned as actual (Magma `Map` type) homomorphisms. Note that this function simply uses `Hom`, transferring each element of the returned group to the actual Magma `Map` type homomorphism.

<a id="example-ex-0d5388"></a>
## `Example: Hom Functor on Abelian Groups (ex-0d5388)`

We examine $A={\rm Hom}(G, H)$, for certain abelian groups $G$ and $H$.

```magma
> G := AbelianGroup([2, 3]);
> H := AbelianGroup([4, 6]);
> A, t := Hom(G, H);
> #A;
12
> A;
Abelian Group isomorphic to Z/2 + Z/6
Defined on 2 generators
Relations:
    2*A.1 = 0
    6*A.2 = 0
> h := t(A.1);
> h;
Mapping from: GrpAb: G to GrpAb: H
> h(G.1);
3*H.2
> h(G.2);
0
```

We now enumerate all elements of $A$ and examine the images of each generator of $G$ under each homomorphism. We note that each possible list of images occurs only once.

```magma
> I := [<h(G.1), h(G.2)> where h is t(x): x in A];
> I;
[
    <0, 0>,
    <3*H.2, 0>,
    <2*H.1, 2*H.2>,
    <2*H.1 + 3*H.2, 2*H.2>,
    <0, 4*H.2>,
    <3*H.2, 4*H.2>,
    <2*H.1, 0>,
    <2*H.1 + 3*H.2, 0>,
    <0, 2*H.2>,
    <3*H.2, 2*H.2>,
    <2*H.1, 4*H.2>,
    <2*H.1 + 3*H.2, 4*H.2>
]
> #I;
12
> #Set(I);
12
```
