---
title: "Modules over a General Algebra"
canonical: "https://docs.magma-maths.org/v2.30-1/RepresentationTheory/ModulesOverAnAlgebraAndGroupRepresentations/modules-matrix-algebra.html"
source: "https://docs.magma-maths.org/v2.30-1/RepresentationTheory/ModulesOverAnAlgebraAndGroupRepresentations/modules-matrix-algebra.md"
part: "Representation Theory"
chapter: "Modules over an Algebra and Group Representations"
breadcrumbs:
  - {"title": "Magma Handbook", "source": "https://docs.magma-maths.org/v2.30-1/index.md"}
  - {"title": "Representation Theory", "source": "https://docs.magma-maths.org/v2.30-1/RepresentationTheory/index-representation-theory.md"}
  - {"title": "Modules over an Algebra and Group Representations", "source": "https://docs.magma-maths.org/v2.30-1/RepresentationTheory/ModulesOverAnAlgebraAndGroupRepresentations/index-modules-over-an-algebra-and-group-representations.md"}
prev: {"title": "Enumerating All Irreducible Modules", "source": "https://docs.magma-maths.org/v2.30-1/RepresentationTheory/ModulesOverAnAlgebraAndGroupRepresentations/construct-irreds.md"}
next: {"title": "Bibliography", "source": "https://docs.magma-maths.org/v2.30-1/RepresentationTheory/ModulesOverAnAlgebraAndGroupRepresentations/bibliography.md"}
intrinsics:
  - {"name": "Module", "signature": "Module(A, m): Alg, Map[SetCart, ModRng] -> ModAlg"}
  - {"name": "^", "signature": "a ^ v: AlgElt, ModAlgElt -> ModAlgElt"}
  - {"name": "^", "signature": "v ^ a: ModAlgElt, AlgElt -> ModAlgElt"}
  - {"name": "ActionMatrix", "signature": "ActionMatrix(M, a): ModAlg, AlgElt -> AlgMatElt"}
  - {"name": "Algebra", "signature": "Algebra(M): ModAlg -> Alg"}
  - {"name": "CoefficientRing", "signature": "CoefficientRing(M): ModAlg -> Fld"}
  - {"name": "Basis", "signature": "Basis(M): ModAlg -> SeqEnum"}
  - {"name": "IsLeftModule", "signature": "IsLeftModule(M): ModAlg -> BoolElt"}
  - {"name": "IsRightModule", "signature": "IsRightModule(M): ModAlg -> BoolElt"}
  - {"name": "Dimension", "signature": "Dimension(M): ModAlg -> RngIntElt"}
  - {"name": "DirectSum", "signature": "DirectSum(Q): SeqEnum -> ModAlg, SeqEnum, SeqEnum"}
  - {"name": "SubalgebraModule", "signature": "SubalgebraModule(B, M): Alg, ModAlg -> ModAlg"}
  - {"name": "ModuleWithBasis", "signature": "ModuleWithBasis(Q): SeqEnum -> ModAlg"}
  - {"name": "sub", "signature": "sub< M | S >: ModAlg, [ModAlgElt] -> ModAlg"}
  - {"name": "sub", "signature": "sub< M | e1, ..., en >: ModAlg, ModAlgElt, ..., ModAlgElt -> ModAlg"}
  - {"name": "quo", "signature": "quo< M | S >: ModAlg, [ModAlgElt] -> ModAlg"}
  - {"name": "quo", "signature": "quo< M | e1, ..., en >: ModAlg, ModAlgElt, ..., ModAlgElt -> ModAlg"}
  - {"name": "quo", "signature": "quo< M | S >: ModAlg, ModAlg -> ModAlg"}
examples:
  - "ex-dc2928"
  - "ex-72e8cf"
  - "ex-720705"
---

# Modules over a General Algebra

## Introduction

