I am struck on this question in assignment of coding theory ( 1st course).
Question is ->Let C be a binary linear code . Show that number of codewords that have 0 at position i are either $2^k$ or $2^{k-1} $ .
My attempt-> If I fix ith position by 0 then I have 2 choices for each (k-1) position.So , the answer is $2^{k-1} $ .
Then how can answer be $2^k$ or $2^{k-1} $.
Can someone please tell.
Let $C \subseteq \mathbb F_2^n$ be a binary $[n, k]$-code and $1 \le i \le n$. Define a linear map $\pi \colon C \to \mathbb F_2$ by $\pi(x_1 \dotsm x_n) = x_i$. The set of codewords that have $0$ at position $i$ equals $\ker \pi$. Because $\dim(\operatorname{im}\pi) \in \{0, 1\}$, we get $\dim(\ker\pi) = \dim C - \dim(\operatorname{im}\pi) \in \{ k, k - 1 \}$ by the rank-nullity theorem. So the number of such codewords is either $2^k$ or $2^{k-1}$.