Subset of Linear Code with Even Weight Codewords

Theorem
Let $C$ be a linear code.

Let $C^+$ be the subset of $C$ consisting of all the codewords of $C$ which have even weight.

Then $C^+$ is a subgroup of $C$ such that either $C^+ = C$ or such that $\order {C^+} = \dfrac {\order C} 2$.

Proof
Note that the zero codeword is in $C^+$ as it has a weight of $0$ which is even.

Let $c$ and $d$ be of even weight, where $c$ and $d$ agree in $k$ ordinates.

Let $\map w c$ denote the weight of $c$.

Then:

which is even.

Since the negative of a vector $\mathbf v$ in $\Z_2$ equals $\mathbf v$, it follows that the inverse of $c \in C$ is also in $C$.

It follows from the Two-Step Subgroup Test that $C^+$ is a subgroup of $C$.

Let $C \ne C^+$.

Then $C$ contains a codeword $c$ of odd weight.

Let $C^-$ denote the subset of $C$ consisting of all the codewords of $C$ which have odd weight.

Adding $c$ to each codeword of $C^+$ gives distinct codewords of odd weight, so:
 * $\order {C^-} \ge \order {C^+}$

Similarly, adding $c$ to each codeword of $C^-$ gives distinct codewords of even weight, so:
 * $\order {C^-} \le \order {C^+}$

As $C = C^+ \cup C^-$ it follows that:
 * $\order C = 2 \order {C^+}$

Hence the result.