1 Introduction

In [4, 5], the zeta polynomial of a q-ary linear code of length n and minimum distance d is defined to be the unique polynomial \(P_{\mathcal {C}}(T)\) of degree at most \(n-d\) such that the generating function has expansion around T given by

$$\begin{aligned} \frac{P_{\mathcal {C}}(T)}{(1-T)(1-qT)}(xT+y(1-T))^n = \cdots +\frac{A_{\mathcal {C}}(x,y)-x^n}{q-1} T^{n-d}+ \cdots , \end{aligned}$$
(1.1)

where \(A_{\mathcal {C}}(x,y)\) is the Hamming weight enumerator of \(\mathcal {C}\). For an MDS code \(\mathcal {C}\), the weight enumerator \(A_{\mathcal {C}}(x,y)\) is obtained by setting \(P_\mathcal {C}(T)=1\). In general the degree of \(P_\mathcal {C}(T)\) is given by \(n+2-d-d^\perp \ge 0\) and is equal to zero if and only if the code is MDS. For codes with high minimum distance and high dual minimum distance, the weight enumerator is completely determined by the polynomial \(P_\mathcal {C}(T)\) of small degree. In such cases there is an advantage in encoding the weight enumerator \(A_\mathcal {C}(x,y)\) by the smaller polynomial \(P_\mathcal {C}(T)\). Among the properties of the zeta polynomial \(P_\mathcal {C}(T)\) is an easy transform between the polynomials \(P_\mathcal {C}(T)\) and \(P_{\mathcal {C}^\perp }(T)\) for the code and its dual, and invariance under puncturing and shortening for codes that have a transitive automorphism group. For example, a cyclic code and its extended code use (1.1) with the same zeta polynomial \(P_\mathcal {C}(T)\) but with different n and d. The special form of the generating function is motivated by its interpretation for Reed–Solomon codes. A Reed–Solomon codeword represents the values of a polynomial in the elements of a finite field. The generating function counts the number of zeroes of polynomials and therefore describes the weight distribution of Reed–Solomon codes.

In this paper we establish that the zeta polynomial and its properties have q-analogues for rank metric codes. Rank metric codes have a Singleton type upper bound for the parameters. Codes that attain the bound are called maximum rank distance codes (MRD codes). They include Gabidulin codes that are the q-analogues of Reed–Solomon codes. The rank distance distribution of a MRD code is uniquely determined by the parameters of the code. The rank metric zeta function has the property that \(P_\mathcal {C}(T) = 1\) for MRD codes, and thus in particular for Gabidulin codes. In general the zeta polynomial is of low degree if both the minimum distance and the dual minimum distance of a code are close to the Singleton bound.

In Sect. 2 we summarize some preliminary material and definitions. In Sect. 3 we introduce the zeta function \(Z_{\mathcal {C}}(T)\) of a rank metric code \(\mathcal {C}\) in terms of its normalized q-binomial moments, and we define the q-analogue of the zeta polynomial for a rank metric code with the generating function \(Z_{\mathcal {C}}(T)\). In analogy with the Hamming metric case \(P_\mathcal {C}(T)=1\) if and only if \(\mathcal {C}\) is an MRD code. In Sect. 4 we relate the weight enumerator of a rank metric code \(\mathcal {C}\) with its zeta polynomial and obtain the rank metric analogue of (1.1). Moreover, we show that coefficients of the zeta polynomial coincide with those in the representation of a weight enumerator as a \({\mathbb {Q}}\)-linear combination of MRD weight enumerators. In Sect. 5 we establish relations between the polynomials \(P_\mathcal {C}(T)\) and \(P_{\mathcal {C}^\perp }(T)\) for a code and its dual. We then demonstrate that the zeroes of \(P_\mathcal {C}(T)\) can be related to the minimum distance of a code by giving an upper bound for the minimum distance in terms of these zeroes. In Sect. 6 we define operations of puncturing and shortening of rank metric codes and show that the action of these on the average weight enumerator of a code can be realized in terms of q-derivatives. As in the Hamming metric case the zeta polynomial is invariant under puncturing and shortening. We introduce the normalized weight enumerator and express the action of puncturing and shortening on it in terms of q-commuting operators. In Sect. 7 we discuss the zeroes of the zeta polynomial. For a self-dual code, the reciprocal zeroes occur in pairs \(\{ \alpha , q^m / \alpha \}\) and occur as conjugate pairs if and only if both have absolute value \(q^{m/2}.\) We consider some classes of codes with zeta polynomials for which all complex zeroes have the same absolute value.

2 Preliminaries

We will assume that mn are positive integers with \(n \le m\) and that q is an arbitrary prime power. We write \({\mathbb {F}}_q^{m \times n}\) to denote the \(m \times n\) matrices with entries in \({\mathbb {F}}_q\). For any \(X \in {\mathbb {F}}_q^{m\times n}\), we write \(\ker X\) or \(X^\perp \) to denote the (right) nullspace of X in \({\mathbb {F}}_q^n\). That is,

$$\begin{aligned} X^\perp :=\{y \in {\mathbb {F}}_q^n : Xy^T = 0 \}. \end{aligned}$$

Unless explicitly stated otherwise, we assume that \(\mathcal {C}\) is an \({\mathbb {F}}_q\)-linear subspace of \({\mathbb {F}}_q^{m \times n}\).

Definition 1

The dual code of \(\mathcal {C}\) is the \({\mathbb {F}}_q\)-linear code

$$\begin{aligned} \mathcal {C}^\perp := \big \{Y \in {\mathbb {F}}_q^{m \times n}: \text{ Tr }(XY^t)=0 \text{ for } \text{ all } X \in \mathcal {C}\big \}. \end{aligned}$$

The map \((X,Y) \mapsto \text{ Tr }(XY^t)\) defines an inner product on the space \({\mathbb {F}}_q^{m \times n}\), so we have \(\dim (\mathcal {C}^\perp )=mn-\dim (\mathcal {C})\) and \(\mathcal {C}^{\perp \perp }=\mathcal {C}\).

Definition 2

The rank distance between matrices \(X,Y \in {\mathbb {F}}_q^{m \times n}\) is \(d(X,Y):=\text{ rk }(X-Y)\). For \(|\mathcal {C}| \ge 2\), the minimum rank distance of \(\mathcal {C}\) is the integer defined by \(d(\mathcal {C}):= \min \{d(X,Y) : X,Y \in \mathcal {C}, \ X \ne Y\}\). The weight distribution of \(\mathcal {C}\) is the integer vector \(W(\mathcal {C})=(W_t(\mathcal {C}) : 0 \le t \le n)\), where, for all \(t \in \{0,\ldots ,n\}\),

$$\begin{aligned} W_t(\mathcal {C}):=|\{X \in \mathcal {C}: \text{ rk }(X)=t\}|. \end{aligned}$$

The rank metric weight enumerator of \(\mathcal {C}\) is the bivariate polynomial

$$\begin{aligned} W_{\mathcal {C}}(x,y)=\sum _{t=0}^nW_{t}(\mathcal {C})x^{n-t}y^{t}. \end{aligned}$$
(2.1)

Recall that the Gaussian binomial or q-binomial coefficient is defined by

