Skip to main content

Rank-metric codes and their duality theory


We compare the two duality theories of rank-metric codes proposed by Delsarte and Gabidulin, proving that the former generalizes the latter. We also give an elementary proof of MacWilliams identities for the general case of Delsarte rank-metric codes. The identities which we derive are very easy to handle, and allow us to re-establish in a very concise way the main results of the theory of rank-metric codes first proved by Delsarte employing association schemes and regular semilattices. We also show that our identities imply as a corollary the original MacWilliams identities established by Delsarte. We describe how the minimum and maximum rank of a rank-metric code relate to the minimum and maximum rank of the dual code, giving some bounds and characterizing the codes attaining them. Then we study optimal anticodes in the rank metric, describing them in terms of optimal codes (namely, MRD codes). In particular, we prove that the dual of an optimal anticode is an optimal anticode. Finally, as an application of our results to a classical problem in enumerative combinatorics, we derive both a recursive and an explicit formula for the number of \(k \times m\) matrices over a finite field with given rank and \(h\)-trace.

This is a preview of subscription content, access via your institution.


  1. Bender E.A.: On Buckhiesters enumeration of \(n\times n\) matrices. J. Comb. Theory Ser. A 17, 273–274 (1974).

  2. Buckhiester P.G.: The number of \(n \times n\) matrices of rank \(r\) and trace \(\alpha \) over a finite field. Duke Math. J. 39, 695–699 (1972).

  3. Camion P.: Codes and association schemes. In: Pless V.S., Huffman W.C. (eds.) Handbook of Coding Theory, pp. 1441–1566. Elsevier, New York (1998).

  4. Delsarte P.: An algebraic approach to the association schemes of coding theory. Philips Res. Rep. 10 (1973).

  5. Delsarte P.: Association schemes and \(t\)-designs in regular semilattices. J. Comb. Theory Ser. A 20, 230–243 (1976).

  6. Delsarte P.: Bilinear forms over a finite field, with applications to coding theory. J. Comb. Theory Ser. A 25(3), 226–241 (1978).

  7. Delsarte P., Levenshtein V.: Association schemes and coding theory. IEEE Trans. Inf. Theory 44, 2477–2504 (1988).

  8. Dumas J.G., Gow R., McGuire G., Sheekey J.: Subspaces of matrices with special rank properties. Linear Algebra Appl. 433, 191–202 (2010).

  9. Gabidulin E.: Theory of codes with maximum rank distance. Probl. Inf. Transm. 1(2), 1–12 (1985).

  10. Gadouleau M., Yan Z.: MacWilliams Identities for the Rank Metric, pp. 36–40. ISIT, France (2007).

  11. Gadouleau M., Yan Z.: MacWilliams identity for codes with the rank metric. EURASIP J. Wirel. Commun. Netw. (2008). doi:10.1155/2008/754021

  12. Gluesing-Luerssen H.: Fourier-reflexive partitions and MacWilliams identities for additive codes. Des. Codes Cryptogr. (to appear). Preprint available at

  13. Grant D., Varanasi M.: Duality theory for space-time codes over finite fields. Adv. Math. Commun. 2(1), 35–54 (2005).

  14. Grant D., Varanasi M.: Weight enumerators and a MacWilliams-type identity for space-time rank codes over finite fields. In: Proceedings of the 43rd Annual Allerton Conference on Communication, Control, and Computing, pp. 2137–2146 (2005).

  15. Kötter R., Kschischang F.R.: Coding for errors and erasures in random network coding. IEEE Trans. Inf. Theory 54(8), 3579–3591 (2008).

  16. Li Y., Hu S.: Gauss sums over some matrix groups. J. Number Theory 132(12), 2967–2976 (2012).

  17. MacWilliams F.J.: A theorem on the distribution of weights in a systematic code. Bell Syst. Tech. J. 42(1), 79–94 (1963).

  18. MacWilliams F.J., Sloane N.J.A.: The Theory of Error-Correcting Codes. North Holland Mathematical Library (1978).

  19. Lidl R., Niederreiter H.: Finite Fields. Addison-Wesley, Boston (1983).

  20. Jungnickel D., Menezes A.J., Vanston S.A.: The number of self-dual bases of \(GF(q^m)\) over \(GF(q)\). Proc. Am. Math. Soc. 109(1), 23–29 (1990).

  21. Silva D., Kschishang F.R.: On metrics for error correction in network coding. IEEE Trans. Inf. Theory 55(12), 5479–5490 (2009).

  22. Silva D., Kschischang F.R.: Universal secure network coding via rank-metric codes. IEEE Trans. Inf. Theory 57(2), 1124–1135 (2011).

  23. Silva D., Rogers E.S., Kschishang F.R., Koetter R.: A rank-metric approach to error control in random network coding. IEEE Trans. Inf. Theory 54(9), 3951–3967 (2008).

  24. Stanley P.: Enumerative Combinatorics, vol. 1, 2nd edn., Cambridge Studies in Advanced Mathematics, vol 49. Cambridge University Press, Cambridge (2012).