This section describes the functionality for modules over general algebras in Magma and is independent of the earlier chapters. A left-module over an algebra $A$ is a module $M$ together with a bilinear map $A\times M\to M$. A right-module over $A$ is a module $M$ together with a bilinear map $M\times A\to M$. Magma provides functionality for both kinds of modules.

## Construction of Algebra Modules

<a id="function-module-alg-map-setcart-modrng"></a>
### `Module(A, m): Alg, Map[SetCart, ModRng] -> ModAlg`

For an algebra $A$ this function creates a module over $A$. If the module will be a left-module then $m$ is a map from the Cartesian product $A\times M$ to $M$. If the module will be a right-module then $m$ is a map from $M\times A$ to $M$. Here $M$ has to be an $R$-module, where $R$ is the coefficient field of $A$.

<a id="example-ex-dc2928"></a>
### `Example: Natural Module of a Matrix Algebra (ex-dc2928)`

We create the right-module over the full matrix algebra of $3\times 3$ - matrices acting on its natural module.

```magma
> A:= MatrixAlgebra(Rationals(), 3);
> V:= RModule(Rationals(), 3);
> m:= map< CartesianProduct(V, A) -> V | t :-> t[1]*t[2] >;
> Module(A, m);
Right Module of Full Matrix Algebra of degree 3 over Rational Field
```

<a id="action"></a>
<a id="sectmodalgact"></a>
## The Action of an Algebra Element

<a id="operation-op-pow-algelt-modalgelt"></a>
### `a ^ v: AlgElt, ModAlgElt -> ModAlgElt`

Given an element $v$ of a left-module over an algebra $A$, and an element $a$ of $A$ computes the result of letting $a$ act on $v$.

<a id="operation-op-pow-modalgelt-algelt"></a>
### `v ^ a: ModAlgElt, AlgElt -> ModAlgElt`

Given an element $v$ of a right-module over an algebra $A$ and an element $a$ of $A$ computes the result of letting $a$ act on $v$.

<a id="function-actionmatrix-modalg-algelt"></a>
### `ActionMatrix(M, a): ModAlg, AlgElt -> AlgMatElt`

Given a module $M$ over an algebra $A$ and an element $a$ of $A$ returns the matrix of the action of $a$ on $M$. If $M$ is a left-module then the $i$-th column of this matrix contains the coordinates of the image of $a$ acting on the $i$-th basis element of $M$. If $A$ is a right-module then the rows contain these coordinates.

<a id="example-ex-72e8cf"></a>
### `Example: Action Matrices of Algebra Elements (ex-72e8cf)`

```magma
> A:= MatrixAlgebra(Rationals(), 3);
> V:= RModule(Rationals(), 3);
> m:= map< CartesianProduct(V, A) -> V | t :-> t[1]*t[2] >;
> M:=Module(A, m);
> M.1^A.1;
M: (1 0 0)
> ActionMatrix(M, A.2);
[0 1 0]
[0 0 1]
[1 0 0]
```

<a id="related-structures"></a>
<a id="sectmodalgrelstr"></a>
## Related Structures of an Algebra Module

<a id="function-algebra-modalg"></a>
### `Algebra(M): ModAlg -> Alg`

This returns the algebra over which the algebra module $M$ is defined.

<a id="function-coefficientring-modalg"></a>
### `CoefficientRing(M): ModAlg -> Fld`

Returns the ground field of the algebra module $M$.

<a id="function-basis-modalg"></a>
### `Basis(M): ModAlg -> SeqEnum`

Returns a sequence containing the basis vectors of the algebra module $M$.

<a id="properties"></a>
<a id="sectmodalgprop"></a>
## Properties of an Algebra Module

<a id="function-isleftmodule-modalg"></a>
### `IsLeftModule(M): ModAlg -> BoolElt`

This returns `true` if the algebra module $M$ is a left-module, and `false` if it is a right module.

<a id="function-isrightmodule-modalg"></a>
### `IsRightModule(M): ModAlg -> BoolElt`

