Back to resources

Article and note

A Series Learning through the MacWilliams IdentityPart 6 of 12

An Introduction to Pless Moments through the MacWilliams Identity

Among the five proof systems for the MacWilliams identity, this note focuses on the moment and double-counting approach, and introduces moments of the weight distribution, binomial moments, Pless power moment identities, double counting, and the recovery of a distribution from its moments.
Published:
Updated:
Reading time:
20 min (about 4,251 words)
Tagscoding theoryMacWilliams identityPless power momentsmomentsdouble countingweight distributionfinite fieldsexpository note
Download PDF

Introduction

One of the fundamental theorems in coding theory is the MacWilliams identity. Let EE be the coordinate set, let n=En = \card{E}, and let CFqEC \leq \F_{q}^{E} be a linear code over the finite field Fq\F_{q}. For CC, consider its dual code

C{uFqE:uc=0 for all cC}C^{\perp} \coloneqq \{ u \in \F_q^E : u \cdot c = 0 \text{ for all } c \in C \}

where

uc=eEueceu \cdot c = \sum_{e \in E} u_e c_e

is the standard inner product. In this note, for a word cFqEc \in \F_q^E, write

supp(c)={eE:ce0},wt(c)=supp(c).\supp(c)=\{e\in E: c_e\neq 0\}, \qquad \wt(c)=\card{\supp(c)}.

Define the weight enumerator of the linear code CC by

WC(X,Y)cCXnwt(c)Ywt(c).W_{C}(X, Y) \coloneqq \sum_{c \in C} X^{n - \wt(c)} Y^{\wt(c)}.

The MacWilliams identity is the formula saying that the weight enumerator of the dual code can be computed from the weight enumerator of CC as follows:

WC(X,Y)=1CWC(X+(q1)Y,XY).W_{C^{\perp}}(X,Y) = \frac{1}{\card{C}} W_{C}\bigl( X + (q - 1)Y, X - Y \bigr).

This is the MacWilliams identity.

In this series, I use proofs of the MacWilliams identity as a guide to an introduction to neighbouring areas and concepts. Accordingly, this series is aimed at readers who already know the following basic material in coding theory:

We assume familiarity, at least at a basic level, with

  • what a (finite) field is,

  • what a linear code over a finite field is,

  • what the Hamming weight is,

  • what the dual code is.

(There is no problem if you do not know a proof of the MacWilliams identity.)

This note does not assume Parts 1–5. Krawtchouk polynomials and association schemes appear in the background at some points, but this note does not use their theory. The only tools needed here are weight distributions, moments, binomial coefficients, double counting, and finite-dimensional linear algebra.

In this series, I look at proof methods for the MacWilliams identity under the following five broad families.

  1. Fourier, character, and Poisson methods.

  2. Möbius inversion, lattice-theoretic, and shortening/puncturing methods.

  3. Orthogonal-polynomial and association-scheme methods.

  4. Matroid and Tutte-polynomial methods.

  5. Moment and double-counting methods.

In this note, I focus on the last of these: the moment and double-counting approach. The aim of this note is to use a proof of the MacWilliams identity as a guide to an introduction to Pless moments, especially moments of the weight distribution and double counting.

Write the weight distribution as

Aw(C)={cC:wt(c)=w}(0wn).A_{w}(C) = \card{\{ c \in C: \wt(c) = w \}} \qquad (0 \leq w \leq n).

Then the weight enumerator is

WC(X,Y)=w=0nAw(C)XnwYw.W_{C}(X, Y) = \sum_{w = 0}^{n} A_{w}(C) X^{n-w} Y^{w}.

From another point of view, using Krawtchouk polynomials and Hamming schemes, one can regard the MacWilliams identity as a transform of the weight distribution itself. Here a Hamming scheme is, roughly speaking, the combinatorial structure obtained by classifying two words according to their Hamming distance. However, this note does not use its theoretical definition or general theory. Here, instead of transforming the weight distribution directly, we first look at

w=0nAw(C)whandw=0nAw(C)(wr)\sum_{w = 0}^{n} A_{w}(C) w^{h} \quad\text{and}\quad \sum_{w=0}^{n} A_{w}(C) \binom{w}{r}

as moments.

In probability theory, one studies means, variances, and higher moments in order to understand a distribution. We shall do the same here. However, the moments used in this note are not expectations obtained by normalising to a probability distribution. They are moments as sums over all codewords. If one wants to view them as probabilistic means or expectations, one should divide these quantities by C\card{C}. That said, in coding theory, moments involving binomial coefficients (wr)\binom{w}{r} are more natural than moments involving ordinary powers whw^{h}. The reason is that (wt(c)r)\binom{\wt(c)}{r} is the number of ways to choose rr coordinates from the non-zero coordinates of the codeword cc. Therefore

w=0nAw(C)(wr)\sum_{w=0}^{n}A_{w}(C)\binom{w}{r}

counts pairs consisting of a codeword and a coordinate set. By counting this quantity in two ways, Pless moment identities appear.

The flow of this note is as follows.

weight distribution \to binomial moments \to moment generating function \to double counting \to Pless moment identities \to MacWilliams identity