$$\begin{aligned} \left[ \begin{matrix} n \\ r \end{matrix} \right] _{q} := \left\{ \begin{array}{ll} \displaystyle {\frac{(q^n-1)(q^n-q)\cdots (q^n-q^{r-1})}{(q^r-1)(q^r-q)\cdots (q^r-q^{r-1})} }&{} \text { if } r \in \{1,\ldots ,n\},\\ 1 &{} \text { if } r = 0, \\ 0 &{} \text { otherwise.} \end{array} \right. \end{aligned}$$

This quantity counts the number of r-dimensional subspaces of an n-dimensional subspace over \({\mathbb {F}}_q\). Since all the Gaussian binomial coefficients are with respect to q throughout this paper, for brevity we write \(\left[ \begin{matrix} n \\ r \end{matrix} \right] _{}\) to mean \(\left[ \begin{matrix} n \\ r \end{matrix} \right] _{q}\). The rank metric analogue of the Singleton bound says that \(|\mathcal {C}| \le q^{m(n-d+1)}\) for any \(\mathcal {C}\) of minimum rank distance d [2]. Rank metric codes that meet this bound are called maximum-rank-distance (MRD) codes. It has been known for some decades that such codes exist for all choices of mnd [2, 7, 13]. In [2] it was shown that the weight enumerator of an MRD code in \({\mathbb {F}}_q^{m \times n}\) of minimum distance d is uniquely determined and given by

$$\begin{aligned} M_{n,d}(x,y):= x^n+ \sum _{t=d}^n\sum _{i=d}^t(-1)^{t-i}q^{\left( {\begin{array}{c}t-i\\ 2\end{array}}\right) }{{n}\brack {t}}{{t}\brack {i}}(q^{m(i-d+1)}-1)x^{n-t}y^t, \end{aligned}$$

where the coefficient of \(x^{n-t}y^t\) counts the number of matrices in the MRD code of rank t. It is not hard to see that for fixed n the \(M_{n,d}\) are linearly independent over \({\mathbb {Q}}\). Any code \(\mathcal {C}\) whose dual code has minimum distance at least 2 has weight enumerator that can be expressed as a \({\mathbb {Q}}\)-linear combination of the MRD weight enumerators. That is, there exist \(p_0,\ldots ,p_{n-d} \in {\mathbb {Q}}\) satisfying

$$\begin{aligned} W_{\mathcal {C}}(x,y) = p_0 M_{n,d}(x,y)+ \cdots + p_{n-d} M_{n,n}(x,y). \end{aligned}$$

These coefficients will turn out to define the zeta polynomial of \(\mathcal {C}\), that we introduce in the next section.

Let P be a partially ordered set (poset, from now on). The Möbius function for P is defined via the recursive formula

$$\begin{aligned} \begin{array}{l} \mu (x,x)=1,\\ \displaystyle \mu (x,z)=-\sum _{x\le y<z}\mu (x,y), \quad \text {for x < z.} \end{array} \end{aligned}$$
(2.2)

Lemma 1

(Möbius inversion formula) Let \(f,g:P\rightarrow \mathbb {Z}\) be any two functions on P. Then

  1. 1.

    \(\displaystyle f(x)=\sum _{x\le y}g(y) \text{ if } \text{ and } \text{ only } \text{ if } g(x)=\sum _{x\le y}\mu (x,y)f(y)\).

  2. 2.

    \(\displaystyle f(x)=\sum _{x\ge y}g(y) \text{ if } \text{ and } \text{ only } \text{ if } g(x)=\sum _{x\ge y}\mu (y,x)f(y)\).

In particular, for the subspace lattice of \(\mathbb {F}_q^{m\times n}\) (with partial order defined by set inclusion), and for two subspaces U and V of dimensions u and v, we have that

$$\begin{aligned} \mu \left( U,V\right) =\left\{ \begin{array}{ll} (-1)^{v-u}q^{\left( {\begin{array}{c}v-u\\ 2\end{array}}\right) }&{} \text{ if } U\le V\\ \\ 0 &{} \text{ otherwise. } \end{array} \right. \end{aligned}$$
(2.3)

3 The zeta function

We introduce the zeta function of a rank metric code \(\mathcal {C}\) in terms of its normalized q-binomial moments, following the approach for the Hamming metric case as given in [6]. In order to do so we use the notion of a shortened code (cf. [12]).

Definition 3

Let \(U\subseteq \mathbb {F}_q^n\) be a subspace of dimension u. The shortened subcode of \(\mathcal {C}\) with respect to U is

$$\begin{aligned} \mathcal {C}_U:=\left\{ X\in \mathcal {C}: U\le X^\perp \right\} . \end{aligned}$$

The strict shortening of \(\mathcal {C}\) by U is

$$\begin{aligned} \widehat{\mathcal {C}}_U:=\left\{ X\in \mathcal {C}: U= X^\perp \right\} . \end{aligned}$$

Notice that \(\mathcal {C}_U\) is a subspace (indeed a subcode of \(\mathcal {C}\)), but \(\widehat{\mathcal {C}}_U\) in general is not. Clearly every element of \(\widehat{\mathcal {C}}_{U}\) has rank exactly \(n-u\).

Definition 4

For \(u\ge 0\), the uth binomial moment of \(\mathcal {C}\) is defined by

$$\begin{aligned} B_u(\mathcal {C}):=\sum _{dim(U)=n-u}(|\mathcal {C}_U|-1). \end{aligned}$$

Lemma 3 is a straightforward consequence of the following duality result. The result is used in [12] to obtain a short proof of the MacWilliams’ Identity for rank metric codes.

Lemma 2

([12, Lemma 28]) Let U be a subspace of \({\mathbb {F}}_q^n\) of dimension \(n-u\). Then

$$\begin{aligned} |\mathcal {C}_U| = \frac{|\mathcal {C}||\mathcal {C}^\perp _{U^\perp }|}{q^{m(n-u)}}. \end{aligned}$$

Proof

Let \(R_U\) be the subspace of \(m \times n\) matrices over \({\mathbb F}_q\) with row vectors in U, and let \(b : \mathcal {C}\times R_U\) be the bilinear form with \(b(X,Y) = \text{ Tr }(XY^t).\) The left null space is \(\mathcal {C}_U\) and the right null space is \(R_U \cap C^\perp = C^\perp _{U^\perp }\). So that \(|\mathcal {C}|/|C_U| = |R_U|/|C^\perp _{U^\perp }|\). \(\square \)

Lemma 3

Let \(\mathcal {C}\) have dimension k and minimum rank distance d, and let \(\mathcal {C}^\perp \) have minimum distance \(d^\perp \). Then

$$\begin{aligned} B_u(\mathcal {C})= \left\{ \begin{array}{ll} 0 &{} \text { if } u < d \\ (q^{k-m(n-u)}-1) \left[ \begin{matrix} n \\ u \end{matrix} \right] _{} &{} \text { if } u > n-d^\perp \\ \end{array} \right. \end{aligned}$$

Proof

Any \(X \in \mathcal {C}\) satisfies \(\mathrm{rk}(X^\perp ) \le n-d\), so if U has dimension \(n-u > n-d\) then \(\mathcal {C}_U = \{0\}\). Similarly, \(C^\perp _{U^\perp } = \{0\}\) if \(\dim (U^\perp ) = u > n - d^\perp \) since every element \(X \in \mathcal {C}^\perp \) has rank at least \(d^\perp \). Then from Lemma 2 we get that

$$\begin{aligned} |\mathcal {C}_U|= \left\{ \begin{array}{ll} 1 &{} \text { if } u < d \\ q^{k-m(n-u)} &{} \text { if } u > n-d^\perp \\ \end{array} \right. . \end{aligned}$$

Since \(\left[ \begin{matrix} n \\ u \end{matrix} \right] _{}\) counts number of subspaces of \(\mathbb {F}_q^n\) of dimension \(n-u\), the result follows. \(\square \)

We remark that in the instance that \(\mathcal {C}\) is an MRD code, the values \(B_u(\mathcal {C})\) of Lemma 3 were given in [3]. Moreover, we may invoke Lemma 2 along with the Singleton bound to deduce that if U has dimension u then

$$\begin{aligned} |\mathcal {C}_U| \le |C| / q^{mu} \le q^{m(n-u-d+1)}. \end{aligned}$$

Definition 5

For \(u\ge 0\), the u-th normalized binomial moment of \(\mathcal {C}\) of minimum distance d is defined by

$$\begin{aligned} \displaystyle {b_u(\mathcal {C}):=\frac{B_{u+d}(\mathcal {C})}{{n \brack u+d}}}. \end{aligned}$$

Then \(b_u(\mathcal {C})\) counts the average number of non-zero elements of the shortened code \(\mathcal {C}_U\) where U has dimension \(n-u-d\).

We extend the definition of \(b_u\) to all \(u \in {\mathbb {Z}}\), by setting

$$\begin{aligned} b_u(\mathcal {C}) = {\left\{ \begin{array}{ll} 0, &{}\text { if } u < 0. \\ q^{k-m(n-u-d)}-1, &{}\text { if } u > n-d^\perp -d. \end{array}\right. } \end{aligned}$$

Note that if \(\mathcal {C}\) is an MRD code of minimum distance d then \(k=m(n-d+1)\) and \(d^\perp =n+2-d\). Then \(b_u(\mathcal {C}) = q^{m(u+1)}-1\) for all \(u\ge 0\). In particular, the values \(b_u(\mathcal {C})\) are independent of the minimum distance of \(\mathcal {C}\). For this reason we write \(b_u\) instead of \(b_u(\mathcal {C})\) in the cases that \(\mathcal {C}\) is MRD.

Definition 6

The zeta function of \(\mathcal {C}\) (cf. [6]) is defined by

$$\begin{aligned} Z_{\mathcal {C}}(T) := (q^m-1)^{-1}\sum _{u \ge 0} b_u(\mathcal {C}) T^u. \end{aligned}$$

It is straightforward to check that for \(u \notin \{0,\ldots ,n-d^\perp -d+2\} \) we have the following relation among the \(b_u(\mathcal {C})\), namely,

$$\begin{aligned} b_u(\mathcal {C}) - (q^m+1)b_{u-1}(\mathcal {C}) + q^m b_{u-2}(\mathcal {C}) =0. \end{aligned}$$
(3.1)

Definition 7

For \(u\ge 0\), define

$$\begin{aligned} p_u(\mathcal {C}):= (q^m-1)^{-1}(b_u(\mathcal {C}) - (q^m+1)b_{u-1}(\mathcal {C}) + q^m b_{u-2}(\mathcal {C}) ). \end{aligned}$$

The zeta polynomial of \(\mathcal {C}\) is defined by

$$\begin{aligned} P_{\mathcal {C}}(T):= \sum _{u=0}^{n-d^\perp -d+2} p_u(\mathcal {C}) T^{u}. \end{aligned}$$

Clearly, for any \(\mathcal {C}\), the zeta polynomial \(P_{\mathcal {C}}(T)\) has degree at most \(n-d+1\), and \(p_u(\mathcal {C})=0\) for any \(u > n-d-d^\perp +2\). We will assume that the minimum distance of the dual code is at least 2, and write

$$\begin{aligned} P_{\mathcal {C}}(T) = \sum _{u=0}^{n-d} p_u(\mathcal {C}) T^{u}. \end{aligned}$$

The recursion relates the zeta function and zeta polynomial via

$$\begin{aligned} Z_{\mathcal {C}}(T) = (q^m+1)TZ_{\mathcal {C}}(T) - q^m T^2 Z_{\mathcal {C}}(T) + P_{\mathcal {C}}(T), \end{aligned}$$

and hence we obtain that the generating function \(Z_{\mathcal {C}}(T)\) satisfies the equation

$$\begin{aligned} Z_{\mathcal {C}}(T) = \frac{P_{\mathcal {C}}(T)}{(1-T)(1-q^mT)}. \end{aligned}$$

This immediately yields the following for an MRD code.

Lemma 4

Let \(\mathcal {C}\) be an MRD code. Then \(P_{\mathcal {C}}(T)=1\) and

$$\begin{aligned} Z_{\mathcal {C}}(T) = \frac{1}{(1-T)(1-q^mT)}. \end{aligned}$$

Proof

\(\mathcal {C}\) is MRD if and only if \(d+d^\perp = n+2\), in which case (3.1) holds for all \(u>0\) and \(P_{\mathcal {C}}(T)=1\). \(\square \)

4 Weight enumerators and zeta functions

We will establish a relation between the weight enumerator of a code and its zeta function, giving the rank metric analogue of [5, Theorem 9.5]. We first approach this using Möbius inversion. Given a subspace U of \({\mathbb {F}}_q^n\), we have the relation:

$$\begin{aligned} \displaystyle |\mathcal {C}_U|=\sum _{U\le V} |\hat{\mathcal {C}}_V|, \end{aligned}$$
(4.1)

consequently, by the Möbius inversion formula we get

$$\begin{aligned} |\hat{\mathcal {C}}_U|=\sum _{U\le V}\mu (U,V) |{\mathcal {C}}_V|, \end{aligned}$$
(4.2)

for \(\mu (U,V)\) defined as in (2.3).

Next, we derive a more explicit description of \(W_{\mathcal {C}}(x,y)\) in terms of the normalized binomial moments.

Lemma 5

Let \(\mathcal {C}\) have minimum distance d and let be U a subspace of \(\mathbb {F}_q^n\) of dimension \(u < n\). Then

$$\begin{aligned} |\widehat{\mathcal {C}}_U|=\sum _{w=0}^{n-d-u}(-1)^wq^{\left( {\begin{array}{c}w\\ 2\end{array}}\right) }\sum _{\begin{array}{c}dim(V)=u+w\\ U\le V\end{array}}( |{\mathcal {C}}_V|-1) \end{aligned}$$

Proof

The Möbius recursive formula (2.2) applied with \(U < \mathbb {F}_q^n\) gives \(\sum _{U \le V} \mu (U,V) = 0.\) Also, with Lemma 3, \(|{\mathcal {C}}_V| = 1\) for \(v > n-d\). Thus,

$$\begin{aligned} |\widehat{\mathcal {C}}_U|= & {} \sum _{U\le V} \mu (U,V) |{\mathcal {C}}_V|,\\= & {} \sum _{U\le V} \mu (U,V) (|{\mathcal {C}}_V| - 1), \\= & {} \sum _{U\le V,v\le n-d} \mu (U,V) (|{\mathcal {C}}_V| - 1), \\= & {} \sum _{U\le V,v\le n-d}(-1)^{v-u}q^{\left( {\begin{array}{c}v-u\\ 2\end{array}}\right) } (|{\mathcal {C}}_V| - 1), \\= & {} \sum _{w=0}^{n-d-u}(-1)^wq^{\left( {\begin{array}{c}w\\ 2\end{array}}\right) }\sum _{\begin{array}{c}\dim (V)=u+w\\ U\le V\end{array}}( |{\mathcal {C}}_V|-1), \end{aligned}$$

proving the claim. \(\square \)

Proposition 1

Let \(\mathcal {C}\) have minimum distance d. Then

$$\begin{aligned} W_{t}(\mathcal {C})=\sum _{i=d}^t(-1)^{t-i}q^{\left( {\begin{array}{c}t-i\\ 2\end{array}}\right) }{n\brack t}{t\brack i}b_{i-d}(\mathcal {C}). \end{aligned}$$

Proof

Let \(t=n-u\), and write \(\displaystyle W_{n-u}(\mathcal {C})=\sum _{dim(U)=u} |\widehat{\mathcal {C}}_U|\). Applying Lemma 5 and setting \(u+w=v\), this equals

$$\begin{aligned} \sum _{w=0}^{n-d-u}(-1)^wq^{\left( {\begin{array}{c}w\\ 2\end{array}}\right) }\sum _{U\le V}( |{\mathcal {C}}_V|-1). \end{aligned}$$

For a fixed V, there are \({{u+w}\brack {u}}\) \(U's\) contained in V of dimension u. Hence

$$\begin{aligned} W_{t}(\mathcal {C})=\sum _{w=0}^{n-d-u}(-1)^wq^{\left( {\begin{array}{c}w\\ 2\end{array}}\right) }{{u+w}\brack {u}}B_{n-(u+w)}(\mathcal {C}), \end{aligned}$$
(4.3)

which equals

$$\begin{aligned} \sum _{w=0}^{t-d}(-1)^wq^{\left( {\begin{array}{c}w\\ 2\end{array}}\right) }{{n}\brack {n-t+w}}{{n-t+w}\brack {n-t}}b_{t-w-d}(\mathcal {C})=\sum _{w=0}^{t-d}(-1)^wq^{\left( {\begin{array}{c}w\\ 2\end{array}}\right) }{{n}\brack {t}}{{t}\brack {w}}b_{t-w-d}(\mathcal {C}). \end{aligned}$$

Setting \(t-w=i\) and observing that \({{t}\brack {w}}={{t}\brack {t-w}}\), the result follows. \(\square \)

Equivalently, the following statement holds.

Corollary 1

Let \(\mathcal {C}\) have minimum distance d. Then

$$\begin{aligned} W_{\mathcal {C}}(x,y)=x^n+\sum _{i=d}^n\left( \sum _{t=i}^n(-1)^{t-i}q^{\left( {\begin{array}{c}t-i\\ 2\end{array}}\right) }{{n}\brack {t}}{{t}\brack {i}}x^{n-t}y^t\right) b_{i-d}(\mathcal {C}). \end{aligned}$$

In particular, in the case of an MRD code with weight enumerator \(M_{n,d}(x,y)\) we get

$$\begin{aligned} M_{n,d}(x,y)-x^n = \sum _{i=d}^n\left( \sum _{t=i}^n(-1)^{t-i}q^{\left( {\begin{array}{c}t-i\\ 2\end{array}}\right) }{{n}\brack {t}}{{t}\brack {i}}x^{n-t}y^t\right) (q^{m(i-d+1)}-1). \end{aligned}$$
(4.4)

Definition 8

For each \(r \in \{0,\ldots ,n\}\) define

$$\begin{aligned} \phi _{n,n-r}(x,y):=(q^m-1)^{-1}\left( M_{n,r}(x,y) -(q^m+1) M_{n,r+1}(x,y) +q^m M_{n,r+2}(x,y)\right) , \end{aligned}$$

and

$$\begin{aligned} \phi _n(T):= \sum _{r=0}^{n}\phi _{n,r}(x,y)T^r. \end{aligned}$$

Therefore,

$$\begin{aligned} \frac{\phi _n(T)}{(1-T)(1-q^m T)} \equiv (q^m-1)^{-1} \sum _{r=0}^{n} \left( M_{n,r}(x,y)-x^n \right) T^{n-r} \pmod {T^{n+1}} \end{aligned}$$
(4.5)

Lemma 6

For each \(r \in \{0,\ldots ,d\}\), the coefficient of \(T^{n-r}\) in the expression,

$$\begin{aligned} Z_{\mathcal {C}}(T) \phi _n(T)=\frac{P_{\mathcal {C}}(T)\phi _n(T)}{(1-T)(1-q^m T)} \end{aligned}$$

is given by

$$\begin{aligned} (q^m-1)^{-1} \left( \sum _{i=0}^{n-r} p_i(\mathcal {C}) M_{n,r+i}(x,y)-x^n \right) . \end{aligned}$$

Proof

From (4.5), the coefficient of \(T^{n-r}\) in the left-hand-side of the above expression is

$$\begin{aligned} (q^m-1)^{-1} \left( \sum _{i=0}^{n-r} p_i(\mathcal {C}) M_{n,r+i}(x,y) -x^n\sum _{i=0}^{n-r} p_i(\mathcal {C}) \right) . \end{aligned}$$

Now from Definition 6 we have that

$$\begin{aligned} \sum _{i=0}^{n-r} p_i(\mathcal {C})= \frac{b_{n-r}(\mathcal {C})-q^m b_{n-r-1}(\mathcal {C})}{q^m-1}. \end{aligned}$$

Then since \(r\le d\), we have \(n-r -1> n-d^\perp -d\), and so \(b_{n-r}(\mathcal {C})=q^{k-m(r-d)}-1\) and \(b_{n-r-1}(\mathcal {C})=q^{k-m(r+1-d)}-1\). Therefore

$$\begin{aligned} \sum _{i=0}^{n-r} p_i(\mathcal {C})=\frac{\big (q^{k-m(r-d)}-1\big )-q^m\big (q^{k-m(r+1-d)}-1\big )}{q^m-1}= 1, \end{aligned}$$

proving the claim. \(\square \)

An explicit expression for \(\phi _n(T)\) is given by:

Lemma 7

$$\begin{aligned} \phi _n(T)=\sum _{i=0}^n\left( \sum _{t=i}^n(-1)^{t-i}q^{\left( {\begin{array}{c}t-i\\ 2\end{array}}\right) }{{n}\brack {t}}{{t}\brack {i}}x^ty^{n-t}\right) T^{n-i}. \end{aligned}$$

Proof

By definition, we have,

$$\begin{aligned} (q^m-1)\phi _{n,n-r}(x,y)=M_{n,r}(x,y) -(q^m+1) M_{n,r+1}(x,y) +q^m M_{n,r+2}(x,y). \end{aligned}$$

Then by (4.4), we get

$$\begin{aligned}= & {} \sum _{t=r}^n(-1)^{t-r}q^{\left( {\begin{array}{c}t-r\\ 2\end{array}}\right) }{{n}\brack {t}}{{t}\brack {r}}x^ty^{n-t}(q^m-1) \\&\quad +\,\sum _{t=r+1}^n(-1)^{t-r-1}q^{\left( {\begin{array}{c}t-r-1\\ 2\end{array}}\right) }{{n}\brack {t}}{{t}\brack {r+1}}x^ty^{n-t}(q^{2m}-1 -(q^m+1)(q^m-1))\\&\quad +\,\sum _{i=r+2}^n \sum _{t=i}^n(-1)^{t-i}q^{\left( {\begin{array}{c}t-i\\ 2\end{array}}\right) }{{n}\brack {t}}{{t}\brack {i}}x^ty^{n-t} (b_{i-r+1}-(q^{m}+1)b_{i-r}+q^mb_{i-r-1})\\= & {} \sum _{t=r}^n(-1)^{t-r}q^{\left( {\begin{array}{c}t-r\\ 2\end{array}}\right) }{{n}\brack {t}}{{t}\brack {r}}x^ty^{n-t}(q^m-1), \end{aligned}$$

as the third sum vanishes due to the relation (3.1). \(\square \)

Therefore, the weight enumerators \(M_{n,d}(x,y)\) and \(W_{\mathcal {C}}(x,y)\) can be expressed as

$$\begin{aligned} M_{n,d}(x,y)= & {} x^n + \sum _{i=d}^n \phi _{n,n-i}(x,y)b_{i-d}, \end{aligned}$$
(4.6)
$$\begin{aligned} W_{\mathcal {C}}(x,y)= & {} x^n + \sum _{i=d}^n \phi _{n,n-i}(x,y)b_{i-d}(\mathcal {C}). \end{aligned}$$
(4.7)

In fact, the polynomials \(\phi _{n,n-r}(x,y)\) are related to a well known class of q-polynomials (see, e.g., [9]), and are given by

$$\begin{aligned} \phi _{n,n-r}(x,y) = \left[ \begin{matrix} n \\ r \end{matrix} \right] _{}p_{n-r}(x,y)y^r, \end{aligned}$$

where \(p_k(x,y):=\prod _{j=0}^{k-1}(x-q^jy) = \sum _{j=0}^k (-1)^{k-j} q^{\left( {\begin{array}{c}k-j\\ 2\end{array}}\right) } \left[ \begin{matrix} k \\ j \end{matrix} \right] _{} x^j y^{k-j}\). Therefore,

$$\begin{aligned} W_{\mathcal {C}}(x,y)= & {} x^n + \sum _{i=d}^n b_{i-d}(\mathcal {C})\left[ \begin{matrix} n \\ i \end{matrix} \right] _{}p_{n-i}(x,y)y^i. \end{aligned}$$
(4.8)

We now establish a connection between the weight enumerator of a code and its zeta function.

Theorem 1

The coefficient of \(T^{n-d}\) in the expression,

$$\begin{aligned} Z_{\mathcal {C}}(T) \phi _n(T)=\frac{P_{\mathcal {C}}(T)\phi _n(T)}{(1-T)(1-q^m T)}, \end{aligned}$$

is given by

$$\begin{aligned} \frac{W_{\mathcal {C}}(x,y)-x^n}{q^m-1} . \end{aligned}$$

In particular, the zeta polynomial \(P_{\mathcal {C}}(T)\) is the unique polynomial of degree at most \(n-d\) such that \(\displaystyle {W_{\mathcal {C}}(x,y) = \sum _{i=0}^{n-d} p_i M_{n,d+i}(x,y)}\).

Proof

It is immediate from (4.8) that the coefficient of \(T^{n-d}\) in \(Z_{\mathcal {C}}(T) \phi _n(T)\) is \((q^m-1)^{-1}(W_{\mathcal {C}}(x,y)-x^n)\). From Lemma 6, we have that this coefficient is equal to \((q^m-1)^{-1}(-x^n+ \sum _{i=0}^{n-d} p_i M_{n,d+i}(x,y))\), and thus \(\displaystyle {W_{\mathcal {C}}(x,y) = \sum _{i=0}^{n-d} p_i(\mathcal {C}) M_{n,d+i}(x,y)}\). Since the \(M_{n,d+i}(x,y)\) are linearly independent over \({\mathbb {Q}}\), the result follows. \(\square \)

Remark 1

Given the polynomial \(\sum _{i=0}^{n-d} p_i T^i\), there exists weight enumerators \(W^r(x,y)\) corresponding to putative codes of minimum distance r for each \(0\le r \le d\) that arise as coefficients of the generating function \(Z_{\mathcal {C}}(T)\phi _n(T)\). In particular the weight enumerator of a given code is produced from its zeta polynomial only if d is known. Different codes may share the same zeta polynomial.

Example 1

Let us consider \(m=n=3\). Then we have the following weight enumerators for MRD codes

$$\begin{aligned} M_{3,3}&= x^3+(q^3-1)y^3\\ M_{3,2}&= x^3+(q^3-1)(q^2+q+1)xy^2+(q^3-1)(q^3-q^2-q)y^3\\ M_{3,1}&= x^3+(q^3-1)(q^2+q+1)x^2y+(q^3-1)^2(q^2+q)xy^2\\&\quad +\,(q^3-1)(q^3-q)(q^3-q^2)y^3\\ \end{aligned}$$

Taking \(q=2\) we get

$$\begin{aligned} M_{3,3}&= x^3+7y^3\\ M_{3,2}&= x^3+49xy^2+14y^3\\ M_{3,1}&= x^3+49x^2y+294xy^2+168y^3\\ \end{aligned}$$

We formally define \(M_{3,4} = x^n\), the weight enumerator of the trivial code. Consider a code \(\mathcal {C}\) of constant rank 2; that is, every nonzero codeword in \(\mathcal {C}\) has rank weight two. If \(\mathcal {C}\) has dimension k, then \(W_{\mathcal {C}}(x,y) =x^3+(q^k-1)xy^2\). Such codes always exist for \(k=3\), and exist with \(k=4\), \(q=2\). The former is a special case of [3, Theorem 4], while the latter is an example found by computer, and is only known to exist when \(q=2\); see [3, Section 1]. For \(k=3\), we have a code \(\mathcal {C}_1\) with weight enumerator

$$\begin{aligned} W_{\mathcal {C}_1}(x,y) = \frac{1}{q^2+q+1}\left( M_{3,2}-(q^3-q^2-q)M_{3,3}+q^3M_{3,4}\right) , \end{aligned}$$

and hence

$$\begin{aligned} P_{\mathcal {C}_1}(T) = \frac{1-(q^3-q^2-q)T+q^3T^2}{q^2+q+1}. \end{aligned}$$

For \(k=4\) and \(q=2\), we get a code \(\mathcal {C}_2\) with zeta polynomial

$$\begin{aligned} P_{\mathcal {C}_2}(T) = \frac{1}{49}\left( 15-30T+64T^2\right) . \end{aligned}$$

This reflects the fact that

$$\begin{aligned} x^3+15xy^2 = \frac{1}{49}\left( 15(x^3+49xy^2+14y^3)-30(x^3+7y^3)+64x^4\right) . \end{aligned}$$

From considering an MRD code of \(3\times 3\) matrices with minimum distance 2 over \(\mathbb {F}_{q^2}\) as a subspace of \(6\times 6\) matrices over \(\mathbb {F}_q\), we produce a code \(\mathcal {C}_3\) with weight enumerator

$$\begin{aligned} W_{\mathcal {C}_3}(x,y) =x^6+(q^6-1)(q^4+q^2+1)x^2y^4+(q^6-1)(q^6-q^4-q^2)y^6, \end{aligned}$$

and zeta polynomial

$$\begin{aligned} P_{\mathcal {C}_3}(T) = \frac{1+ (-q^6 + q^4 + q^3 + q^2 + q)T + q^6T^2}{q^4 + q^3 + q^2 + q + 1}. \end{aligned}$$

Taking \(q=2\) we get

$$\begin{aligned} P_{\mathcal {C}_3}(T) = \frac{1-34T + 64T^2}{31}. \end{aligned}$$

5 Duality and an upper bound

A number of authors have described the duality theory of rank metric codes [2, 8, 12]. In [8, Theorem 1], the authors give a direct analogue of MacWilliams’ duality theorem relating the weight enumerator of a code with that of its dual, or more precisely, with the q-transform of its dual. Delsarte [2] showed that the dual code of an MRD code is also MRD; the dual of an MRD code with minimum distance d is an MRD code with minimum distance \(n-d+2\). Since an MRD code exists for all choices of mnd, the family of MRD weight enumerators is closed under the MacWilliams identity. Explicitly, we have that the weight enumerator \(M^\perp _{n,d}(x,y)\) of an MRD code in \({\mathbb {F}}_q^{m \times n}\) of minimum distance d is given by:

Theorem 2

$$\begin{aligned} M_{n,d}^{\perp }(x,y)=q^{m(n-d+1)}M_{n,n-d+2}(x,y). \end{aligned}$$

Moreover, the MacWilliams transform relating the weight enumerator of a code with that of its dual is a \({\mathbb {Q}}\)-linear map [2]. We apply these observations to deduce the following corollary.

Corollary 2

Let \(\mathcal {C}\subseteq \mathbb {F}_q^{m\times n}\) be a matrix code with minimal rank distance d and dimension k. Let \(d^{\perp }\) be the minimal rank distance of the dual code \(\mathcal {C}^{\perp }\). Setting

$$\begin{aligned} W_{\mathcal {C}}(x,y)=\sum _{i=0}^rp_iM_{n,d+i} \text{ and } W_{\mathcal {C^{\perp }}}(x,y)=\sum _{j=0}^ts_jM_{n,d^{\perp }+j}, \end{aligned}$$

we have that

  1. (a)

    \(r=t=n-d-d^{\perp }+2\);

  2. (b)

    \(s_j=p_{r-j}q^{m(d^{\perp }+j-1)-k}\);

Proof

Applying the MacWilliams \({\mathbb {Q}}\)-linear transform to \(W_{\mathcal {C}}(x,y)\) and using Theorem 2 gives

$$\begin{aligned} W_{\mathcal {C}^{\perp }}(x,y)=\sum _{i=0}^rq^{m(n-d-i+1)-k}p_iM_{n,n-d-i+2}. \end{aligned}$$

Setting \(d^{\perp }+j=n-d-i+2\), its minimal value (\(j=0\)) happens when \(i=n-d-d^{\perp }+2\) and its maximal value (\(i=0\)) when \(j=n-d-d^{\perp }+2\). Hence (a) follows. Claim (b) follows from the fact that the MRD family is a \(\mathbb {Q}\)-basis, hence the decomposition of \(W_{\mathbb {C}^{\perp }}\) as a linear combination of MRD polynomials of different minimal distances must be unique. \(\square \)

The MacWilliams identity can be translated into a functional relation between the zeta function of a code and that of its dual, or just between the zeta function of the code at different arguments if the code is formally self-dual (and so simply satisfies \(W_{\mathcal {C}}(x,y)=W_{\mathcal {C}^{\perp }}(x,y)\)), as we now show.

Theorem 3

$$\begin{aligned} Z_{\mathcal {C}^{\perp }}(T)=q^{m(n-d+1)+k}T^{r-2}Z_{\mathcal {C}}\left( \frac{1}{q^mT}\right) . \end{aligned}$$

In particular, if \(\mathcal {C}\) is formally self-dual, then

$$\begin{aligned} Z_{\mathcal {C}}(T)=q^{m(n-d+1)+k}T^{r-2}Z_{\mathcal {C}}\left( \frac{1}{q^mT}\right) . \end{aligned}$$

Proof

Let \(P_{\mathcal {C}}(T)=\displaystyle \sum _{i=0}^rp_iT^i\) and \(P_{\mathcal {C}^{\perp }}(T)=\displaystyle \sum _{j=0}^rs_iT^i\), for some \(p_i,s_i \in {\mathbb {Q}}\). By Corollary 1, for \(0\le j\le r\):

$$\begin{aligned} s_j=p_{r-j}q^{m(d^{\perp }+j-1)-k}, \end{aligned}$$

hence multiplying by \(T^{j-r}\), summing in j and then changing j to \(r-j\):

$$\begin{aligned} T^{-r}P_{\mathcal {C}^{\perp }}(T)= \sum _{j=0}^rp_jq^{m(d^{\perp }+r-j-1)-k}T^{-j}=q^{m(d^{\perp }+r-1)-k}P_{\mathcal {C}}\left( \frac{1}{q^mT}\right) . \end{aligned}$$

Therefore,

$$\begin{aligned} P_{\mathcal {C}^{\perp }}(T)=T^rq^{m(n-d+1)-k}P_{\mathcal {C}}\left( \frac{1}{q^mT}\right) . \end{aligned}$$

Taking the quotient with \((1-T)(1-q^mT)\), the result follows. \(\square \)

Example 2

We consider the zeta polynomials of the duals of the codes from Example 1. The code \(\mathcal {C}_2\) has \(m=n=3\), \(d=2\), \(k=4\), \(q=2\), and zeta polynomial

$$\begin{aligned} P_{\mathcal {C}_2}(T) = \frac{1}{49}\left( 15-30T+64T^2\right) . \end{aligned}$$

Therefore,

$$\begin{aligned} P_{\mathcal {C}_2^{\perp }}(T)&=T^2 2^{2}P_{\mathcal {C}}\left( \frac{1}{2^3T}\right) ,\\&= \frac{1}{49}\left( 4-15T+60T^2\right) . \end{aligned}$$

The code \(\mathcal {C}_3\) has \(m=n=6\), \(d=4\), \(k=12\), and zeta polynomial

$$\begin{aligned} P_{\mathcal {C}_3}(T) = \frac{1-34T + 64T^2}{31}. \end{aligned}$$

Therefore,

$$\begin{aligned} P_{\mathcal {C}_3^{\perp }}(T)&=T^2 2^{6}P_{\mathcal {C}_3}\left( \frac{1}{2^6T}\right) \\&= \frac{1-34T + 64T^2}{31} = P_{\mathcal {C}_3}(T). \end{aligned}$$

Note that although \(\mathcal {C}_3\) and \(\mathcal {C}_3^{\perp }\) have the same zeta polynomial (and hence the same zeta function), they do not have the same weight enumerator, as they have different minimum distances. In fact, if a code has quadratic zeta polynomial, which occurs if and only if \(d+d^{\perp } = n\), then its dual will have the same zeta polynomial if and only if \(k=m(n-d)\).

We close this section by showing how the zeta function can be used to derive an upper bound on the minimum distance of code, which is the rank metric analogue of [4, Section 2]. We remark that this result gives an upper bound on the minimum distance of a code based only on its zeta function; while codes with different weight enumerators may have the same zeta function, as we observed in the example above.

Theorem 4

Let \(P_{\mathcal {C}}(T)=p_0(1+aT+\cdots )\) be the zeta polynomial of a rank metric code \(\mathcal {C}\subseteq \mathbb {F}_q^{m\times n}\), of degree \(r\le n-d\) and let a be the negative of the sum of its reciprocal roots. Then

$$\begin{aligned} d\le \log _q\left[ (a+q^ m+1)(q-1)+1\right] -1. \end{aligned}$$

Proof

First, observe that according to Theorem 1 the coefficient of \(T^{n-d}\) in \(Z_{\mathcal {C}}(T)\phi _n(T)\) is

$$\begin{aligned} \frac{W_{\mathcal {C}}(x,y)-x^ n}{q^m-1}. \end{aligned}$$
(5.1)

Second, since \(\frac{1}{(1-T)(1-q^ mT)}\) is the common zeta-function of all the MRD weight enumerators (in particular, of those with length n), again due to Theorem 1, we have

$$\begin{aligned} \frac{\phi _n(T)}{(1-T)(1-q^ mT)}=\frac{1}{q^ m-1}\sum _{i=0}^{n-d}\left( M_{n,d+i}(x,y)-x^ n\right) T^{n-d-i}+\cdots \end{aligned}$$

Likewise, the coefficient of \(T^{n-d}\) in \(Z_{\mathcal {C}}(T)\phi _n(T)\) is

$$\begin{aligned} \frac{1}{q^ m-1}\sum _{i=0}^{r}p_i\left( M_{n,d+i}(x,y)-x^ n\right) . \end{aligned}$$
(5.2)

Within the coefficient of \(T^ {n-d}\) in these two coincident expressions, we need to compare the coefficients of \(x^{n-d}y^ d\) and \(x^{n-d-1}y^{d+1}\).

The coefficient of \(x^{n-d}y^d\) in (5.1) is \(\frac{W_{n-d}(\mathcal {C})}{q^m-1}\), \(W_{n-d}(\mathcal {C})\) being the number of codewords of rank d in \(\mathcal {C}\), which equals the coefficient of \(x^{n-d}y^d\) in (5.2), i.e., in \(\frac{p_0}{q^ m-1}\left( M_{n,d}(x,y)-x^n\right) \). Using Theorem 1, this last expression can be expanded as

$$\begin{aligned} \frac{p_0}{q^ m-1}\left( \sum _{i=d}^{n}\phi _{n,n-i}(x,y)b_{i-d}\right)= & {} \frac{p_0}{q^ m-1}\sum _{i=d}^{n}{n\brack i}b_{i-d}y^ i\sum _{j=0}^{n-i}(-1)^{n-i-j}q^{{n-i-j\atopwithdelims ()2}}\\&\times \,{n-i\brack j}x^jy^{n-i-j}, \end{aligned}$$

the coefficient of \(x^{n-d}y^d\) in which expression is precisely \(\frac{p_0}{q^m-1}{n\brack d}b_0\). Comparing with the corresponding coefficient in (5.1) we obtain \(p_0\ge 0\). Observe that the numbers \(b_u\) are the normalized q-binomial coefficients of an MRD code of length n, and they are independent of the minimal distance d.

Now, we compare the coefficients of \(x^{n-d-1}y^{d+1}\). First, this coefficient is \(\frac{W_{n-d-1}(\mathcal {C})}{q^m-1}\ge 0\) in (4.3). In (5.2), this equals the coefficient of \(x^{n-d-1}y^{d+1}\) in the sub-expression

$$\begin{aligned} \frac{1}{q^m-1}\left( p_0(M_{n,d}(x,y)-x^n)+p_1(M_{n,d+1}(x,y)-x^n)\right) . \end{aligned}$$

The coefficient in \(\frac{p_1}{q^m-1}\left( M_{n,d+1}(x,y)-x^n\right) \) is, as before

$$\begin{aligned} \frac{p_1}{q^m-1}{n\brack d+1}b_0. \end{aligned}$$
(5.3)

As for the coefficient in \(\frac{p_0}{q^m-1}\left( M_{n,d}(x,y)-x^n\right) \), we expand this expression again as

$$\begin{aligned} \frac{p_0}{q^m-1}\sum _{i=d}^{n}\phi _{n,n-i}(x,y)b_{i-d}, \end{aligned}$$

from which we isolate the sought for coefficient, which is

$$\begin{aligned} \frac{p_0}{q^m-1}\left( {n\brack d+1}b_1-{n\brack d}{n-d\brack n-d-1}b_0\right) . \end{aligned}$$
(5.4)

Adding (5.3) and (5.4), dividing by \(p_0\) and taking into account that \({n\brack d+1}=\frac{q^{n-d}-1}{q^{d+1}-1}{n\brack d}\), yields

$$\begin{aligned} ab_0\frac{q^{n-d}-1}{q^{d+1}-1}+b_1\frac{q^{n-d}-1}{q^{d+1}-1}-b_0{n-d\brack n-d-1}\ge 0. \end{aligned}$$
(5.5)

Since \({n-d\brack n-d-1}=\frac{q^{n-d}-1}{q-1}\), it holds that,

$$\begin{aligned} ab_0+b_1-b_0\frac{q^{d+1}-1}{q-1}\ge 0. \end{aligned}$$

Since \(b_u=q^{m(u+1)}-1\) for each \(u\ge 0\), dividing by \(b_0\) yields

$$\begin{aligned} a+q^m+1\ge \frac{q^{d+1}-1}{q-1}. \end{aligned}$$

By taking the logarithm the result follows. \(\square \)

6 Puncturing and shortening

Puncturing and shortening are fundamental operations of coding theory. In [4], the zeta function was related to the normalized weight enumerator of a code, by successive puncturing and shortening of an MDS weight enumerator. We consider the rank metric case in what follows.

We have already considered shortened subcodes in order to define the zeta function of a code. We will now consider puncturing and shortening as operations that yield codes in \({\mathbb {F}}_q^{ m\times (n-1) }\), that is, as projections of codes in \({\mathbb {F}}_q^{m \times n}\). Such operations have been considered in [1], with a slightly different definition. We will establish the invariance of the normalized weight enumerator of a code under puncturing and shortening.

Definition 9

Let H be a hyperplane in \({\mathbb {F}}_q^n\). Fix a basis of H and let \(P_H \in {\mathbb {F}}_q^{ n\times (n-1) }\) be the matrix whose columns are the elements of this basis of H, in some order. Let \(h \in {\mathbb {F}}_q^n \backslash H\). We define the punctured and shortened codes of \(\mathcal {C}\) with respect to H, respectively by:

$$\begin{aligned} \Pi _H(\mathcal {C}):= & {} \{ XP_H : X \in \mathcal {C}\} \subset {\mathbb {F}}_q^{ m\times (n-1) } \text { (punctured code)},\\ \Sigma _{h,H}(\mathcal {C}):= & {} \{ XP_H : X \in \mathcal {C}, Xh^T = 0 \}\subset {\mathbb {F}}_q^{ m\times (n-1) } \text { (shortened code)}. \end{aligned}$$

Clearly \(\Pi _H(\mathcal {C})\) and \(\Sigma _{h,H}(\mathcal {C})\) are only well-defined up to a choice of basis of H. We assert that this is sufficient for our purposes, which is to define operations of puncturing and shortening on normalized weight enumerators. With these definitions, \(\mathcal {C}\) can by punctured in any of \(\left[ \begin{matrix} n \\ n-1 \end{matrix} \right] _{}=\left[ \begin{matrix} n \\ 1 \end{matrix} \right] _{}\) ways and can be shortened in any of \(q^{n-1}\left[ \begin{matrix} n \\ 1 \end{matrix} \right] _{}=|\{(\langle h \rangle ,H ): \dim H = n-1, h \notin H\}|\).

Lemma 8

Let H be a hyperplane in \({\mathbb {F}}_q^n\) and let \(P_H \in {\mathbb {F}}_q^{n \times (n-1)}\) have columns that form a basis of H. Let X be non-zero in \({\mathbb {F}}_q^{m \times n}\). Then

$$\begin{aligned} \mathrm{rk}(XP_H) = \left\{ \begin{array}{ll} \mathrm{rk}(X) &{} \text { if }X^\perp \not \subset H \\ \mathrm{rk}(X)-1 &{} \text { if }X^\perp \subset H \end{array} \right. \end{aligned}$$

Proof

Let \(h \in {\mathbb {F}}_q^n \backslash H\). Then \(\mathrm{rk}(X) = \mathrm{rk}(X[P_H, h^T])=\mathrm{rk}([XP_H,Xh^T])=\mathrm{rk}(XP_H)\) if and only if \(Xh^T\) is contained in the column-space of \(XP_H\), which holds if and only if \(h \in X^\perp +H\). \(X^\perp \not \subset H\) if and only if \({\mathbb {F}}_q^n = X^\perp +H\), in which case \(h \in X^\perp + H\) and \(\mathrm{rk}(X)=\mathrm{rk}(XP_H)\). If \(X^\perp \subset H\) then \(h \notin X^\perp + H = H\), so \(\mathrm{rk}(XP_H)=\mathrm{rk}(X)-1\). \(\square \)

Corollary 3

Let H be a hyperplane in \({\mathbb {F}}_q^n\) and let \(h \in {\mathbb {F}}_q^n\backslash H\). Let \(\mathcal {C}\) have parameters \([m \times n,k,d\ge 2]\) over \({\mathbb {F}}_q\). Then the punctured code \(\Pi _H(\mathcal {C})\) has parameters \([m \times (n-1),k,\ge d-1]\). The shortened code \(\Sigma _{h,H}(\mathcal {C})\) has parameters \([m \times (n-1),\ge k-m,\ge d]\).

Proof

The lower bounds on the minimum distances of the codes follows directly from Lemma 8. Let \(P_H \in {\mathbb {F}}_q^{n \times (n-1)}\) have columns that form a basis of H. Then \(XP_H = 0\) if and only if \(H \subset X^\perp \), in which case \(X=0\), since otherwise \(\dim X^\perp =n-\mathrm{rk}(X)\le n-d \le n-2\). It follows that \(\mathcal {C}\) and \(\Pi _H(\mathcal {C})\) have the same cardinality.

Let \(h \in {\mathbb {F}}_q^n \backslash H\). Consider the map \(\theta _h :{\mathbb {F}}_q^{m \times n} \longrightarrow {\mathbb {F}}_q^m: X \mapsto Xh^T\). Then \(\mathcal {C}\cap \ker \theta _h=\mathcal {C}_{\langle h \rangle }:=\{ X \in \mathcal {C}: Xh^T = 0 \}\). Therefore \(\dim \mathcal {C}_{\langle h \rangle } = \dim (\mathcal {C}\cap \ker \theta _h) \ge k - m\). The result now follows since \(\Sigma _{h,H}(\mathcal {C})\) is obtained as the punctured code of \(\mathcal {C}_{\langle h \rangle }\) with respect to H, which both have the same dimension. \(\square \)

Given an arbitrary code, \(\mathcal {C}\) and hyperplanes \(H_1,H_2\), the punctured codes \(\Pi _{H_1}(\mathcal {C})\) and \(\Pi _{H_2}(\mathcal {C})\) may have different weight enumerators. Neither is the weight enumerator of a shortened code \(\Sigma _{h,H}(\mathcal {C})\) necessarily uniquely determined. However, in the case of an MRD code \(\mathcal {C}\) we observe:

Corollary 4

Let \(d\ge 2\). The shortened and punctured codes of an MRD code with weight enumerator \(M_{n,d}(x,y)\) are also MRD and have weight enumerators \(M_{n-1,d}(x,y)\) and \(M_{n-1,d-1}(x,y)\), respectively.

Proof

Let H be a hyperplane in \({\mathbb {F}}_q^n\). Applying Corollary 3 together with the rank metric Singleton bound, we see that the punctured code \(\Pi _H(\mathcal {C})\) has parameters \([m \times (n-1),m(n-d+1),d-1]\) and is thus MRD. Similarly the shortened code \(\Sigma _{h,H}(\mathcal {C})\) has parameters \([m \times (n-1),m(n-d),d]\) and is also an MRD code. \(\square \)

We wish to define algebraic operations on the weight enumerator of a code corresponding to the expected weight enumerator of its punctured or shortened codes. In the Hamming metric case, such operations are defined in terms of partial derivatives [4]. In the rank metric case, we may implement q-analogues of partial derivatives (cf. [9, 11]). We define such operations as follows.

Definition 10

Let \(f(x,y) = \sum _{i=0}^n f_i x^{n-i}y^i \in {\mathbb {Q}}[x,y]\). The partial q-derivatives of f(xy) with respect to x and y are defined by:

$$\begin{aligned} D_{x}(f(x,y)):= & {} \frac{f(qx,y)-f(x,y)}{(q-1)x} = \sum _{i=0}^n f_i \left[ \begin{matrix} n-i \\ 1 \end{matrix} \right] _{} x^{n-i-1}y^{i},\\ D_{y}(f(x,y)):= & {} \frac{f(x,qy)-f(x,y)}{(q-1)y} = \sum _{i=0}^n f_i \left[ \begin{matrix} i \\ 1 \end{matrix} \right] _{} x^{n-i}y^{i-1},\\ D_{q,x}(f(x,y)):= & {} \frac{f(qx,qy)-f(x,qy)}{(q-1)x} = \sum _{i=0}^n f_i q^{i}\left[ \begin{matrix} n-i \\ 1 \end{matrix} \right] _{} x^{n-i-1}y^{i}. \end{aligned}$$

It is straightforward to check that these are linear operators. In analogy with [4, Section 3] we now define the operations of puncturing and shortening on the homogeneous polynomials of degree n in \({\mathbb {Q}}[x,y]\) by

$$\begin{aligned} \mathcal {P}:=\left[ \begin{matrix} n \\ 1 \end{matrix} \right] _{}^{-1}\left( D_{q,x}+ D_{y}\right) \;\text { and } \mathcal {S}:=\left[ \begin{matrix} n \\ 1 \end{matrix} \right] _{}^{-1} D_{x} . \end{aligned}$$

Let us consider the average weight enumerator arrived at over all possible shortenings or puncturings (cf. [4]).

Theorem 5

The average weight enumerators over all shortened and punctured codes of \(\mathcal {C}\) are given by

  1. 1.

    \(\displaystyle {\mathcal {P}(W_{\mathcal {C}}(x,y))=\left[ \begin{matrix} n \\ 1 \end{matrix} \right] _{}^{-1}\sum _{\dim H = n-1} W_{\Pi _H(\mathcal {C})}(x,y)},\)

  2. 2.

    \(\displaystyle {\mathcal {S}(W_{\mathcal {C}}(x,y))=\left[ \begin{matrix} n \\ 1 \end{matrix} \right] _{}^{-1}\frac{1}{q^{n-1}}\sum _{ \dim H = n-1,\langle h \rangle \not \subset H} W_{\Sigma _{h,H}(\mathcal {C})}(x,y)}.\)

Proof

Let H be a hyperplane in \({\mathbb {F}}_q^n\) and let \(P_H \in {\mathbb {F}}_q^{n \times (n-1)}\) have columns that form a basis of H. From Lemma 8, \(\mathrm{rk}(XP_h)=\mathrm{rk}(X)\) if and only if \(X^\perp \not \subset H\). Let \(X\in \mathcal {C}\) have rank \(w>0\). Then \(\mathrm{rk}(XP_H)=w-1\) if and only if \(X^\perp \subset H\).

Since there are \(\left[ \begin{matrix} n-(n-w) \\ n-1-(n-w) \end{matrix} \right] _{}=\left[ \begin{matrix} w \\ 1 \end{matrix} \right] _{}\) hyperplanes in \({\mathbb {F}}_q^n\) containing \(X^\perp \), X corresponds to a word of rank \(w-1\) in \(\left[ \begin{matrix} w \\ 1 \end{matrix} \right] _{}\) punctured codes of \(\mathcal {C}\) and to a word of rank w in \(\left[ \begin{matrix} n \\ 1 \end{matrix} \right] _{}-\left[ \begin{matrix} w \\ 1 \end{matrix} \right] _{} = q^{w} \left[ \begin{matrix} n-w \\ 1 \end{matrix} \right] _{}\) punctured codes of \(\mathcal {C}\). Therefore, each term \(x^{n-w}y^w\) of the weight enumerator of \(\mathcal {C}\) yields the contribution

$$\begin{aligned} q^{w} \left[ \begin{matrix} n-w \\ 1 \end{matrix} \right] _{}x^{n-w-1}y^w + \left[ \begin{matrix} w \\ 1 \end{matrix} \right] _{} x^{n-w}y^{w-1}, \end{aligned}$$

in the sum of the \(\left[ \begin{matrix} n \\ 1 \end{matrix} \right] _{}\) different weight enumerators of all possible punctured codes.

For any \(h \notin H\), \(XP_H \in \Sigma _{h,H}(\mathcal {C})\) if and only if \(h \in X^\perp \). There are \(|X^\perp \backslash X^\perp \cap H|\) such vectors h and so \(q^{n-w-1}\) one dimensional subspaces \(\langle h \rangle \) such that \(XP_H \in \Sigma _{h,H}(\mathcal {C})\). As outlined above, there are \(q^{w} \left[ \begin{matrix} n-w \\ 1 \end{matrix} \right] _{}\) hyperplanes not containing \(X^\perp \). In particular each term \(x^{n-w}y^w\) of the weight enumerator of \(\mathcal {C}\) yields the contribution

$$\begin{aligned} q^{n-w-1} q^{w} \left[ \begin{matrix} n-w \\ 1 \end{matrix} \right] _{} x^{n-1-w}y^w = q^{n-1}\left[ \begin{matrix} n-w \\ 1 \end{matrix} \right] _{}, \end{aligned}$$

in the sum of the \(q^{n-1}\left[ \begin{matrix} n \\ 1 \end{matrix} \right] _{}\) different weight enumerators of all possible shortened codes. \(\square \)

Example 3

Consider the \({\mathbb F}_2\)-\([3 \times 3, 4 ,2]\) code

$$\begin{aligned} \mathcal {C}=\left\langle \begin{bmatrix} 1&0&0 \\ 0&0&0 \\ 0&1&0 \end{bmatrix}, \begin{bmatrix} 0&0&1 \\ 1&0&0 \\ 0&0&0 \end{bmatrix}, \begin{bmatrix} 0&1&0 \\ 0&0&1 \\ 0&0&0 \end{bmatrix}, \begin{bmatrix} 0&0&1 \\ 0&1&0 \\ 0&1&0 \end{bmatrix}\right\rangle , \end{aligned}$$

which has weight enumerator \(W_{\mathcal {C}}(x,y) = x^3 + 13 x y^2 + 2 y^3.\) Then 6 hyperplanes H yield shortened codes with distribution of weight enumerators similar to those for \(H=001^\perp \), and the hyperplane \(H=010^\perp \) yields 4 shortened codes \(\Sigma _{h,H}\) of order 2.

H

h

\(W_{\Sigma _{h,H}}(x,y)\)

H

h

\(W_{\Sigma _{h,H}}(x,y)\)

\(001^\perp \)

001

\(x^2 + 3y^2\)

\(010^\perp \)

110

\(x^2 + y^2\)

 

111

\(x^2 + y^2\)

 

010

\(x^2 + y^2\)

 

011

\(x^2 + y^2\)

 

111

\(x^2 + y^2\)

 

101

\(x^2 + 3y^2\)

 

011

\(x^2 + y^2\)

Then the average weight enumerator over all shortened codes is given by

$$\begin{aligned} \left[ \begin{matrix} 3 \\ 1 \end{matrix} \right] _{}^{-1}(1/4)\sum _{ \dim H = 2,\langle h \rangle \not \subset H} W_{\Sigma _{h,H}(\mathcal {C})}(x,y)= & {} (1/28)(28x^2 +52y^2)\\= & {} x^2+13/7 y^2\\= & {} \mathcal {S}(x^3 + 13 x y^2 + 2 y^3)\\= & {} \left[ \begin{matrix} 3 \\ 1 \end{matrix} \right] _{}^{-1}\left( \left[ \begin{matrix} 3 \\ 1 \end{matrix} \right] _{} x^2 + 13y^2\right) . \end{aligned}$$

Lemma 9

The zeta polynomial \(P_\mathcal {C}(T)\) is invariant under the shortening and puncturing operations \(\mathcal {S}\) and \(\mathcal {P}\).

Proof

From Corollary 4, we have

$$\begin{aligned} \mathcal {S}(W_{\mathcal {C}}(x,y)) = \mathcal {S}\left( \sum _{i=0}^{n-d} p_i(\mathcal {C}) M_{n,d+i}(x,y) \right) = \sum _{i=0}^{n-1-d} p_i(\mathcal {C}) M_{n-1,d+i} (x,y), \end{aligned}$$

and

$$\begin{aligned} \mathcal {P}(W_{\mathcal {C}}(x,y)) = \mathcal {P}\left( \sum _{i=0}^{n-d} p_i(\mathcal {C}) M_{n,d+i}(x,y) \right) = \sum _{i=0}^{n-d} p_i(\mathcal {C}) M_{n-1,d+i-1} (x,y). \end{aligned}$$

\(\square \)

Definition 11

The normalized weight enumerator of \(\mathcal {C}\) is defined to be the polynomial,

$$\begin{aligned} \mathcal {W}_{\mathcal {C}}(T):= (q^m-1)^{-1}\sum _{i=d}^n \left[ \begin{matrix} n \\ i \end{matrix} \right] _{}^{-1} W_{i}(\mathcal {C})T^{i-d} . \end{aligned}$$

We write \(\mathcal {W}_{\mathcal {C}}^{\mathcal {P}}(T)\) and \(\mathcal {W}_{\mathcal {C}}^{\mathcal {S}}(T)\) to denote the normalized weight enumerators corresponding to \(\mathcal {P}(W_\mathcal {C}(x,y))\) and \(\mathcal {S}(W_\mathcal {C}(x,y))\), respectively.

Theorem 6

Let \(\mathcal {C}\) have minimum distance d. Then,

  1. 1.

    \(\mathcal {W}_{\mathcal {C}}^{\mathcal {P}}(T) =q^d T \mathcal {W}_{\mathcal {C}}(qT) + \mathcal {W}_{\mathcal {C}}(T) -(q^m-1)^{-1} W_n(\mathcal {C})q^n T^{n-d+1},\)

  2. 2.

    \(\mathcal {W}_{\mathcal {C}}^{\mathcal {S}}(T) =\mathcal {W}_{\mathcal {C}}(T) - (q^m-1)^{-1}W_n(\mathcal {C}) T^{n-d} .\)

Proof

To show (1), we apply the operation \(\mathcal {P}=\left[ \begin{matrix} n \\ 1 \end{matrix} \right] _{}^{-1}\left( D_{q,x}+ D_{y}\right) \) to \(W_{\mathcal {C}}(x,y)\).

Therefore, the associated normalized polynomial \(\mathcal {W}_{\mathcal {C}}^{\mathcal {P}}(T)\) is given by:

The proof of (2) is similar. \(\square \)

Consider the following operations \({\alpha },{\epsilon }\) on rational functions f(T) in indeterminate T.

$$\begin{aligned} {\alpha }f(T):=Tf(T)= \text { and } {\epsilon }f(T):= f(qT). \end{aligned}$$
(6.1)

Now \({\alpha },{\epsilon }\) form a q-commuting pair [11], and obey the relations

$$\begin{aligned} {\epsilon }{\alpha }= q{\alpha }{\epsilon },\; q{\alpha }= {\alpha }q,\; q {\epsilon }= {\epsilon }q, \end{aligned}$$
(6.2)

with respect to composition. Then \({\alpha },{\epsilon }\) are non-commuting operators with respect to the q-product determined by the relations in (6.2) and generate the \({\mathbb {Q}}\)-algebra \(\langle {\alpha },{\epsilon }\rangle \), which acts on the space of rational functions. We thus express Theorem 6(1) as

$$\begin{aligned} \mathcal {W}_{\mathcal {C}}^{\mathcal {P}}(T) \equiv (1 + q^d {\alpha }{\epsilon })\mathcal {W}_{\mathcal {C}}(T) = (1 + q^{d-1} {\epsilon }{\alpha })\mathcal {W}_{\mathcal {C}}(T) \mod T^{n-d+1}, \end{aligned}$$
(6.3)

An immediate corollary of Theorem 6 is as follows.

Corollary 5

Let \(\mathcal {C}\) have minimum distance d. For \(0\le i\le d\) we have that,

  1. 1.

    \((1+q^d {\alpha }{\epsilon })^i\mathcal {W}_{\mathcal {C}}^{\mathcal {S}}(T) \equiv (1+q^d {\alpha }{\epsilon })^i\mathcal {W}_{\mathcal {C}}(T) \mod T^{n-d} \),

  2. 2.

    \((1+q^d {\alpha }{\epsilon })^i\mathcal {W}_{\mathcal {C}}^{\mathcal {P}}(T) \equiv (1+q^d {\alpha }{\epsilon })^{i+1}\mathcal {W}_{\mathcal {C}}(T) \mod T^{n-d+1} \).

In particular, for \(d_\mathcal {S}=d,d_\mathcal {P}=d-1\) and \(n_\mathcal {P}= n_\mathcal {S}= n-1\) we have

  1. 1.

    \((1+q^d {\alpha }{\epsilon })^{d_\mathcal {S}}\mathcal {W}_{\mathcal {C}}^{\mathcal {S}}(T) \equiv (1+q^d {\alpha }{\epsilon })^{d}\mathcal {W}_{\mathcal {C}}(T) \mod T^{n_\mathcal {S}-d_\mathcal {S}+1} \),

  2. 2.

    \((1+q^d {\alpha }{\epsilon })^{d_\mathcal {P}}\mathcal {W}_{\mathcal {C}}^{\mathcal {P}}(T) \equiv (1+q^d {\alpha }{\epsilon })^{d}\mathcal {W}_{\mathcal {C}}(T) \mod T^{n_\mathcal {P}-d_\mathcal {P}+1}.\)

We write \(\mathcal {W}_{\mathcal {C}}^{\mathcal {P}^r}(T)\) to denote the normalized weight enumerator that results from applying the puncturing operation r times to \(\mathcal {W}_{\mathcal {C}}(T)\). Note that the operators \((1+q^r{\alpha }{\epsilon })\) and \((1+q^s{\alpha }{\epsilon })\) commute, so there is no ambiguity in the following statement.

Corollary 6

Let \(\mathcal {C}\) have minimum distance d. Then

$$\begin{aligned} \mathcal {W}_{\mathcal {C}}^{\mathcal {P}^r}(T)\equiv & {} \prod _{j=0}^{r-1}(1+q^{d-j} {\alpha }{\epsilon })\mathcal {W}_{\mathcal {C}}(T) \mod T^{n-d+1},\\= & {} \sum _{j=0}^r q^{j(d-r+j)} \left[ \begin{matrix} r \\ j \end{matrix} \right] _{}T^j \mathcal {W}_{\mathcal {C}}(q^j T). \end{aligned}$$

Proof

The first equation is derived by repeated applications of (6.3). The well known identity \(\prod _{j=0}^{r-1}(1+q^jy) = \sum _{j=0}^{r}q^{\left( {\begin{array}{c}j\\ 2\end{array}}\right) } \left[ \begin{matrix} r \\ j \end{matrix} \right] _{}y^j\), along with the fact that \(({\alpha }{\epsilon })^j = q^{\left( {\begin{array}{c}j\\ 2\end{array}}\right) }{\alpha }^j{\epsilon }^j\), yields the equation

$$\begin{aligned} \prod _{j=0}^{r-1}(1+q^j(q^{d-r+1} {\alpha }{\epsilon })) = \sum _{j=0}^{r}q^{j(d-r+j)} \left[ \begin{matrix} r \\ j \end{matrix} \right] _{} {\alpha }^j {\epsilon }^j. \end{aligned}$$

Applying this to \(\mathcal {W}_{\mathcal {C}}(T)\) results in the 2nd equation. \(\square \)

Example 4

Let \(\mathcal {M}_{m\times n,d}(T)\) be the normalized weight enumerator of an \({\mathbb F}_2\)-\([m \times n,m(n-d+1),d]\) code. Then successively puncturing \(\mathcal {M}_{7\times 7,4}(T)\), we arrive at the normalized weight enumerator of the whole space \(\mathcal {W}_{{\mathbf {F}}_2^{7 \times 4}}(T) = \mathcal {M}_{7\times 4,1}(T)\).

$$\begin{aligned} \mathcal {M}_{7\times 7,4}(T)= & {} 1 + 98 T + 9688 T^2 + 610112 T^3 .\\ \mathcal {M}_{7\times 6,3}(T)= & {} 1 + 114 T + 12824 T^2 + 1230144 T^3,\\\equiv & {} (1+2^4{\alpha }{\epsilon }) \mathcal {M}_{7\times 7,4}(T) \mod T^4,\\= & {} 1 + 114 T + 12824 T^2 + 1230144 T^3 + 78094336 T^4 .\\ \mathcal {M}_{7\times 5,2}(T)= & {} 1 + 122 T + 14648 T^2 + 1640512 T^3,\\\equiv & {} (1+2^3{\alpha }{\epsilon }) \mathcal {M}_{7\times 6,3}(T) \mod T^4,\\= & {} 1 + 122 T + 14648 T^2 + 1640512 T^3 + 78729216 T^4, \\\equiv & {} (1+2^3{\alpha }{\epsilon }) (1+2^4{\alpha }{\epsilon }) \mathcal {M}_{7\times 7,4}(T) \mod T^4,\\= & {} 1 + 122 T + 14648 T^2 + 1640512 T^3 + 156823552 T^4 + 9996075008 T^5. \\ \mathcal {W}_{{\mathbb F}_2^{7 \times 4}}(T)= & {} 1 + 126 T + 15624 T^2 + 1874880 T^3 ,\\\equiv & {} (1+2^2{\alpha }{\epsilon }) \mathcal {M}_{7\times 5,2}(T) \mod T^4,\\= & {} 1 + 126 T + 15624 T^2 + 1874880 T^3 + 52496384 T^4, \\\equiv & {} (1+2^2{\alpha }{\epsilon }) (1+2^3{\alpha }{\epsilon }) \mathcal {M}_{7\times 6,3}(T) \mod T^4,\\\equiv & {} (1+2^2{\alpha }{\epsilon })(1+2^3{\alpha }{\epsilon }) (1+2^4{\alpha }{\epsilon }) \mathcal {M}_{7\times 7,4}(T) \mod T^4,\\= & {} 1 + 126 T + 15624 T^2 + 1874880 T^3, \\+ & {} 209319936 T^4 + 20032782336 T^5 + 1279497601024 T^6. \end{aligned}$$

If we consider the action of \({\alpha }\) and \({\epsilon }\) on \({\mathbb {Q}}[T]/\langle T^s\rangle \) for some positive integer s, then they may be represented as \(s \times s\) rational matrices:

$$\begin{aligned} {\alpha }=\left( \begin{array}{ccccc} 0 &{} 0 &{} \cdots &{} 0 &{} 0 \\ 1 &{} 0 &{} \cdots &{} 0 &{} 0 \\ \vdots &{} \ddots &{} \vdots &{} \vdots &{} \vdots \\ 0 &{} \cdots &{} 1 &{} 0 &{} 0 \\ 0 &{} \cdots &{} 0 &{} 1 &{} 0 \\ \end{array} \right) \text { and } {\epsilon }=\text {diag}(1,q,q^2,\ldots ,q^{s-1}), \end{aligned}$$

so that \(\langle {\alpha }, {\epsilon }\rangle \) form a sub-algebra of \({\mathbb {Q}}^{s \times s}\). Then as an element of \({\mathbb {Q}}^{s \times s}\), \({\alpha }\) is nilpotent so the inverse of the operator \((1+q^t {\epsilon }{\alpha })\) exists and is given by

$$\begin{aligned} (1+q^t {\epsilon }{\alpha })^{-1} = 1-q^t {\epsilon }{\alpha }+(q^t {\epsilon }{\alpha })^2+\cdots +(-1)^{s-1}(q^t {\epsilon }{\alpha })^{s-1}. \end{aligned}$$

For example, with \(s=3\), we have

$$\begin{aligned} 1 + q^t {\epsilon }{\alpha }= \left( \begin{array}{ccc} 1 &{} 0 &{} 0 \\ q^{t+1} &{} 1 &{} 0 \\ 0 &{} q^{t+2} &{} 1 \end{array} \right) \text { and } (1 + q^t {\epsilon }{\alpha })^{-1} = \left( \begin{array}{ccc} 1 &{} 0 &{} 0 \\ -q^{t+1} &{} 1 &{} 0 \\ q^{2t+3} &{} -q^{t+2} &{} 1 \end{array} \right) . \end{aligned}$$

Recall the following formulae (see [9]):

$$\begin{aligned} (T;q)_{\ell }: = \prod _{j=0}^{\ell -1}(1-q^j T) \text { and }(T;q)^{-1}_{\ell }=\sum _{j=0}^{\infty }\left[ \begin{matrix} \ell +j-1 \\ j \end{matrix} \right] _{}T^j. \end{aligned}$$

Then \(\prod _{j=0}^{r-1}(1+q^j(q^{d-r+1}{\alpha }{\epsilon })) = (-q^{d-r+1}{\alpha }{\epsilon };q)_r\) and so

$$\begin{aligned} (-q^{d-r+1}{\alpha }{\epsilon };q)_r^{-1} = \sum _{j=0}^{\infty } (-1)^j\left[ \begin{matrix} r+j-1 \\ j \end{matrix} \right] _{}q^{j(d-r+1)+\left( {\begin{array}{c}j\\ 2\end{array}}\right) } {\alpha }^j{\epsilon }^j. \end{aligned}$$

Lemma 10

Let \(\mathcal {C}\) have minimum distance d. Then

$$\begin{aligned} \mathcal {W}_{\mathcal {C}}(T)\equiv & {} (-q^{d-r+1}{\alpha }{\epsilon };q)_r^{-1} \mathcal {W}_{\mathcal {C}}^{\mathcal {P}^r}(T) \mod T^{n-d+1}\\= & {} \sum _{j=0}^\infty (-1)^jq^{j(d-r+1)+\left( {\begin{array}{c}j\\ 2\end{array}}\right) } \left[ \begin{matrix} r+j-1 \\ j \end{matrix} \right] _{}T^j \mathcal {W}_{\mathcal {C}}^{\mathcal {P}^r}(q^j T). \end{aligned}$$

In particular, puncturing is an invertible operation on normalized weight enumerators, modulo \(T^{n-d+1}\).

Example 5

As \(\prod _{j=0}^{i-1}(q^m-q^j)\left[ \begin{matrix} \ell \\ i \end{matrix} \right] _{}\) is the number of \(m \times \ell \) matrices of rank i, we see that

$$\begin{aligned} \mathcal {W}_{{\mathbb {F}}_q^{m \times \ell }}(T) = \sum _{i=1}^{\ell } \prod _{j=1}^{i-1}(q^m-q^j) T^{i-1}. \end{aligned}$$

As in Example 4, the full space \({\mathbb {F}}_q^{m \times \ell }\) is an MRD code with parameters \([m \times \ell ,m\ell ,1]\) and can be obtained by successive puncturings of an MRD code. Let \(\mathcal {M}(T)\) be the normalized weight enumerator of an MRD \([m \times (n+r),m(n-d+1),d+r ]\) code for some non-negative integer r. Then the previous observations along with Corollary 6 implies that

$$\begin{aligned} \mathcal {M}(T)\equiv & {} \sum _{i=1}^{n-d+1} \prod _{j=1}^{i-1}(q^m-q^j) \prod _{j=0}^{d+r-1}(1+q^{d+r-j}{\alpha }{\epsilon })^{-1} T^{i-1} \mod T^{n-d+1} \\= & {} (q^m-1)^{-1}\sum _{i=1}^{n-d+1} q^{im}(q^{-m};q)_i (-q^{d-r+1} {\alpha }{\epsilon };q)_r^{-1} T^{i-1}\\= & {} (q^m-1)^{-1}\sum _{i=1}^{n-d+1} q^{im}(q^{-m};q)_i \sum _{j=0}^\infty (-1)^{j}q^{j(d-r+i)+\left( {\begin{array}{c}j\\ 2\end{array}}\right) } \left[ \begin{matrix} r+j-1 \\ j \end{matrix} \right] _{}T^{i+j-1}. \end{aligned}$$

Lemma 11

Let \(\mathcal {C}\) have minimum distance d. Then the normalized weight enumerator of the code \(\mathcal {C}\) satisfies

$$\begin{aligned} \mathcal {W}_{\mathcal {C}}(T) \equiv (q^m-1)^{-1}\sum _{i=0}^{n-d} W_{d+i}\left[ \begin{matrix} n \\ i+d \end{matrix} \right] _{}^{-1} \frac{T^{i}}{(T;q)_{i+1}} \mod T^{n-d+1}. \end{aligned}$$

Proof

We have

$$\begin{aligned} \frac{T^{i}}{(T;q)_{i+1}} = \sum _{j=0}^{\infty }\left[ \begin{matrix} i+j \\ j \end{matrix} \right] _{}T^{j+i} = \sum _{j=i}^{\infty }\left[ \begin{matrix} j \\ i \end{matrix} \right] _{}T^{j}, \end{aligned}$$

which yields

$$\begin{aligned} \sum _{i=0}^{n-d} W_{d+i}\left[ \begin{matrix} n \\ i+d \end{matrix} \right] _{}^{-1} \frac{T^{i}}{(T;q)_{i+1}}= & {} \sum _{i=0}^{n-d} W_{d+i}\left[ \begin{matrix} n \\ i+d \end{matrix} \right] _{}^{-1} \sum _{j=i}^{\infty }\left[ \begin{matrix} j \\ i \end{matrix} \right] _{}T^{j} \\= & {} \sum _{j=0}^{\infty }T^{j} \sum _{i=0}^{n-d} W_{d+i}\left[ \begin{matrix} n \\ i+d \end{matrix} \right] _{}^{-1}\left[ \begin{matrix} j \\ i \end{matrix} \right] _{}\\= & {} \sum _{j=0}^{\infty }T^{j} W_{d+j}\left[ \begin{matrix} n \\ j+d \end{matrix} \right] _{}^{-1}. \end{aligned}$$

\(\square \)

7 Zeroes of the zeta polynomial

For a self-dual code \(\mathcal {C}\), Theorem 3 shows that the (in general complex) zeroes of the zeta polynomial \(P_\mathcal {C}(T)\) occur in pairs \(( \alpha , 1/(q^m \alpha ) )\). The two zeroes in a pair are of the same absolute value if and only if \(|\alpha | = (q^m)^{-1/2}.\) Writing \(\zeta (s) = Z(T=(q^m)^{-s}),\) this is the case if and only if as zeroes of \(\zeta (s)\) they satisfy \(\mathrm {Re}\,s = 1/2\). The latter is the critical line for the classical Riemann zeta function as well as for the zeta function of a curve over a finite field, which we recall here for convenience of the reader.

If C is a non-singular projective curve defined over \(\mathbb {F}_q\), for \(k\ge 1\), denote by \(N_k\) the number of \(\mathbb {F}_{q^k}\)-rational points of C, i.e., the cardinality of \(C(\mathbb {F}_{q^ k})\). The zeta-function of C is the formal power series

$$\begin{aligned} Z(C,T)=exp\left( \sum _{k\ge 1}\frac{N_k}{k}T^k\right) . \end{aligned}$$

This expression is well defined as a formal power series (cf. [10, Appendix C]) and satisfies the following properties:

Theorem 7

(Weil, Dwork) The zeta function of any non-singular projective curve of genus g can be expressed as

$$\begin{aligned} Z(C,T)=\frac{P(T)}{(1-T)(1-qT)}, \end{aligned}$$

with \(P(T)\in \mathbb {Z}[T]\) a polynomial of degree 2g, called the zeta-polynomial of C. Moreover, for each root \(\omega \) of P(T) we have

$$\begin{aligned} |\omega |=q^{1/2}. \end{aligned}$$

As we see, Z(CT) is primarily used as a generating function for the number of points on a curve. There is no immediate analogue of this property for linear codes. In another interpretation, the zeta function of a curve describes the growth rate for the dimensions of linear systems on the curve. This is analogous to describing the growth rate of the binomial moments of a linear code. For codes for which the growth rate of the binomial moments is close to the growth rate of dimensions of linear systems the zeroes of the zeta polynomial will lie on the critical line. For the Hamming metric, this occurs for remarkably many codes (more so when the field size is small), including for infinite families of extremal weight enumerators. The zeta polynomial defined in this paper measures the growth rate of binomial moments for rank metric codes, and we may ask whether this growth rate is such that we can expect to find codes with zeroes of the zeta polynomial on the critical line. We give an example where the zeta polynomial is an exact match to the zeta polynomial of a (Hasse-Weil maximal) elliptic curve.

Example 6

To construct a formally self-dual \(4 \times 4\) rank metric code we take the extended binary QR-code of length 18 in double-circulant form. We puncture at the last coordinate in one circulant block and shorten at the last coordinate in the other block. We then read out the remaining 16 coordinates in order and from each group of four coordinates form a row for a codeword in \(4 \times 4\) format. The rank distribution for the 256 codewords is \(0^1, 2^{21}, 3^{162}, 4^{72}.\) The normalized binomial moments are \(b_0=3/5,b_1=2^4-1,b_2=2^8-1,\ldots \) The code has zeta function

$$\begin{aligned} Z_{\mathcal {C}}(T) := \frac{1}{16-1} \left( \frac{3}{5}+(16-1) T+ (16^2-1) T^2 + \cdots \right) = \frac{1}{25}\,{\frac{1+8\,T +16\,T^2}{ \left( 1-T \right) \left( 1-16\,T \right) }} \end{aligned}$$

and zeta polynomial \(P(T)= (1+8T+16T^2)/25=(1+4T)^2/25\). The double zero \(T=-1/4\) has absolute value \((q^m)^{-1/2}=(2^4)^{-1/2}=1/4\) and thus the zeroes of the zeta function lie on the critical line. The zeta function is that of a maximal elliptic curve over the field of 16 elements.

Remark 2

Note that constructing a self-dual rank metric code from a self-dual linear code in this way is not unique; in other words, equivalent codes of length 16 may lead to inequivalent \(4\times 4\) rank metric codes. The rank weight distributions obtained need not bear any relations to each other. It requires further research as to what distributions, and hence what zeta polynomials, may occur from codes constructed in this way.

Heuristics for the Hamming metric are that a sufficient condition for a matching growth rate, and thus for zeroes on the critical line, are that a (formally self-dual) code has large enough minimum distance and weight distribution close to that of a random code. Precise formulations of these observations and their verification are an open problem.

We applied the same construction as in the example to double-circulant codes of length 38 to obtain formally self-dual \(6 \times 6\) rank metric codes. Among those, 12 codes had minimum rank distance 3 and thus a quadratic zeta polynomial. The rank distributions for these codes are not far apart and in all 12 cases the zeroes of the zeta polynomial are on the critical line. Among codes with lower minimum rank distance a wider range of rank distributions occurs. The distributions close to the average have zeroes on the critical line and those farther away have pairs of real zeroes. Typically one of the real zeroes among \(( \alpha , 1/(q^m \alpha ) )\) is close to 1 and the other close to \(1/q^m\). This agrees with observations for the Hamming metric. These preliminary observations suggest that the zeroes of zeta polynomials for the rank metric have properties similar to those for the Hamming metric. It remains to make these properties precise and to establish to what extent or under which additional assumptions the properties are similar to those for curves.

7.1 Self-dual divisible codes

Here we consider a family of codes which are divisible (that is, the rank weight of every codeword is divisible by some integer \(c>1\)) and also formally self-dual. It is known that for codes in the Hamming metric, such codes can only exist for \((q,c)\in \{(2,2),(2,4),(3,3),(4,2)\}\). In [4] the zeta polynomials of self-dual divisible codes that are also random were considered.

Here we show the existence of formally self-dual divisible codes for \(c=2\) and all values of q. However we note that this construction never leads to random codes.

The matrix space \(M_{m\times n}({\mathbb {F}}_{q^c})\) can be naturally embedded in the space \(M_{cm\times cn}({\mathbb {F}}_q)\). The rank of every matrix in the image of this map is a multiple of c; in fact, we have

$$\begin{aligned} \text{ rk }_{{\mathbb {F}}_q}(A)=c\cdot \text{ rk }_{{\mathbb {F}}_{q^c}}(A). \end{aligned}$$

Therefore, from codes over an extension field, we can produce divisible codes easily. This is in contrast to the Hamming metric case, where the Hamming weight of a vector does not behave well when reducing the field of interest.

A code \(\mathcal {C}'\) of dimension k over \({\mathbb {F}}_{q^c}\) produces a code \(\mathcal {C}\) of dimension kc over \({\mathbb {F}}_q\). If we wish \(\mathcal {C}\) to be formally self-dual, we must have \(k= mnc/2\). As \(k\le mn\), we need \(c=2\), and thus \(\mathcal {C}'\) is in fact the full space \(M_{m\times n}({\mathbb {F}}_{q^2})\).

For the image of the space \(M_{2\times 2}({\mathbb {F}}_{q^2})\) in \(M_{4\times 4}({\mathbb {F}}_q)\), we get the zeta polynomial

$$\begin{aligned} P(T)=\frac{1+ (-q^4 + q^2 + q)T +q^4T^2}{q^2+q+1}. \end{aligned}$$

For example taking \(q=2\) we get the zeta polynomial \(P(T)=(1-10T+16T^2)/7\). The discriminant of this polynomial is positive for all values of \(q\ge 2\), and so we get two real roots, whose product is \(q^{-4}\).

For the image of the space \(M_{3\times 3}({\mathbb {F}}_{q^2})\) in \(M_{6\times 6}({\mathbb {F}}_q)\), we get the zeta polynomial

$$\begin{aligned} P(T)=\frac{1+(-q^6 + q^2 + q)T+ (-q^8 - q^7 + q^6 + q^4 + q^3)T^2 + (-q^{12} + q^8 + q^7)T^3+q^{12}T^4}{q^4+q^3+q^2+q+1}. \end{aligned}$$

For example taking \(q=2\) we get \(P(T) = (1-58T-296T^2-3712T^3+4096T^4)/15\), which has two real roots and one pair of conjugate complex roots.

In general, the image \(\mathcal {C}\) of the space \(M_{m\times m}({\mathbb {F}}_{q^2})\) in \(M_{2m \times 2m}({\mathbb {F}}_q)\) is a formally self-dual code with minimum rank distance \(d=2\) and all rank weights divisible by \(c = 2\). Let \(\rho =q^{-m}.\) The zeta polynomial P(T) for \(\mathcal {C}\) has two real roots. As \(m \rightarrow \infty \), the roots converge to 1 and \(\rho ^2\). The rescaled polynomial \(p(T) = P(\rho T) / P(0) = 1 + \cdots + T^{2m-2}\) is self-reciprocal. It has two real roots that converge to \(\rho ^{-1}\) and \(\rho \) as \(m \rightarrow \infty \) and \(2m-4\) complex roots that lie on the unit circle. As \(m \rightarrow \infty \), the factor \(p_1(T)\) of p(T) with two real roots converges to \(1-(\rho ^{-1}+\rho )T+T^2\). The cofactor \(p_2(T)\) with complex roots converges to \(1+T^{2m-4}\) (Fig. 1).

Fig. 1
figure 1

Complex zeroes for the image of \(M_9(\mathbb {F}_4)\) in \(M_{18}(\mathbb {F}_2)\)

The coefficients of p(T) approach 0 as \(m \rightarrow \infty \) except for the coefficients at \(1, T, T^2\) and their reciprocals. The coefficients of p(T) at 1, T and \(T^2\) can be obtained with (4.4) by expressing the rank weight enumerator of \(\mathcal {C}\) as a linear combination of the \({\mathbb {F}}_q\) rank weight enumerators \(M_{2m,d}\), for \(d \ge 2\). We find

$$\begin{aligned} \lim _{m \rightarrow \infty } p(T)= & {} 1 - (q^m-\rho (q^2+q)) T - (q^2+q-\rho ^2(q^6+q^4+q^2) T^2 + \cdots + \\&- (q^2+q-\rho ^2(q^6+q^4+q^2) T^{2m-4} - (q^m-\rho (q^2+q)) T^{2m-3} + T^{2m-2}. \end{aligned}$$

As \(m \rightarrow \infty \), and thus \(\rho = q^{-m} \rightarrow 0\), \(p(\rho ) \rightarrow 0.\) Therefore, \(p_1(T) = 1-(\rho ^{-1}+\rho )T+T^2\) divides the limit and the cofactor \(p_2(T)\) satisfies

$$\begin{aligned} \lim _{m \rightarrow \infty } p_2(T)= & {} 1 + (q^2+q+1)\rho T + (q^6+q^4+2q^2+q+1) \rho ^2 T^2 + \cdots + \\&\quad +\,(q^6+q^4+2q^2+q+1) \rho ^2 T^{2m-6} + (q^2+q+1)\rho T^{2m-5} + T^{2m-4}. \end{aligned}$$

The limits converge fast. We find that the complex zeroes of the zeta polynomial for the image of \(M_{m\times m}({\mathbb {F}}_{q^2})\) in \(M_{2m \times 2m}({\mathbb {F}}_q)\) all have the same absolute value \(\rho \) and, already for small m, are close to the zeroes of \(1+(q^mT)^{2m-4}=0\).