= Solution
For a <binary linear code> $C\leq\mathbb F_2^n$, its rank is its <dimension of a vector space> $r$. Use the <weight enumerator> convention
$$
W_C(s,t)=\sum_{c\in C}s^{w(c)}t^{n-w(c)},
$$
where $w(c)$ is the <Hamming weight>. This convention is essential here: $W_C(1,0)$ counts words of weight $n$, rather than zero words. There are $2^r$ codewords, so $\boxed{W_C(1,1)=2^r}$.
There is only one binary word of weight $n$, namely $\mathbf1=(1,\ldots,1)$. Thus $W_C(1,0)=1$ precisely when $\mathbf1\in C$. If this holds, the <linear map> $c\mapsto c+\mathbf1$ is a bijection of $C$ and replaces weight $w$ by $n-w$; hence $W_C(s,t)=W_C(t,s)$. Conversely this symmetry gives $W_C(1,0)=W_C(0,1)=1$, because the zero word is the unique word of weight zero.
The <repetition code> consists of $\mathbf0,\mathbf1$, giving
$$
\boxed{W_{\rm rep}(s,t)=t^n+s^n.}
$$
The <single parity-check code> consists of all words of even weight. Exactly $\binom nj$ words have weight $j$, so the <binomial theorem> gives
$$
\boxed{W_{\rm parity}(s,t)=\sum_{j\text{ even}}\binom nj s^jt^{n-j}=\frac{(t+s)^n+(t-s)^n}{2}.}
$$
Back to article page