In Pless's classical paper [Ple63], power moment identities are derived from the MacWilliams identity, and applications are also given. In this note, I do not take the MacWilliams identity as known. Instead, I compute the binomial moments directly by double counting and explain how the MacWilliams identity can be recovered from sufficiently many moments. For the classical treatment of the weight distribution of the dual code and the MacWilliams equations, see MacWilliams–Sloane [MS77, Chapter 5]. For equivalent formulations including the MacWilliams equations and Pless moments, Huffman–Pless [HP03, Sections 7.1–7.2] is a standard reference. For a textbook treatment of Pless moments, see also Pless [Ple98, Chapter 8].

Weight Distributions and Moments

First, view the weight distribution as a sequence. Let CFqEC \leq \F_{q}^{E} be a linear code, and write

AwAw(C)={cC:wt(c)=w}(0wn).A_{w} \coloneqq A_{w}(C) = \card{\{ c \in C : \wt(c) = w \}} \qquad (0\leq w\leq n).

This sequence (A0,A1,,An)(A_{0}, A_{1}, \dots, A_{n}) is the weight distribution of CC.

In order to collect the weight distribution into a one-variable polynomial, set

PC(t)WC(1,t)=w=0nAwtw.P_{C}(t) \coloneqq W_{C}(1, t) = \sum_{w=0}^{n} A_{w} t^{w}.

This PC(t)P_{C}(t) is the dehomogenisation of the weight enumerator WC(X,Y)W_{C}(X,Y). Indeed, we may read

WC(X,Y)=XnPC(Y/X).W_C(X, Y) = X^{n} P_{C}(Y/X).

Here Y/XY/X is a formal substitution, and in the end both sides are compared as polynomials.

Definition 2.1.

For a non-negative integer hh, define the hh-th power moment of CC by

Mhpow(C)w=0nAw(C)wh.M_{h}^{\mathrm{pow}}(C) \coloneqq \sum_{w = 0}^{n} A_{w}(C) w^{h}.

When h=0h = 0, we use the convention 00=10^{0} = 1, and hence

M0pow(C)=w=0nAw(C)=C.M_{0}^{\mathrm{pow}}(C) = \sum_{w=0}^{n} A_{w}(C) = \card{C}.

When h=1h = 1, this is the total weight of all codewords,

cCwt(c).\sum_{c \in C} \wt(c).

When h=2h=2, it is the sum of the squares of the weights.

In coding theory, however, the following binomial moments are easier to handle than power moments.

Definition 2.2.

For 0rn0 \leq r \leq n, define the rr-th binomial moment of CC by

Mr(C)w=0nAw(C)(wr).M_{r}(C) \coloneqq \sum_{w = 0}^{n} A_{w}(C) \binom{w}{r}.

Here we use the convention (wr)=0\binom{w}{r}=0 for w<rw < r. The meaning of a binomial moment is very concrete. If we fix a codeword cCc \in C, then (wt(c)r)\binom{\wt(c)}{r} is the number of ways to choose rr coordinates from supp(c)\supp(c). Thus the rr-th binomial moment Mr(C)M_{r}(C) counts pairs of the following form:

(c,S)wherecC,Ssupp(c),S=r.(c, S) \quad\text{where}\quad c \in C, \quad S \subseteq \supp(c), \quad \card{S} = r.

This viewpoint of counting pairs is the entrance to the Pless moment identity.

The Binomial-Moment Generating Function

Binomial moments appear as the coefficients when the polynomial PC(t)P_{C}(t) is expanded around t=1t = 1.

Theorem 3.1.

Let PC(t)=w=0nAw(C)twP_{C}(t) = \sum_{w = 0}^{n} A_{w}(C) t^{w}. Then

PC(1+z)=r=0nMr(C)zrP_{C}(1 + z) = \sum_{r = 0}^{n} M_{r}(C) z^{r}

holds.

Proof

By the binomial theorem,

(1+z)w=r=0w(wr)zr.(1 + z)^{w} = \sum_{r = 0}^{w} \binom{w}{r} z^{r}.

Therefore

PC(1+z)=w=0nAw(C)(1+z)w=w=0nAw(C)r=0w(wr)zr=r=0n(w=0nAw(C)(wr))zr=r=0nMr(C)zr.\begin{aligned} P_{C}(1 + z) &= \sum_{w = 0}^{n} A_{w}(C)(1 + z)^{w} \\ &= \sum_{w = 0}^{n} A_{w}(C) \sum_{r = 0}^{w} \binom{w}{r} z^{r} \\ &= \sum_{r = 0}^{n} \left( \sum_{w = 0}^{n} A_{w}(C) \binom{w}{r} \right)z^r \\ &= \sum_{r = 0}^{n} M_{r}(C) z^{r}. \end{aligned}
End of proof

This theorem shows that the binomial moments determine the distribution completely.

Theorem 3.2.

For a sequence a0,a1,,ana_{0}, a_{1}, \dots, a_{n}, set

mr=w=0naw(wr)(0rn).m_{r} = \sum_{w=0}^{n} a_{w} \binom{w}{r} \qquad(0 \leq r\leq n).

Then a0,a1,,ana_{0}, a_{1}, \dots, a_{n} can be recovered uniquely from m0,m1,,mnm_{0}, m_{1}, \dots, m_{n}. Explicitly,

aw=r=wn(1)rw(rw)mr(0wn).a_{w} = \sum_{r=w}^{n}(-1)^{r-w}\binom{r}{w} m_{r} \qquad(0\leq w\leq n).
Proof

Put P(t)=w=0nawtwP(t) = \sum_{w=0}^{n} a_{w} t^{w}. The assumption is precisely that

P(1+z)=r=0nmrzrP(1 + z) = \sum_{r = 0}^{n} m_{r} z^{r}

