MacWilliams Identity in Coding Theory
- MacWilliams Identity is a duality relation that transforms a code's weight enumerator into that of its dual using a fixed substitution.
- It underlies analytical techniques in coding theory, including linear-programming bounds and spectral transforms based on Krawtchouk polynomials.
- Generalizations extend its scope to rank metrics, convolutional and quantum codes, highlighting its broad impact on modern coding research.
The MacWilliams identity is a duality relation that transforms the weight enumerator of a code into the weight enumerator of its dual. In its classical form, for a -ary linear code with Hamming weight enumerator
the identity states
This relation is one of the central structural results of coding theory: it links primal and dual spectra, underlies linear-programming bounds, and extends far beyond the Hamming metric to association schemes, convolutional codes, rank metrics, ring-linear codes, and several quantum settings (Wood, 5 Jan 2026).
1. Classical statement and algebraic meaning
The classical setting is a linear code with dual
where . Over finite fields,
The Hamming weight is , and the two-variable enumerator is
The MacWilliams identity gives the dual enumerator by the fixed substitution
0
or, equivalently, recovers 1 from 2 by the same transform with 3 in place of 4 (Wood, 5 Jan 2026).
At coefficient level, the identity is expressed through the 5-ary Krawtchouk polynomials
6
so that
7
where 8 and 9 are the weight distributions of 0 and 1, respectively (Bao, 2013). This formulation makes clear that the identity is a linear spectral transform rather than a purely combinatorial coincidence.
A basic consequence is that the Hamming weight enumerator respects duality: if two linear codes have the same Hamming weight enumerator, then their duals also have the same Hamming weight enumerator. Later work emphasizes that this feature is special rather than generic; many other weights do not enjoy it (Wood, 5 Jan 2026).
2. Fourier, association-scheme, and graph-theoretic formulations
A standard proof uses the Fourier transform over the finite abelian group 2 with a generating additive character. Orthogonality relations convert sums over 3 into sums over 4, and the Hamming kernel transforms by
5
The same mechanism yields MacWilliams identities for complete and symmetrized enumerators, where one works with finer partitions and character tables rather than only the zero/nonzero partition (Wood, 5 Jan 2026).
Delsarte’s association-scheme framework recasts the identity as a transform between the inner distributions of dual objects. For an 6-class association scheme with eigenmatrices 7 and 8, the general transform is
9
In the Hamming scheme 0, the eigenmatrix is built from Krawtchouk polynomials, and the general transform specializes to the classical MacWilliams identity (Friedlander, 2024). This scheme-theoretic viewpoint is the basis for later generalizations to rank metric, skew rank metric, Hermitian schemes, and other formally self-dual metric translation schemes.
A complementary formulation uses normal factor graphs. There the partition functions of dual normal factor graphs are Fourier transform pairs, and MacWilliams identities arise locally for exact, complete, and Hamming weight generating functions of codes realized on arbitrary graphs. For a local exact weight adjacency matrix 1, the dual transform is expressed by finite Fourier matrices on state and symbol spaces; for Hamming specializations, this yields the MacWilliams identity for convolutional-code weight adjacency matrices (0911.5508). In this sense, the identity is not limited to block codes: it is a local Fourier duality principle that survives in trellis and graph-based realizations.
Derivative-based reformulations also exist. Four equivalent forms of the classical identity can be obtained by evaluating suitable partial derivatives of 2 and the MacWilliams-transformed polynomial at 3, 4, and related points, producing binomial-moment identities and mixed factorial-moment relations equivalent to the original statement (Bao, 2013). This suggests that the MacWilliams identity can be read either as a polynomial substitution or as a complete family of moment constraints.
3. Generalizations over rings, tuples, and refined partitions
The classical identity extends to complete weight enumerators over Galois rings. If 5 is a Galois ring with additive character 6, and 7 denotes the complete weight enumerator, then
8
Kaplan’s 9-tuple theory further generalizes the classical transform to exact, complete, support, and Hamming enumerators of tuples of codewords, including the case of distinct component codes over possibly different Galois rings (Kaplan, 2012). In the 0-tuple Hamming case, the transform becomes
1
which reduces to the classical identity when 2 (Kaplan, 2012).
For finite commutative Frobenius rings, the symmetrized weight enumerator admits a combinatorial MacWilliams identity built from the principal-ideal poset. If 3 is the adjacency matrix of principal ideals, 4 the diagonal matrix of ideal sizes, and 5 the annihilator-containment matrix, then
6
For finite fields, this reduces to the 7 transform
8
hence to the classical Hamming MacWilliams identity (Tang, 25 Sep 2025). The same multiset framework yields refined support and tuple identities, with 9 as the transform for 0-tuple symmetrized enumerators (Tang, 25 Sep 2025).
A different strand concerns metrics for which the coarse weight partition is not Fourier-compatible. For Lee, homogeneous, and subfield metrics, the classical identities fail apart from special cases. A recent resolution is to replace the usual weight partition by finer decompositions: Lee decomposition by pairs 1, a homogeneous weight–unit decomposition distinguishing zero, units, socle, and the remainder, and a subfield-orbit decomposition under multiplication by 2. These refined partitions recover MacWilliams-type identities and associated linear-programming bounds, even though the ordinary Lee, homogeneous, and subfield weight enumerators do not determine the dual enumerator (Bariffi et al., 2024).
The same phenomenon appears in a different form for general weights on finite fields. Under broad conditions—nondegeneracy, 3, 4, a unique minimum orbit, and a nontrivial correlation condition on 5 and 6—there exist linear codes 7 with
8
Thus, outside the reflexive-partition setting, equality of primal enumerators need not determine equality of dual enumerators (Wood, 5 Jan 2026).
4. Rank metric, skew rank metric, and Krawtchouk-scheme extensions
For rank-metric codes over 9, Gadouleau and Yan established a functional MacWilliams identity using a 0-product and a 1-transform. If
2
then
3
where the bar denotes the 4-transform induced by the 5-product formalism (0706.1751). At coefficient level,
6
with 7 the generalized rank-metric Krawtchouk kernel (0706.1751). This parallels the Hamming case but with Gaussian coefficients and 8-analog combinatorics replacing binomial coefficients.
Generalized rank weights admit a further MacWilliams-type identity. If 9 counts 0-dimensional subcodes of 1 with rank weight 2, then for 3 and 4,
5
This extends rank-metric MacWilliams theory from 6 to the full hierarchy of generalized rank weights (Molina, 11 Feb 2026).
The same general pattern appears in skew rank metric. For a linear code 7 of skew-symmetric matrices, with 8 and 9, the skew-rank enumerator satisfies
0
where the overline is now the skew-1 transform defined through a skew-2 algebra (Friedlander et al., 2022). The corresponding coefficients are transformed by generalized Krawtchouk polynomials associated with the alternating-bilinear-forms scheme (Friedlander et al., 2022).
These cases are part of a broader unification by Krawtchouk association schemes. In formally self-dual metric translation schemes governed by parameters 3 and 4, the unified transform reads
5
with specializations covering Hamming, rank metric, skew rank metric, and Hermitian schemes (Friedlander, 2024). This framework makes explicit that MacWilliams identities are spectral transforms tied to generalized Krawtchouk families.
5. Convolutional and graph-based code identities
For convolutional codes, there is no MacWilliams identity for the free distance spectrum in general. Shearer and McEliece showed that two binary rate-6 convolutional codes can have identical free distance spectra while their orthogonal codes have different free distance spectra (Jr, 2010). This negative result does not contradict MacWilliams theory; it indicates that the free distance spectrum is not the correct invariant for duality.
The appropriate object is the weight adjacency matrix (WAM). In a minimal state-space realization with state space 7, the WAM 8 records the Hamming weight generating functions of one-step transitions. Gluesing-Luerssen and Schneider proved that if 9 and 0 are the WAMs of a convolutional code and its dual, then there exists 1 such that
2
where 3 is the normalized character table of 4 and 5 is the classical block-code MacWilliams transform on the polynomial entries (0805.3484). Thus duality survives at the adjacency-matrix level, not at the free-distance-spectrum level.
Forney’s normal-factor-graph approach gives a concise proof and a more general statement: the partition functions of dual normal factor graphs are Fourier transform pairs, and MacWilliams identities follow for local and global exact, complete, and Hamming weight generating functions of arbitrary group or linear codes on graphs (0911.5508). In particular, for terminated convolutional codes, tail-biting termination is especially natural because
6
and 7 and 8 are dual block codes, so the standard block-code MacWilliams identity applies directly (Jr, 2010).
This yields a MacWilliams identity for the generating functions of the weight distributions per unit time of a convolutional code and its orthogonal code. The normalized traces 9 converge to a per-unit-time distribution that is as useful as the free distance spectrum for estimating performance, while still obeying a duality transform (Jr, 2010). A related bra–ket formalism derives MacWilliams identities for exact, split, input-parity, and input-output weight generating functions of classical and quantum convolutional codes from Fourier transforms on symbol and state spaces (Lai et al., 2014).
6. Quantum and intrinsic quantum MacWilliams identities
Quantum coding theory has its own MacWilliams identities. For Hermitian operators 00 on 01, the Shor–Laflamme enumerators are
02
with
03
In the homogeneous 04-level setting, the quantum MacWilliams identity is
05
It is derived in the Bloch representation from the relation between Shor–Laflamme and unitary enumerators and from the symmetry of averaged partial traces (Huber et al., 2017). This identity underlies shadow inequalities and linear-programming bounds for quantum error-correcting codes and absolutely maximally entangled states (Huber et al., 2017).
A mixed-dimensional extension replaces scalar weights by dimension multisets. For a heterogeneous Hilbert space
06
the mixed-dimensional Shor–Laflamme enumerators are multivariate in pairs of variables 07 indexed by distinct local dimensions 08. The central identity becomes
09
with the homogeneous quantum identity recovered when all 10 are equal (González-Lociga et al., 28 Apr 2026). This supports mixed-dimensional quantum Hamming, Singleton, and Scott bounds and a linear program for code viability in heterogeneous systems (González-Lociga et al., 28 Apr 2026).
A distinct recent development is the intrinsic quantum MacWilliams identity. An intrinsic quantum code is a subspace 11, where 12 carries a unitary representation of a group 13, and errors are organized by the decomposition of 14 into 15-isotypic sectors under conjugation. For any orthogonal decomposition
16
one defines projector and twirl enumerators
17
with normalization
18
and a Knill–Laflamme-type inequality
19
When the conjugation representation on 20 is multiplicity-free, the normalized enumerators are related by a unique unitary transform 21,
22
which is interpreted as an intrinsic MacWilliams identity (Kubischta et al., 17 Apr 2026).
In the case 23, if 24 is the spin-25 irrep, then
26
is multiplicity-free, and the transform coefficients are given explicitly by Wigner 27-symbols: 28 For symmetric-power representations, this yields linear-programming bounds for permutation-invariant qubit and qudit codes, including extremality results for the four-qubit, seven-qubit, and three-qutrit examples treated there (Kubischta et al., 17 Apr 2026). In the presence of multiplicities, the enumerators become matrix-valued, the MacWilliams transform becomes block unitary, and the feasibility problem becomes semidefinite (Kubischta et al., 17 Apr 2026).
Taken together, these developments show that the MacWilliams identity is best understood as a Fourier- or representation-theoretic transform between dual spectral data. In the classical Hamming setting it is a polynomial substitution; in broader settings it becomes a Krawtchouk transform, a block-unitary change of basis, or a semidefinite-compatible matrix transform, but the underlying principle remains the same: duality acts linearly on suitably chosen enumerators.