Download references


The author is grateful to Elisa Gorla and to the Referees for many useful suggestions that improved the presentation of the paper. The author was partially supported by the Swiss National Science Foundation through Grant No. 200021_150207.

Author information

Authors and Affiliations


Corresponding author

Correspondence to Alberto Ravagnani.

Additional information

Communicated by C. Ding.

Appendix: Explicit form of Theorems 31 and 62

Appendix: Explicit form of Theorems 31 and 62

Using known properties of binomial coefficients one can show that Theorem 31 implies Theorem 3.3 of [6] as an easy corollary. The following result, first proved by Delsarte using the theory of association schemes, may be regarded as the explicit version of Theorem 31.

Theorem 64

Let \(\mathcal {C} \subseteq \text{ Mat }(k \times m, \mathbb {F}_q)\) be a code. Let \({(A_i)}_{i \in \mathbb {N}}\) and \({(B_j)}_{j \in \mathbb {N}}\) be the rank distributions of \(\mathcal {C}\) and \(\mathcal {C}^\perp \), respectively. We have

$$\begin{aligned} B_j=\frac{1}{|\mathcal {C}|} \sum \limits _{i=0}^k A_i \sum \limits _{s=0}^k {(-1)}^{j-s} q^{ms+ \left( {\begin{array}{c}j-s\\ 2\end{array}}\right) } \begin{bmatrix} k-s \\ k-j \end{bmatrix} \begin{bmatrix} k-i \\ s \end{bmatrix} \end{aligned}$$

for \(j =0,...,k\).


Throughout this proof the rows and columns of matrices are labeled from \(0\) to \(k\) for convenience (instead of from \(1\) to \(k+1\)). Define the matrix \(P \in \text{ Mat }(k+1 \times k+1,\mathbb {F}_q)\) by

$$\begin{aligned} P_{ji}{:=}\frac{1}{|\mathcal {C}|} \sum _{s=0}^k (-1)^{j-s} q^{ms+ \left( {\begin{array}{c}j-s\\ 2\end{array}}\right) } \begin{bmatrix} k-s \\ k-j \end{bmatrix} \begin{bmatrix} k-i \\ s \end{bmatrix} \end{aligned}$$

for \(j,i \in \{0,...,k\}\). We can write the statement in matrix form as \((B_0,...,B_k)^t= P \cdot (A_0,...,A_k)^t\). Define matrices \(S,T \in \text{ Mat }(k+1 \times k+1,\mathbb {F}_q)\) by

$$\begin{aligned} S_{ij}{:=} \begin{bmatrix} k-j \\ i-j \end{bmatrix}, \ \ \ \ \ T_{ij}{:=} \frac{q^{mi}}{|\mathcal {C}|} \begin{bmatrix} k-j \\ i \end{bmatrix} \end{aligned}$$

for \(i,j \in \{0,...,k\}\). We notice that \(S\) is invertible, since it is lower-triangular and \(S_{ii}=1\) for \(i=0,...,k\). Theorem 31 reads \(S \cdot (B_1,...,B_k)^t = T \cdot (A_0,...,A_k)^t\), i.e., \((B_1,...,B_k)^t = S^{-1}T \cdot (A_0,...,A_k)^t\). Hence it suffices to prove \(P=S^{-1}T\), i.e., \(T=SP\). Fix arbitrary integers \(i,j \in \{0,...,k\}\). We have

$$\begin{aligned} (SP)_{ij}= & {} \frac{1}{|\mathcal {C}|}\sum _{r=0}^k \begin{bmatrix} k-r \\ i-r \end{bmatrix} \sum _{s=0}^k (-1)^{r-s} q^{ms+ \left( {\begin{array}{c}r-s\\ 2\end{array}}\right) } \begin{bmatrix} k-s \\ k-r \end{bmatrix} \begin{bmatrix} k-j \\ s \end{bmatrix} \\= & {} \frac{1}{|\mathcal {C}|} \sum _{s=0}^k q^{ms} \begin{bmatrix} k-j \\ s \end{bmatrix} \sum _{r=0}^k \begin{bmatrix} k-r \\ i-r \end{bmatrix} (-1)^{r-s} q^{\left( {\begin{array}{c}r-s\\ 2\end{array}}\right) } \begin{bmatrix} k-s \\ k-r \end{bmatrix}. \end{aligned}$$