holds. Substituting z=t1z = t - 1, we get

P(t)=r=0nmr(t1)r.P(t) = \sum_{r = 0}^{n} m_{r}(t - 1)^{r}.

Taking the coefficient of twt^{w} on the right-hand side gives

aw=r=wnmr(rw)(1)rw.a_{w} = \sum_{r=w}^{n} m_{r} \binom{r}{w}(-1)^{r-w}.
End of proof

This theorem is important in the proof in this note. The MacWilliams identity is a formula relating entire weight distributions. However, even without handling the whole weight distribution directly, one can recover the weight distribution once all binomial moments are known. Therefore, to find the weight distribution of the dual code, it is enough to find all binomial moments of the dual code.

Counting Binomial Moments in Two Ways

We now count binomial moments. Let CC be an [n,k][n,k] linear code over Fq\F_{q}, that is, let dimFqC=k\dim_{\F_{q}} C = k. Thus C=qk\card{C} = q^{k}. We write the number of dual codewords of weight jj simply as Aj(C)A_{j}(C^{\perp}).

The binomial moment Mr(C)=w=0nAw(C)(wr)\displaystyle M_{r}(C) = \sum_{w = 0}^{n} A_{w}(C) \binom{w}{r} counts pairs

(c,S),cC,Ssupp(c),S=r.(c, S), \qquad c \in C, \quad S \subseteq \supp(c), \quad \card{S} = r.

We first count these pairs with SS fixed.

Definition 4.1.

For SES \subseteq E, define

NC(S){cC:ce0 for all eS}.N_{C}(S) \coloneqq \card{\{ c \in C: c_{e} \neq 0 \text{ for all } e \in S\}}.

With this notation,

Mr(C)=SES=rNC(S).(4.1)M_{r}(C) = \sum_{\substack{S \subseteq E \\\card{S} = r}} N_{C}(S). \tag{4.1}

For fixed SS, the number NC(S)N_{C}(S) is the number of codewords for which all coordinates in SS are non-zero. Notice that no condition is imposed on the coordinates outside SS. Thus NC(S)N_{C}(S) is not the number of codewords whose support is exactly SS; it is the number of codewords which are non-zero at least on SS. The condition of being non-zero is not a linear condition, so we first rewrite it in terms of the linear condition of specifying which coordinates are zero.

For TST \subseteq S, consider all codewords whose coordinates in TT are all zero. This is a linear subspace. Consider the restriction map to the coordinates in TT,

ρT ⁣:CFqT,ccT.\rho_{T} \colon C \to \F_{q}^{T}, \qquad c \mapsto c|_{T}.

Its kernel is

Ker(ρT)={cC:ce=0 for all eT}.\Ker(\rho_{T}) = \{ c \in C : c_{e} = 0 \text{ for all } e \in T\}.

If Ze={cC:ce=0}Z_{e} = \{ c \in C : c_{e} = 0\}, then NC(S)N_{C}(S) is the number of codewords which do not belong to any of the ZeZ_{e} with eSe \in S. Therefore, by inclusion–exclusion,

NC(S)=TS(1)TKer(ρT).(4.2)N_{C}(S) = \sum_{T \subseteq S}(-1)^{\card{T}}\card{\Ker(\rho_{T})}. \tag{4.2}

Next, we write Ker(ρT)\card{\Ker(\rho_{T})} using information from the dual code. Let

C(T){uC:supp(u)T}C^{\perp}(T) \coloneqq \{ u \in C^{\perp}:\supp(u) \subseteq T\}

denote the dual codewords whose support is contained in TT. This is not the shortened code of CC^{\perp} on TT itself. It is the subspace consisting of those codewords on EE whose support is contained in TT.

Lemma 4.2.

For any TET \subseteq E,

Ker(ρT)=qkTC(T)\card{\Ker(\rho_{T})} = q^{k - \card{T}} \card{C^{\perp}(T)}

holds.

Proof

Write ρT(C)\rho_{T}(C) for the image of the restriction map ρT ⁣:CFqT\rho_{T} \colon C \to \F_{q}^{T}. By the first isomorphism theorem,

Ker(ρT)=CρT(C)=qkρT(C).\card{\Ker(\rho_{T})} = \frac{\card{C}}{\card{\rho_{T}(C)}} = \frac{q^{k}}{\card{\rho_{T}(C)}}.

On the other hand, with respect to the standard inner product on FqT\F_{q}^{T}, the space C(T)C^{\perp}(T) can be identified with the orthogonal complement of ρT(C)\rho_{T}(C). Indeed, if uFqTu \in \F_{q}^{T} is extended by zero to EE, and this extension is denoted by u~\widetilde{u}, then

uρT(C)ucT=0for all cCu~c=0for all cCu~C.\begin{aligned} u \in \rho_{T}(C)^{\perp} &\Longleftrightarrow u \cdot c|_{T} = 0 \quad\text{for all } c \in C \\ &\Longleftrightarrow \widetilde{u} \cdot c = 0 \quad\text{for all } c \in C \\ &\Longleftrightarrow \widetilde u \in C^{\perp}. \end{aligned}

Since u~\widetilde{u} is zero outside TT, this is equivalent to u~C(T)\widetilde{u} \in C^{\perp}(T). In general, for a subspace DD of the finite-dimensional space FqT\F_{q}^{T}, we have dimD+dimD=T\dim D + \dim D^{\perp} = \card{T}. Hence DD=qT\card{D}\card{D^{\perp}} = q^{\card{T}}. Applying this to D=ρT(C)D = \rho_{T}(C) gives

