= Solution
Use the homogeneous <weight enumerator> convention
$$
W_C(s,t)=\sum_{x\in C}s^{\operatorname{wt}(x)}t^{N-\operatorname{wt}(x)}.
$$
Thus $s$ records ones, $t$ records zeros, and the ordinary <weight enumerator> is $W_C(z,1)$. For a binary <linear code> $C$ of <dimension> $k$ and its <dual code> $C^\perp$, the <MacWilliams identity> is
$$
\boxed{W_{C^\perp}(s,t)=\frac1{|C|}W_C(t-s,t+s)},
$$
or, equivalently, $W_C(s,t)=|C^\perp|^{-1}W_{C^\perp}(t-s,t+s)$. The second form applies the first to the dual and uses $(C^\perp)^\perp=C$.
One can verify the variable order directly from the character identity $\mathbf1_{C^\perp}(y)=|C|^{-1}\sum_{x\in C}(-1)^{x\cdot y}$. If $y$ is not orthogonal to $C$, translation by a <codeword> having odd inner product pairs positive and negative terms, giving zero; otherwise all terms are one. After multiplying by $s^{\operatorname{wt}(y)}t^{N-\operatorname{wt}(y)}$ and summing over $y$, coordinate $j$ contributes $t+s$ when $x_j=0$, and $t-s$ when $x_j=1$. Their product is exactly the stated substitution.
For a <Hamming code> with $N=2^l-1$, its dual is the <binary simplex code>, generated by the $l$ rows of the usual <parity-check matrix> $H=P^T$. There are $2^l$ dual words. A nonzero message $a\in\mathbb F_2^l$ produces the evaluations $a\cdot v$ as $v$ runs over all nonzero vectors of $\mathbb F_2^l$. Exactly $2^{l-1}$ of them are one: the nonzero <linear functional> $v\mapsto a\cdot v$ takes each value equally often on the whole <vector space>, and removing zero removes a zero value only. This proves the <constant weight of a binary simplex code>.
Put $m=2^{l-1}$, so $N-m=m-1$. The dual enumerator is therefore $t^N+(2^l-1)s^m t^{m-1}$. Applying the <MacWilliams identity> gives the <Hamming code weight enumerator>
$$
\boxed{W_C(s,t)=\frac1{2^l}\left[(s+t)^{2^l-1}+(2^l-1)(t-s)^{2^{l-1}}(t+s)^{2^{l-1}-1}\right]}.
$$
In one variable this is
$$
\boxed{W_C(z,1)=\frac{(1+z)^{2^l-1}+(2^l-1)(1-z)^{2^{l-1}}(1+z)^{2^{l-1}-1}}{2^l}}.
$$
For example, $l=3$ gives $1+7z^3+7z^4+z^7$; $l=2$ gives $1+z^3$. For $l=1$, the expression is $1$, agreeing with the singleton code. Setting $s=t=1$ in the homogeneous formula gives $2^{N-l}$, the correct number of <codewords>.
Back to article page