---
title: "Primary Invariants"
canonical: "https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/InvariantTheory/primary.html"
source: "https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/InvariantTheory/primary.md"
part: "Commutative Algebra"
chapter: "Invariant Theory"
breadcrumbs:
  - {"title": "Magma Handbook", "source": "https://docs.magma-maths.org/v2.30-1/index.md"}
  - {"title": "Commutative Algebra", "source": "https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/index-commutative-algebra.md"}
  - {"title": "Invariant Theory", "source": "https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/InvariantTheory/index-invariant-theory.md"}
prev: {"title": "Molien Series", "source": "https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/InvariantTheory/molien.md"}
next: {"title": "Secondary Invariants", "source": "https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/InvariantTheory/secondary.md"}
intrinsics:
  - {"name": "PrimaryInvariants", "signature": "PrimaryInvariants(R): RngInvar -> [ RngMPolElt ]"}
examples:
  - "ex-93d2b8"
---

<a id="primary"></a>
<a id="rnginvar-primary"></a>
# Primary Invariants

Let $R=K[V]^G$ be the invariant ring of a finite group $G$ over the field $K$ and suppose the degree of $G$ is $n$. A set of *primary invariants* of $R$ is a set $\{ f_1, \ldots, f_n \}$ of $n$ algebraically independent homogeneous invariants of $R$ such that the invariant ring $R$ is a finitely generated module over $A = K[f_1, \ldots, f_n]$. A set of primary invariants always exists for any invariant ring $R$. The invocation `PrimaryInvariants(R)` allows automatic construction of primary invariants of $R$. The primary invariants are stored in $R$ and recalled as necessary in subsequent computations. The latest algorithm in Magma to compute primary invariants, due to G. Kemper [[Kem99](https://docs.magma-maths.org/v2.30-1/references.md#cite-kemper-primaries)], now guarantees that the degrees of the primary invariants found by the algorithm are optimal (with respect to their product and then their sum).

<a id="function-rnginvar-primaryinvariants"></a>
## `PrimaryInvariants(R): RngInvar -> [ RngMPolElt ]`

Construct optimal primary invariants for the invariant ring $R=K[V]^G$ as a sorted sequence (with increasing degrees) of $n$ polynomials of $R$ where $n$ is the degree of $G$.

<a id="example-ex-93d2b8"></a>
## `Example: Primary Invariants of an A5 Representation (ex-93d2b8)`

We compute primary invariants for the “first $A_5$ in ${\operatorname{SL}}({\bf F}_{2})$”, discussed in [[AM94](https://docs.magma-maths.org/v2.30-1/references.md#cite-ademmilgram), p. 116]. The resulting degrees $3, 5, 8$, and $12$ are necessarily optimal (see [[Kem96](https://docs.magma-maths.org/v2.30-1/references.md#cite-kemper-invar)]).

```magma
> K := GF(2);
> G := MatrixGroup<4, K |
>     [0,1,0,0, 1,1,0,0, 0,0,1,1, 0,0,1,0],
>     [1,0,0,0, 0,1,0,0, 1,0,1,0, 0,1,0,1],
>     [1,0,1,0, 0,1,0,1, 0,0,1,0, 0,0,0,1]>;
> R := InvariantRing(G);
> time p := PrimaryInvariants(R);
Time: 1.399
> [TotalDegree(f): f in p];
[ 3, 5, 8, 12 ]
```