$$\begin{aligned} \begin{bmatrix} k-r \\ i-r \end{bmatrix}= \begin{bmatrix} k-r \\ k-i \end{bmatrix}, \end{aligned}$$

and using the definition of \(q\)-binomial coefficient one finds

$$\begin{aligned} \begin{bmatrix} k-s \\ k-r \end{bmatrix} \begin{bmatrix} k-r \\ k-i \end{bmatrix} = \begin{bmatrix} k-s \\ k-i \end{bmatrix} \begin{bmatrix} i-s \\ r-s \end{bmatrix}. \end{aligned}$$

Hence we have

$$\begin{aligned} \sum _{r=0}^k \begin{bmatrix} k-r \\ i-r \end{bmatrix} (-1)^{r-s} q^{\left( {\begin{array}{c}r-s\\ 2\end{array}}\right) } \begin{bmatrix} k-s \\ k-r \end{bmatrix}= & {} \sum _{r=0}^k \begin{bmatrix} k-s \\ k-i \end{bmatrix} \begin{bmatrix} i-s \\ r-s \end{bmatrix} (-1)^{r-s} q^{\left( {\begin{array}{c}r-s\\ 2\end{array}}\right) } \\= & {} \begin{bmatrix} k-s \\ k-i \end{bmatrix} \sum _{r=0}^k \begin{bmatrix} i-s \\ r-s \end{bmatrix} (-1)^{r-s} q^{\left( {\begin{array}{c}r-s\\ 2\end{array}}\right) } \\= & {} \begin{bmatrix} k-s \\ k-i \end{bmatrix} \sum _{r=-s}^{k-s} \begin{bmatrix} i-s \\ r \end{bmatrix} (-1)^{r} q^{\left( {\begin{array}{c}r\\ 2\end{array}}\right) } \\= & {} \begin{bmatrix} k-s \\ k-i \end{bmatrix} \sum _{r=0}^{i-s} \begin{bmatrix} i-s \\ r \end{bmatrix} (-1)^{r} q^{\left( {\begin{array}{c}r\\ 2\end{array}}\right) } \\= & {} \left\{ \begin{array}{ll} 1 &{}\;\, {\hbox {if}}\, s=i, \\ 0 &{} \text{ otherwise, } \end{array} \right. \ \end{aligned}$$

where the last equality follows from the \(q\)-Binomial Theorem [24], p. 74]. It follows

$$\begin{aligned} (SP)_{ij}= \frac{1}{|\mathcal {C}|} q^{mi} \begin{bmatrix} k-j \\ i \end{bmatrix}=T_{ij}, \end{aligned}$$

as claimed. \(\square \)

Arguing as in the proof of Theorem 62 and replacing Corollary 33 with Theorem 64 we easily obtain the following explicit version of Theorem 62.

Theorem 65

Let \(1 \le k \le m\), \(1 \le h \le k\) and \(0 \le r \le k\) be integers. The number of \(k \times m\) matrices over \(\mathbb {F}_q\) having rank \(r\) and zero \(h\)-trace is

$$\begin{aligned} n_q(k\times m, r,h)=\frac{1}{q} \sum \limits _{s=0}^k {(-1)}^{r-s} q^{ms+ \left( {\begin{array}{c}r-s\\ 2\end{array}}\right) } \begin{bmatrix} k-s \\ k-r \end{bmatrix} \left( \begin{bmatrix} k \\ s \end{bmatrix} + (q-1) \begin{bmatrix} k-h \\ s \end{bmatrix}\right) . \end{aligned}$$

Remark 66

Theorem 65 generalizes the works cited in Remark 61.

Rights and permissions

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Ravagnani, A. Rank-metric codes and their duality theory. Des. Codes Cryptogr. 80, 197–216 (2016).

Download citation

  • Received:

  • Revised:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI:


  • Rank-metric code
  • Duality
  • MacWilliams identity
  • Network coding
  • Trace
  • Matrix

Mathematics Subject Classification

  • 15A03
  • 15A99
  • 15B99