ρT(C)C(T)=qT.\card{\rho_{T}(C)}\card{C^{\perp}(T)} = q^{\card{T}}.

Substituting this into the equation above, we obtain

Ker(ρT)=qkC(T)qT=qkTC(T).\card{\Ker(\rho_{T})} = q^{k} \frac{\card{C^{\perp}(T)}}{q^{\card{T}}} = q^{k-\card{T}}\card{C^{\perp}(T)}.
End of proof

This lemma is the linear-algebraic core of the double counting. The size of the kernel of the coordinate restriction map of CC is expressed by the number of codewords in CC^{\perp} whose support is contained in TT. The right-hand side contains qkTq^{k-\card{T}}, so when T>k\card{T} > k it may look as if a fraction has appeared. However, this is just a rewriting of Ker(ρT)=C/ρT(C)\card{\Ker(\rho_{T})}=\card{C}/\card{\rho_{T}(C)} using the size of an orthogonal complement, and in the end it is always an integer. Equivalently, in that case C(T)\card{C^{\perp}(T)} contains the missing power of qq.

Pless's Binomial Moment Identity

From the preparation in the previous section, we obtain a formula for binomial moments. This is the binomial-moment version of the Pless moment identity.

Theorem 5.1 (Pless's binomial moment identity).

Let CFqEC \leq \F_{q}^{E} be an [n,k][n, k] linear code. Then, for 0rn0 \leq r \leq n,

w=0nAw(C)(wr)=qkrj=0r(1)j(q1)rj(njrj)Aj(C)(5.1)\sum_{w=0}^{n} A_{w}(C)\binom{w}{r} = q^{k - r} \sum_{j = 0}^{r} (-1)^{j}(q - 1)^{r-j} \binom{n - j}{r - j} A_{j}(C^{\perp}) \tag{5.1}

holds.

Proof

Before entering the proof, let us organise the roles of the three sets. The set SS is the set of rr coordinates on which the codeword cc is required to be non-zero. The set TT is the set of coordinates which are specified to be zero in the inclusion–exclusion argument. The set UU is the support of a dual codeword uCu \in C^{\perp}. The condition UTSU \subseteq T \subseteq S means that a dual codeword with support UU is counted in C(T)C^{\perp}(T), and that this TT is used in the inclusion–exclusion argument.

Write the left-hand side as Mr(C)M_{r}(C). By (4.1) and (4.2),

Mr(C)=SES=rTS(1)TKer(ρT).\begin{aligned} M_{r}(C) &= \sum_{\substack{S \subseteq E\\\card{S} = r}} \sum_{T \subseteq S}(-1)^{\card{T}}\card{\Ker(\rho_{T})}. \end{aligned}

Substituting Lemma 4.2, we get

Mr(C)=SES=rTS(1)TqkTC(T).M_{r}(C) = \sum_{\substack{S \subseteq E\\\card{S} = r}} \sum_{T \subseteq S} (-1)^{\card{T}}q^{k-\card{T}}\card{C^{\perp}(T)}.

Now split the codewords of CC^{\perp} according to their supports. For UEU \subseteq E, set

AC(U){uC:supp(u)=U}.A_{C^{\perp}}(U) \coloneqq \card{\{ u \in C^{\perp}:\supp(u) = U \}}.

This is an auxiliary notation for the number of codewords with the support UU itself fixed, not the number Aj(C)A_j(C^{\perp}) with only the weight fixed. Then

C(T)=UTAC(U).\card{C^{\perp}(T)} = \sum_{U \subseteq T}A_{C^{\perp}}(U).

Therefore

Mr(C)=UEAC(U)SE, S=rT:UTS(1)TqkT\begin{aligned} M_{r}(C) &= \sum_{U \subseteq E}A_{C^{\perp}}(U) \sum_{\substack{S \subseteq E,\ \card{S} = r}} \sum_{\substack{T: U \subseteq T \subseteq S}} (-1)^{\card{T}}q^{k-\card{T}} \end{aligned}

follows.

Fix UU and put U=j\card{U} = j. From now on, count the contribution of all S,TS,T satisfying UTSU \subseteq T \subseteq S. If j>rj > r, then there is no SS with USU \subseteq S and S=r\card{S} = r, so the contribution is 00. Hence assume jrj \leq r. Once SS satisfies USU\subseteq S and S=r\card{S}=r, the set TT runs through all sets with UTSU \subseteq T \subseteq S. Writing T=ULT = U \cup L, where LSUL \subseteq S \setminus U, the inner sum is

LSU(1)j+LqkjL=(1)jqkjLSU(q1)L=(1)jqkj(11q)rj=(1)jqkr(q1)rj.\begin{aligned} \sum_{L \subseteq S \setminus U} (-1)^{j + \card{L}} q^{k - j - \card{L}} &= (-1)^{j} q^{k - j} \sum_{L \subseteq S \setminus U}(-q^{-1})^{\card{L}} \\ &= (-1)^{j} q^{k-j} \left( 1 - \frac{1}{q} \right)^{r-j} \\ &= (-1)^{j} q^{k - r}(q - 1)^{r - j}. \end{aligned}

The number of rr-element subsets SS containing UU is (njrj)\binom{n-j}{r-j}. Therefore the total contribution of dual codewords with support UU is

AC(U)(1)jqkr(q1)rj(njrj).A_{C^{\perp}}(U) (-1)^{j} q^{k-r}(q-1)^{r-j}\binom{n-j}{r-j}.

Finally, summing over all UU with U=j\card{U} = j, we have

UEU=jAC(U)=Aj(C).\sum_{\substack{U \subseteq E \\ \card{U} = j}}A_{C^{\perp}}(U) = A_{j}(C^{\perp}).

Hence

Mr(C)=qkrj=0r(1)j(q1)rj(njrj)Aj(C)M_{r}(C) = q^{k-r} \sum_{j = 0}^{r} (-1)^{j}(q - 1)^{r - j} \binom{n - j}{r - j}A_{j}(C^{\perp})

follows.

End of proof

This formula has quite a meaningful form. The left-hand side is the rr-th binomial moment of CC. The right-hand side involves only the numbers of codewords in CC^{\perp} of weights 0,1,,r0, 1, \dots, r. Thus the low moments of CC are controlled by the low-weight part of the dual code.

For example, when r=0r = 0, the formula is

w=0nAw(C)=qkA0(C)=qk.\sum_{w = 0}^{n} A_{w}(C) = q^{k} A_{0}(C^{\perp}) = q^{k}.

This is simply C=qk\card{C} = q^{k}. When r=1r = 1, we get

w=0nwAw(C)=qk1((q1)nA1(C)).\sum_{w = 0}^{n} w A_{w}(C) = q^{k - 1}\bigl( (q - 1)n - A_{1}(C^{\perp}) \bigr).

If CC^{\perp} has no codeword of weight 11, then

w=0nwAw(C)=qk1(q1)n.\sum_{w = 0}^{n} wA_{w}(C) = q^{k - 1}(q - 1)n.

The absence of a dual codeword of weight 11 means that the map ccec \mapsto c_{e} to each coordinate is not the zero map. A non-zero linear map CFqC \to \F_{q} is surjective, so at each coordinate 00 appears qk1q^{k - 1} times, and non-zero values appear altogether (q1)qk1(q - 1)q^{k - 1} times. Summing this over all coordinates gives the expression qk1(q1)nq^{k - 1}(q - 1)n above. This agrees with the intuition that, on average, each coordinate is non-zero in the ratio q1q - 1 to 11.

When r=2r = 2, the formula is

w=0nAw(C)(w2)=qk2((q1)2(n2)(q1)(n1)A1(C)+A2(C)).\begin{aligned} \sum_{w = 0}^{n} A_{w}(C)\binom{w}{2} &= q^{k-2}\Bigl( (q-1)^2\binom{n}{2}\\ &\qquad - (q - 1)(n - 1)A_{1}(C^{\perp}) + A_{2}(C^{\perp}) \Bigr). \end{aligned}

Here the codewords of weights 11 and 22 in the dual code appear as correction terms for the second moment.

Pless Identities as Power Moment Identities

Pless identities are often written not in terms of binomial moments, but in the form of power moments w=0nAw(C)wh\sum_{w = 0}^{n} A_{w}(C) w^{h}. To pass from binomial moments to power moments, we use Stirling numbers.

Definition 6.1.

For non-negative integers hh and rr, define the Stirling number of the second kind {hr}\Stirling{h}{r} by

xh=s=0h{hs}x(x1)(xs+1).x^{h} = \sum_{s=0}^{h}\Stirling{h}{s} x(x - 1) \dotsm (x - s + 1).

The term with s=0s = 0 is read as 11 when h=0h = 0, and as 00 when h>0h > 0.

Since

x(x1)(xr+1)=r!(xr),x(x - 1)\dotsm(x - r + 1) = r! \binom{x}{r},

we have

xh=r=0hr!{hr}(xr).(6.1)x^{h} = \sum_{r=0}^{h} r! \Stirling{h}{r} \binom{x}{r}. \tag{6.1}

Theorem 6.2 (Pless power moment identities).

Let CFqEC \leq \F_{q}^{E} be an [n,k][n,k] linear code. Then, for any non-negative integer hh,

w=0nAw(C)wh=r=0min(h,n)r!{hr}qkrj=0r(1)j(q1)rj(njrj)Aj(C)(6.2)\begin{aligned} \sum_{w = 0}^{n} A_{w}(C) w^{h} = \sum_{r=0}^{\min(h,n)} r!\Stirling{h}{r} q^{k-r} \sum_{j=0}^{r} (-1)^{j}(q - 1)^{r - j} \binom{n - j}{r - j} A_{j}(C^{\perp}) \tag{6.2} \end{aligned}

holds.

Proof

Substitute x=wx = w into (6.1) and take the weighted sum with respect to the weight distribution. This gives

w=0nAw(C)wh=w=0nAw(C)r=0hr!{hr}(wr)=r=0min(h,n)r!{hr}w=0nAw(C)(wr).\begin{aligned} \sum_{w = 0}^{n} A_{w}(C) w^{h} &= \sum_{w=0}^{n} A_{w}(C) \sum_{r=0}^{h} r!\Stirling{h}{r}\binom{w}{r} \\ &= \sum_{r=0}^{\min(h,n)} r! \Stirling{h}{r} \sum_{w=0}^{n} A_{w}(C)\binom{w}{r}. \end{aligned}

Now substitute Theorem 5.1.

End of proof

This is the classical power moment identity originating in Pless [Ple63]. Its appearance is a little complicated, but its structure is simple. First, expand the power whw^{h} as a linear combination of binomial coefficients (wr)\binom{w}{r}. Then compute the binomial moments by double counting.

What is especially important is that only the low-weight distribution of the dual code appears on the right-hand side. When hnh \leq n, it is enough to know the numbers of codewords in CC^{\perp} of weights 0,1,,h0, 1, \dots, h. In general, the required weights are 0,1,,min(h,n)0, 1, \dots, \min(h,n). This property is very useful when determining the weight distribution of concrete codes.

Recovering the MacWilliams Identity from Moments

So far, we have proved Pless's binomial moment identity. Next, we recover the MacWilliams identity from this identity. The key point is to collect the binomial moments into a generating function.

If CC is an [n,k][n,k] code, then CC^{\perp} is an [n,nk][n,n-k] code. Apply Theorem 5.1 to CC^{\perp}. Since (C)=C(C^{\perp})^{\perp} = C, if we write Aw=Aw(C)A_{w} = A_{w}(C), then the binomial moments of CC^{\perp} are

Mr(C)=qnkrw=0r(1)w(q1)rw(nwrw)Aw.(7.1)M_{r}(C^{\perp}) = q^{n - k - r} \sum_{w = 0}^{r} (-1)^{w}(q - 1)^{r - w} \binom{n - w}{r - w} A_{w}. \tag{7.1}

On the other hand, by Theorem 3.1,

PC(1+z)=r=0nMr(C)zr.P_{C^{\perp}}(1 + z) = \sum_{r=0}^{n} M_{r}(C^{\perp})z^{r}.

Substituting (7.1), we obtain

PC(1+z)=r=0nqnkrw=0r(1)w(q1)rw(nwrw)Awzr=w=0nAw(1)wr=wnqnkr(q1)rw(nwrw)zr.\begin{aligned} P_{C^{\perp}}(1 + z) &= \sum_{r = 0}^{n} q^{n - k - r} \sum_{w = 0}^{r} (-1)^{w} (q - 1)^{r - w} \binom{n - w}{r - w} A_{w} z^{r} \\ &= \sum_{w = 0}^{n} A_{w}(-1)^{w} \sum_{r = w}^{n} q^{n - k - r}(q - 1)^{r - w} \binom{n - w}{r - w} z^{r}. \end{aligned}

Putting r=w+sr = w + s, the inner sum becomes

s=0nwqnkws(q1)s(nws)zw+s=qkzws=0nw(nws)qnws(q1)szs=qkzw(q+(q1)z)nw.\begin{aligned} &\sum_{s = 0}^{n - w} q^{n - k - w - s}(q - 1)^{s} \binom{n-w}{s} z^{w + s} \\ ={}& q^{-k} z^{w} \sum_{s = 0}^{n - w} \binom{n - w}{s} q^{n - w - s}(q - 1)^{s} z^{s} \\ ={}& q^{-k} z^{w} \bigl( q + (q - 1)z \bigr)^{n - w}. \end{aligned}

Therefore

PC(1+z)=1Cw=0nAw(z)w(q+(q1)z)nw.(7.2)P_{C^{\perp}}(1 + z) = \frac{1}{\card{C}} \sum_{w = 0}^{n} A_{w}(-z)^{w} \bigl( q + (q - 1)z \bigr)^{n - w}. \tag{7.2}

Now set t1+zt \coloneqq 1 + z. Then

z=1t,q+(q1)z=1+(q1)t,-z = 1 - t, \qquad q + (q - 1)z = 1 + (q - 1)t,

so (7.2) becomes

PC(t)=1Cw=0nAw(C)(1+(q1)t)nw(1t)w.(7.3)P_{C^{\perp}}(t) = \frac{1}{\card{C}} \sum_{w=0}^{n} A_{w}(C) \bigl( 1 + (q - 1)t \bigr)^{n-w}(1 - t)^{w}. \tag{7.3}

Finally, we homogenise this one-variable identity. Since PC(t)=WC(1,t)P_{C^{\perp}}(t) = W_{C^{\perp}}(1, t), formally putting t=Y/Xt = Y/X and multiplying both sides by XnX^{n} gives

WC(X,Y)=1Cw=0nAw(C)(X+(q1)Y)nw(XY)w=1CWC(X+(q1)Y,XY).\begin{aligned} W_{C^{\perp}}(X, Y) &= \frac{1}{\card{C}} \sum_{w = 0}^{n} A_{w}(C) \bigl( X + (q - 1)Y \bigr)^{n - w}(X - Y)^{w} \\ &= \frac{1}{\card{C}} W_{C}\bigl( X + (q - 1)Y, X - Y \bigr). \end{aligned}

This is a calculation as a polynomial identity. Thus the MacWilliams identity has been obtained.

Theorem 7.1 (MacWilliams identity).

Let CFqEC \leq \F_{q}^{E} be a linear code. Then

WC(X,Y)=1CWC(X+(q1)Y,XY)W_{C^{\perp}}(X, Y) = \frac{1}{\card{C}} W_{C}\bigl( X + (q - 1)Y, X - Y \bigr)

holds.

In this proof, we did not use Krawtchouk polynomials by name. However, in the process of collecting binomial moments into a generating function, essentially the same transform coefficients appear in a different guise. The difference is that, in the present viewpoint, we do not transform the weight distribution all at once. Instead, we first compute all moments and then recover the distribution from them.

A Small Example: The Binary Repetition Code of Length 33

Let us recover the weight distribution of a dual code from moments in a small example. Consider the repetition code over F23\F_{2}^{3}

C={000,111}.C = \{ 000, 111 \}.

This is a [3,1][3,1] code, and its weight distribution is

(A0,A1,A2,A3)=(1,0,0,1).(A_{0}, A_{1}, A_{2}, A_{3}) = (1, 0, 0, 1).

The dual code CC^{\perp} is the set of all words of even weight,

C={000,011,101,110},C^{\perp} = \{ 000, 011, 101, 110 \},

so the answer should be

(1,0,3,0).(1, 0, 3, 0).

Here we recover this from Pless moments.

The code CC^{\perp} is a [3,2][3,2] code. Applying Pless's binomial moment identity to CC^{\perp} and using (C)=C(C^{\perp})^{\perp} = C, we get

Mr(C)=22rw=0r(1)w(3wrw)Aw(C).M_{r}(C^{\perp}) = 2^{2-r} \sum_{w=0}^{r}(-1)^{w} \binom{3-w}{r-w}A_{w}(C).

Here q=2q = 2, so (q1)rw=1(q - 1)^{r - w} = 1.

We compute these in order. For r=0r = 0,

M0(C)=22A0(C)=4.M_{0}(C^{\perp}) = 2^{2} A_{0}(C) = 4.

For r=1r = 1,

M1(C)=2((31)A0(C)A1(C))=23=6.M_{1}(C^{\perp}) = 2\left(\binom{3}{1}A_{0}(C) - A_{1}(C)\right) = 2 \cdot 3 = 6.

For r=2r = 2,

M2(C)=(32)A0(C)(21)A1(C)+A2(C)=3.M_{2}(C^{\perp}) = \binom{3}{2} A_{0}(C) - \binom{2}{1} A_{1}(C) + A_{2}(C) =3.

For r=3r = 3,

M3(C)=21(A0(C)A1(C)+A2(C)A3(C))=0.M_{3}(C^{\perp}) = 2^{-1}\left(A_{0}(C) - A_{1}(C) + A_{2}(C) - A_{3}(C) \right) = 0.

Therefore

PC(1+z)=4+6z+3z2.P_{C^{\perp}}(1 + z) = 4 + 6z + 3z^{2}.

Putting z=t1z = t - 1, we get

PC(t)=4+6(t1)+3(t1)2=1+3t2.P_{C^{\perp}}(t) = 4 + 6(t - 1) + 3(t - 1)^{2} = 1 + 3t^{2}.

Thus

PC(t)=1+3t2,P_{C^{\perp}}(t) = 1 + 3t^{2},

and the weight distribution is recovered as

(A0(C),A1(C),A2(C),A3(C))=(1,0,3,0).(A_{0}(C^{\perp}), A_{1}(C^{\perp}), A_{2}(C^{\perp}), A_{3}(C^{\perp})) = (1, 0, 3, 0).

In this example, we confirmed the answer by listing the elements of the dual code directly. From the viewpoint of Pless moments, however, we first computed M0(C)M_{0}(C^{\perp}), M1(C)M_{1}(C^{\perp}), M2(C)M_{2}(C^{\perp}), M3(C)M_{3}(C^{\perp}), then recovered PC(t)P_{C^{\perp}}(t), and finally read off the weight distribution. The flow is not to guess the distribution directly, but to determine it through its moments.

What Were Pless Moments Doing in This Proof?

Let us organise the role played by Pless moments in the proof.

First, we introduced the viewpoint of studying the weight distribution through moments. Instead of handling the weight distribution (A0,A1,,An)(A_{0}, A_{1}, \dots, A_{n}) directly, we looked at

w=0nAwwhandw=0nAw(wr).\sum_{w=0}^{n} A_{w} w^{h} \quad\text{and}\quad \sum_{w=0}^{n} A_{w} \binom{w}{r}.

This is the idea of studying a distribution through sum-type quantities which, after normalisation, correspond to means and higher means, and through binomial moments.

Second, binomial moments naturally became counting problems. The quantity w=0nAw(C)(wr)\displaystyle \sum_{w=0}^{n} A_{w}(C) \binom{w}{r} counts pairs consisting of a codeword cCc \in C and an rr-element subset SS contained in its non-zero coordinates. For this reason, binomial moments are well suited to double counting.

Third, during the double counting, the low-weight distribution of the dual code appeared. To count codewords whose coordinates in SS are all non-zero, we used inclusion–exclusion, and expressed the kernel of a coordinate restriction map using the part of the dual code with small support. As a result, the rr-th binomial moment involved only the numbers of codewords in CC^{\perp} of weights 0,1,,r0, 1, \dots, r.

Fourth, collecting all binomial moments allowed us to recover the whole weight distribution. Using the generating function

PC(1+z)=r=0nMr(C)zr,P_{C}(1 + z) = \sum_{r = 0}^{n} M_{r}(C) z^{r},

the moment sequence is precisely the sequence of coefficients in the expansion of the weight distribution polynomial around t=1t = 1. Thus sufficiently many moments determine the distribution itself.

The point of the proof in this note can be summarised in the following sentence.

The MacWilliams identity is not only a formula which directly transforms the weight distribution; it is also the generating-function version of the Pless moment identity saying that the low-weight distribution of the dual code controls the moments of the original code.

Concepts Seen in This Part

In this part, while aiming at a proof of the MacWilliams identity, we introduced the basic tools of Pless moments. They may be organised as follows.

Weight distribution

For a code CC, this is the sequence defined by

Aw(C)={cC:wt(c)=w}.A_{w}(C) = \card{\{ c \in C : \wt(c) = w \}}.

The weight enumerator collects this sequence into a two-variable polynomial.

Power moment

This is a quantity of the form

w=0nAw(C)wh.\sum_{w = 0}^{n} A_{w}(C) w^{h}.

It measures the weight distribution using the hh-th powers of the weights.

Binomial moment

This is the quantity defined by

Mr(C)=w=0nAw(C)(wr).M_{r}(C) = \sum_{w = 0}^{n} A_{w}(C) \binom{w}{r}.

It counts pairs consisting of a codeword and an rr-element subset of its non-zero coordinates.

Moment generating function

For the dehomogenised weight enumerator PC(t)=WC(1,t)P_{C}(t) = W_{C}(1, t), we have

PC(1+z)=r=0nMr(C)zr.P_{C}(1 + z) = \sum_{r = 0}^{n} M_{r}(C) z^{r}.

Binomial moments are the coefficients in the expansion of PC(t)P_{C}(t) around t=1t = 1.

Double counting

We viewed Mr(C)M_{r}(C) in two ways: by counting from codewords, and by first fixing a coordinate set. In the latter method, inclusion–exclusion and coordinate restriction maps appear.

Pless's binomial moment identity

If CC is an [n,k][n,k] code, then

w=0nAw(C)(wr)=qkrj=0r(1)j(q1)rj(njrj)Aj(C)\sum_{w=0}^{n} A_{w}(C)\binom{w}{r} = q^{k-r} \sum_{j=0}^{r} (-1)^{j} (q - 1)^{r - j} \binom{n - j}{r - j} A_{j}(C^{\perp})

holds. The rr-th binomial moment is determined only by the distribution of the dual code from weight 00 through weight rr.

Pless power moment identities

By expanding the power whw^{h} as a linear combination of binomial coefficients (wr)\binom{w}{r}, one obtains a formula for power moments from the binomial moment identity. The Stirling numbers of the second kind appear as the conversion coefficients.

From the viewpoint of Pless moments, the MacWilliams identity is not merely a formula which changes the variables of the weight enumerator. It also summarises the counting structure by which each moment of the weight distribution of a code is controlled by low-weight codewords in the dual code.

Review of This Proof Family

As mentioned at the beginning, the proof in this note belongs to the

moment and double-counting approach

family. On the surface, it is a proof which computes moments of the weight distribution. At a deeper level, however, it does not transform the distribution itself directly. Instead, it counts the quantities defined by that distribution in two ways, and then recovers the distribution from sufficiently many moments.

The point of this proof is the following sentence.

Reinterpret the weight distribution as a moment sequence, and connect those moments to the low-weight distribution of the dual code by double counting.

In the Fourier and character approach, the dual code appears from the orthogonality relations of characters. In a proof using the language of association schemes, one treats the relations classified by Hamming distance as matrices and reads off the transform of the weight distribution from their simultaneous eigenspace decomposition. This note did not use that matrix algebra; instead, it extracted the same transform from counting moments. In the present moment approach, the dual code appears in the process of counting kernels of coordinate restriction maps. Even for the same MacWilliams identity, the form looks quite different because the quantities being observed are different.

Next Time

Next time, we shall look at the MacWilliams identity from the side of matroids and the Tutte polynomial.

In the proof in this note, we studied moments of the weight distribution by double counting. Next time, we shall consider the combinatorial structure determined by the columns of a generator matrix of a linear code, namely a matroid. The weight enumerator of the code is expressed as a specialisation of the Tutte polynomial of the corresponding matroid. The dual code corresponds to the dual matroid, and the MacWilliams identity emerges from the duality of the Tutte polynomial.

Thus the protagonist next time will be

generator matrix \to vector matroid \to Tutte polynomial \to dual matroid \to MacWilliams identity

The same MacWilliams identity will appear, this time as the duality of a matroid invariant.

References

  1. [Ple63] Vera Pless. Power moment identities on weight distributions in error correcting codes. Information and Control, vol. 6, no. 2, pp. 147–152, 1963. doi:10.1016/S0019-9958(63)90189-X ↩1 ↩2
  2. [MS77] F. J. MacWilliams and N. J. A. Sloane. The theory of error-correcting codes. I. North-Holland Publishing Co., Amsterdam-New York-Oxford, vol. Vol. 16, pp. i–xv and 1–369, 1977
  3. [HP03] W. Cary Huffman and Vera Pless. Fundamentals of Error-Correcting Codes. Cambridge University Press, 2003. doi:10.1017/CBO9780511807077
  4. [Ple98] Vera Pless. Introduction to the theory of error-correcting codes. John Wiley & Sons, Inc., New York, pp. xiv+207, 1998. doi:10.1002/9781118032749

This series

A Series Learning through the MacWilliams Identity · Part 6 of 12

Back to series list

Disclaimer

Articles on this site are based on the operator's personal understanding, investigation, and research notes. I try to keep the content accurate, but it may contain errors or incomplete explanations. I do not guarantee its accuracy, completeness, usefulness, or currentness.

Please use the information on this site at your own judgment and responsibility. To the extent permitted by law, the operator is not liable for damages, losses, or disadvantages arising from using, or being unable to use, information on this site.

If you notice an error, unclear explanation, broken link, or insufficient citation, please contact the operator. I will review the content and, when appropriate, correct, update, or remove it.