Article and note
A Series Learning through the MacWilliams IdentityPart 6 of 12
An Introduction to Pless Moments through the MacWilliams Identity
- Published:
- Updated:
- Reading time:
- 20 min (about 4,251 words)
Introduction
One of the fundamental theorems in coding theory is the MacWilliams identity. Let be the coordinate set, let , and let be a linear code over the finite field . For , consider its dual code
where
is the standard inner product. In this note, for a word , write
Define the weight enumerator of the linear code by
The MacWilliams identity is the formula saying that the weight enumerator of the dual code can be computed from the weight enumerator of as follows:
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.
Fourier, character, and Poisson methods.
Möbius inversion, lattice-theoretic, and shortening/puncturing methods.
Orthogonal-polynomial and association-scheme methods.
Matroid and Tutte-polynomial methods.
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
Then the weight enumerator is
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
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 . That said, in coding theory, moments involving binomial coefficients are more natural than moments involving ordinary powers . The reason is that is the number of ways to choose coordinates from the non-zero coordinates of the codeword . Therefore
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 binomial moments moment generating function double counting Pless moment identities 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 be a linear code, and write
This sequence is the weight distribution of .
In order to collect the weight distribution into a one-variable polynomial, set
This is the dehomogenisation of the weight enumerator . Indeed, we may read
Here is a formal substitution, and in the end both sides are compared as polynomials.
Definition 2.1.
For a non-negative integer , define the -th power moment of by
When , we use the convention , and hence
When , this is the total weight of all codewords,
When , 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 , define the -th binomial moment of by
Here we use the convention for . The meaning of a binomial moment is very concrete. If we fix a codeword , then is the number of ways to choose coordinates from . Thus the -th binomial moment counts pairs of the following form:
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 is expanded around .
Theorem 3.1.
Let . Then
holds.
Proof
By the binomial theorem,
Therefore
This theorem shows that the binomial moments determine the distribution completely.
Theorem 3.2.
For a sequence , set
Then can be recovered uniquely from . Explicitly,
Proof
Put . The assumption is precisely that
holds. Substituting , we get
Taking the coefficient of on the right-hand side gives
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 be an linear code over , that is, let . Thus . We write the number of dual codewords of weight simply as .
The binomial moment counts pairs
We first count these pairs with fixed.
Definition 4.1.
For , define
With this notation,
For fixed , the number is the number of codewords for which all coordinates in are non-zero. Notice that no condition is imposed on the coordinates outside . Thus is not the number of codewords whose support is exactly ; it is the number of codewords which are non-zero at least on . 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 , consider all codewords whose coordinates in are all zero. This is a linear subspace. Consider the restriction map to the coordinates in ,
Its kernel is
If , then is the number of codewords which do not belong to any of the with . Therefore, by inclusion–exclusion,
Next, we write using information from the dual code. Let
denote the dual codewords whose support is contained in . This is not the shortened code of on itself. It is the subspace consisting of those codewords on whose support is contained in .
Lemma 4.2.
For any ,
holds.
Proof
Write for the image of the restriction map . By the first isomorphism theorem,
On the other hand, with respect to the standard inner product on , the space can be identified with the orthogonal complement of . Indeed, if is extended by zero to , and this extension is denoted by , then
Since is zero outside , this is equivalent to . In general, for a subspace of the finite-dimensional space , we have . Hence . Applying this to gives
Substituting this into the equation above, we obtain
This lemma is the linear-algebraic core of the double counting. The size of the kernel of the coordinate restriction map of is expressed by the number of codewords in whose support is contained in . The right-hand side contains , so when it may look as if a fraction has appeared. However, this is just a rewriting of using the size of an orthogonal complement, and in the end it is always an integer. Equivalently, in that case contains the missing power of .
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 be an linear code. Then, for ,
holds.
Proof
Before entering the proof, let us organise the roles of the three sets. The set is the set of coordinates on which the codeword is required to be non-zero. The set is the set of coordinates which are specified to be zero in the inclusion–exclusion argument. The set is the support of a dual codeword . The condition means that a dual codeword with support is counted in , and that this is used in the inclusion–exclusion argument.
Write the left-hand side as . By (4.1) and (4.2),
Substituting Lemma 4.2, we get
Now split the codewords of according to their supports. For , set
This is an auxiliary notation for the number of codewords with the support itself fixed, not the number with only the weight fixed. Then
Therefore
follows.
Fix and put . From now on, count the contribution of all satisfying . If , then there is no with and , so the contribution is . Hence assume . Once satisfies and , the set runs through all sets with . Writing , where , the inner sum is
The number of -element subsets containing is . Therefore the total contribution of dual codewords with support is
Finally, summing over all with , we have
Hence
follows.
This formula has quite a meaningful form. The left-hand side is the -th binomial moment of . The right-hand side involves only the numbers of codewords in of weights . Thus the low moments of are controlled by the low-weight part of the dual code.
For example, when , the formula is
This is simply . When , we get
If has no codeword of weight , then
The absence of a dual codeword of weight means that the map to each coordinate is not the zero map. A non-zero linear map is surjective, so at each coordinate appears times, and non-zero values appear altogether times. Summing this over all coordinates gives the expression above. This agrees with the intuition that, on average, each coordinate is non-zero in the ratio to .
When , the formula is
Here the codewords of weights and 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 . To pass from binomial moments to power moments, we use Stirling numbers.
Definition 6.1.
For non-negative integers and , define the Stirling number of the second kind by
The term with is read as when , and as when .
Since
we have
Theorem 6.2 (Pless power moment identities).
Let be an linear code. Then, for any non-negative integer ,
holds.
Proof
Substitute into (6.1) and take the weighted sum with respect to the weight distribution. This gives
Now substitute Theorem 5.1.
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 as a linear combination of binomial coefficients . 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 , it is enough to know the numbers of codewords in of weights . In general, the required weights are . 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 is an code, then is an code. Apply Theorem 5.1 to . Since , if we write , then the binomial moments of are
On the other hand, by Theorem 3.1,
Substituting (7.1), we obtain
Putting , the inner sum becomes
Therefore
Now set . Then
so (7.2) becomes
Finally, we homogenise this one-variable identity. Since , formally putting and multiplying both sides by gives
This is a calculation as a polynomial identity. Thus the MacWilliams identity has been obtained.
Theorem 7.1 (MacWilliams identity).
Let be a linear code. Then
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
Let us recover the weight distribution of a dual code from moments in a small example. Consider the repetition code over
This is a code, and its weight distribution is
The dual code is the set of all words of even weight,
so the answer should be
Here we recover this from Pless moments.
The code is a code. Applying Pless's binomial moment identity to and using , we get
Here , so .
We compute these in order. For ,
For ,
For ,
For ,
Therefore
Putting , we get
Thus
and the weight distribution is recovered as
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 , , , , then recovered , 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 directly, we looked at
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 counts pairs consisting of a codeword and an -element subset 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 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 -th binomial moment involved only the numbers of codewords in of weights .
Fourth, collecting all binomial moments allowed us to recover the whole weight distribution. Using the generating function
the moment sequence is precisely the sequence of coefficients in the expansion of the weight distribution polynomial around . 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 , this is the sequence defined by
The weight enumerator collects this sequence into a two-variable polynomial.
- Power moment
This is a quantity of the form
It measures the weight distribution using the -th powers of the weights.
- Binomial moment
This is the quantity defined by
It counts pairs consisting of a codeword and an -element subset of its non-zero coordinates.
- Moment generating function
For the dehomogenised weight enumerator , we have
Binomial moments are the coefficients in the expansion of around .
- Double counting
We viewed 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 is an code, then
holds. The -th binomial moment is determined only by the distribution of the dual code from weight through weight .
- Pless power moment identities
By expanding the power as a linear combination of binomial coefficients , 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 vector matroid Tutte polynomial dual matroid MacWilliams identity
The same MacWilliams identity will appear, this time as the duality of a matroid invariant.
References
- [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
- [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 ↩
- [HP03] W. Cary Huffman and Vera Pless. Fundamentals of Error-Correcting Codes. Cambridge University Press, 2003. doi:10.1017/CBO9780511807077 ↩
- [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
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.