This returns `true` if the algebra module $M$ is a right-module, and `false` if it is a left module.

<a id="function-dimension-modalg"></a>
### `Dimension(M): ModAlg -> RngIntElt`

The dimension of the algebra module $M$.

<a id="creation-other-modules"></a>
<a id="sectmodalgotheralgmod"></a>
## Creation of Algebra Modules from other Algebra Modules

<a id="function-directsum-seqenum"></a>
### `DirectSum(Q): SeqEnum -> ModAlg, SeqEnum, SeqEnum`

Given a sequence $Q$ of algebra modules (all defined over the same algebra, and all left (respectively right) modules), returns the module $M$ that is the direct sum of the modules in $Q$. Furthermore, two sequences of mappings are returned. The $i$-th element of the first sequence is the embedding of the $i$-th element of $Q$ into $M$. The $i$-th element of the second sequence is the projection of $M$ onto the $i$-th element of $Q$.

<a id="function-subalgebramodule-alg-modalg"></a>
### `SubalgebraModule(B, M): Alg, ModAlg -> ModAlg`

Given an algebra module $M$ over the algebra $A$, and a subalgebra $B$ of $A$, return $M$ as a $B$-module.

<a id="function-modulewithbasis-seqenum"></a>
### `ModuleWithBasis(Q): SeqEnum -> ModAlg`

Given a sequence $Q$ containing the elements of a particular basis of an algebra module $M$, create an algebra module that is isomorphic to $M$, but with basis $Q$. (Or, more precisely, the basis vectors of the module $V$ that is returned are in bijection with $Q$. The action of an algebra element on the $i$-th basis vector of $V$ is computed by computing it on the $i$-th vector in $Q$ and expressing the result as a linear combination of the elements of $Q$. The resulting coordinates are used to form the corresponding element of $V$.) This can be used to compute the action of algebra elements with respect to a given basis of $M$.

<a id="example-ex-720705"></a>
### `Example: Direct Sums of Algebra Modules (ex-720705)`

```magma
> A:= MatrixAlgebra(Rationals(), 3);
> V:= RModule(Rationals(), 3);
> m:= map< CartesianProduct(V, A) -> V | t :-> t[1]*t[2] >;
> M:=Module(A, m);
> N:=DirectSum([ M, M ]);
> ActionMatrix(N, A.1);
[1 0 0 0 0 0]
[0 0 0 0 0 0]
[0 0 0 0 0 0]
[0 0 0 1 0 0]
[0 0 0 0 0 0]
[0 0 0 0 0 0]
> W:= ModuleWithBasis([ M.1+M.2+M.3, M.2+M.3, M.3 ]);
> ActionMatrix(W, A.1);
[ 1 -1  0]
[ 0  0  0]
[ 0  0  0]
```

<a id="constructor-constructor-sub-modalg-modalgelt-modalg"></a>
### `sub< M | S >: ModAlg, [ModAlgElt] -> ModAlg`

<a id="constructor-constructor-sub-modalg-modalgelt-modalgelt-modalg"></a>
### `sub< M | e1, ..., en >: ModAlg, ModAlgElt, ..., ModAlgElt -> ModAlg`

Return the submodule of $M$ containing the elements in the sequence $S$ or the elements $e1$, $\ldots$, $en$.

<a id="constructor-constructor-quo-modalg-modalgelt-modalg"></a>
### `quo< M | S >: ModAlg, [ModAlgElt] -> ModAlg`

<a id="constructor-constructor-quo-modalg-modalgelt-modalgelt-modalg"></a>
### `quo< M | e1, ..., en >: ModAlg, ModAlgElt, ..., ModAlgElt -> ModAlg`

<a id="constructor-constructor-quo-modalg-modalg-modalg"></a>
### `quo< M | S >: ModAlg, ModAlg -> ModAlg`

Construct the quotient module of $M$ by the submodule $S$ of $M$, the submodule containing the elements in the sequence $S$ or the elements $e1, ..., en$.
