# 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

### `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$.

### `Example: Alg Mod Create (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

```

## The Action of an Algebra Element

### `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$.

### `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$.

### `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.

### `Example: Action (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]

```

## Related Structures of an Algebra Module

### `Algebra(M): ModAlg -> Alg`

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

### `CoefficientRing(M): ModAlg -> Fld`

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

### `Basis(M): ModAlg -> SeqEnum`

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

## Properties of an Algebra Module

### `IsLeftModule(M): ModAlg -> BoolElt`

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

### `IsRightModule(M): ModAlg -> BoolElt`

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

### `Dimension(M): ModAlg -> RngIntElt`

The dimension of the algebra module $M$.

## Creation of Algebra Modules from other Algebra Modules

### `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$.

### `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.

### `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$.

### `Example: Other Mod (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]

```

### `sub< M | S >: ModAlg, [ModAlgElt] -> ModAlg`

### `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$.

### `quo< M | S >: ModAlg, [ModAlgElt] -> ModAlg`

### `quo< M | e1, ..., en >: ModAlg, ModAlgElt, ..., ModAlgElt -> ModAlg`

### `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$.
