# Equivalent Codes and weight

If $C$ and $D$ are equivalent linear codes, how can I show that the number of words with weight $w$ in Code $C$ is equivalent to number of words with weight $w$ in Code D?

• The equivalence is a bijection from $C$ to $D$ that preserves the weights of words, so... – Jyrki Lahtonen Feb 19 '15 at 23:13

Let $c$ be a word of $C$ of weight $w$ and let $f$ be the function sending words in $C$ to the corresponding words in $D$.
Hint: Consider $f(c)-f(0)$.
$f$ preserves Hamming distance, so $w=d(c,0)=d(f(c),f(0))$. But $D$ is linear, so $f(c)-f(0)$ is a word of $D$ of weight $d(f(c),f(0))=w$.
Assume that there is some other word $c' \neq c$ of weight $w$. Then $f(c') \neq f(c)$, so $f(c')-f(0) \neq f(c)-f(0)$ and hence we get a different word of $D$ of weight $w$.
So $D$ must have at least as many words of weight $w$ as $C$ has. We can apply exactly the same argument to $f^{-1}$, so they must have exactly the same number of words of weight $w$.