Find a weight enumerator of a binary code. I am facing difficulties in finding a weight enumerator of a binary code $\mathcal C$ with generator matrix $\mathbf G$ of size $m \times \binom{m}{2}$ consisting of all possible columns of length $m$ and weight 2, i.e.
$$
\mathbf G = 
\begin{pmatrix}
1 & 1& \cdots &0&0 \\
1 & 0 &\cdots & 0&0\\
0 & 1 & \cdots & 0 & 0\\
\vdots & \vdots & \ddots & \vdots &\vdots \\
0 & 0 & \cdots& 0 & 0 \\
0 & 0 & \cdots& 1 & 0 \\
0 & 0 & \cdots& 0 & 1 \\
0 & 0 & \cdots& 1 & 1 \\
\end{pmatrix}
$$
I tried to use the formula to compute the weight enumerator:
$$ W(\mathcal C; x, y) = \sum^n_{t=0}\mathcal Ax^ty^{n-t},$$
Where $\mathcal A$ is the weight distribution of sequence of numbers:
$$\mathcal A_t = \#\{c \in \mathcal C:||c||=t\},$$
and $\mathcal C \subset \mathbb F^2_n$ is a binary code of length $n$. But it doesn't give any results. What do you suggest to solve this problem?
Thank you very much.
 A: Every codeword is of the form$$\sum_{s\in S}r_s,\tag1$$ where $S$ is a subset of $\{1,\dots,m\}$, and $r_s$ is the $s^{th}$ row of $\bf G$. First, we need to understand what the weight of a codeword is, in terms of $S$.
To find the weight of $(1)$, index the columns of $\bf G$ with two-element subsets of $\{1,\dots,m\}$, and ask what would be the parity of the entry of $(1)$ corresponding to the subset $\{i,j\}$. The row vector $r_s$ has a $1$ at column $\{i,j\}$ if and only if either $i=s$ or $j=s$. Therefore, the number $s\in S$ which contribute a $1$ to that column is either $0$, $1$ or $2$, according to how many of $i,j$ are in $S$. We only care about the number modulo two, so to find the weight of $(1)$, we need to count the number of pairs $\{i,j\}$ such that $S$ contains exactly one of $i$ and $j$. This shows that the weight of $(1)$ is $|S|\cdot (m-|S|)$.
We now know that…

*

*The subsets $S$ of size $0$ contribute $\binom{m}0$ codewords of weight $0\cdot m=0$.


*The subsets $S$ of size $1$ contribute $\binom{m}1$ codewords of weight $1\cdot (m-1)$.


*$\vdots$


*The subsets $S$ of size $k$ contribute $\binom{m}k$ codewords of weight $k\cdot (m-k)$.


*$\vdots$
Edit: However, the correspondence from subsets to codewords is not bijective, since the nullity of the generator matrix $G$ is one. Therefore, the mapping subsets$\to$codewords is two-to-one, so after adding up the contributions from all subsets, we need to divide by $2$ to compensate.
This implies the following expression for the weight enumerator:
$$
\mathcal W(\mathcal C; x, y)= \color{red}{1\over 2}\sum_{k=0}^{m} \binom{m}{k} x^{k(m-k)}y^{\binom m2-k(m-k)}
$$
A: Seems that you forget $\frac{1}{2}$ coefficient. The initial generator matrix is degenerate: last row is the sum of other $m-1$.
