= Solution
For a <linear code> $X\leq\mathbb F^n$, its <dual code> is
$$
X^\perp=\{y\in\mathbb F^n:\sum_{i=1}^n x_i y_i=0\text{ for every }x\in X\}.
$$
The standard <bilinear form> is nondegenerate. The map $\mathbb F^n\to X^*$ obtained by restricting the dot-product functional to $X$ is <surjective>: extend a functional from a <basis> of $X$ to a <basis> of $\mathbb F^n$, then use the nondegenerate <dot product> to represent it. Its <kernel> is $X^\perp$. The <rank-nullity theorem> therefore gives
$$
\boxed{\dim X^\perp=n-\dim X.}
$$
The first proposed description of the <dual code> is \b[false without self-orthogonality]. At length three take $X=\langle(1,0,0)\rangle$. It has the specified <dimension>, but
$$
X^\perp=\{(0,a,b):a,b\in\mathbb F_2\},
$$
whereas $\langle X,(1,1,1)\rangle$ contains $(1,0,0)$ and $(1,1,1)$, neither of which is in $X^\perp$. The natural corrected statement is the <odd-length binary self-orthogonal dual extension>: if also $X\subseteq X^\perp$, every word of $X$ has even <Hamming weight>, the all-ones word lies in $X^\perp$ but not in $X$, and <dimensions> then give $X^\perp=X\oplus\langle\mathbf1\rangle$.
For a binary <self-dual code>, $x\cdot x=0$ for every $x\in X$. In $\mathbb F_2$, this equals $\sum_i x_i$, so every <codeword> has even <Hamming weight>. Thus $\mathbf1\cdot x=0$ for all $x$, giving $\mathbf1\in X^\perp=X$. The <dimension> identity yields $2\dim X=n$, so $n$ is even. Alternatively $\mathbf1\in X$ and $\mathbf1\cdot\mathbf1=0$ itself gives evenness. Hence \b[the second assertion is true].
For every $n=2m$, use
$$
X=\{(u,u):u\in\mathbb F_2^m\},\qquad G=(I_m\mid I_m).
$$
This <linear code> has <dimension> $m$, and $(u,u)\cdot(v,v)=2(u\cdot v)=0$. Therefore $X\subseteq X^\perp$; both have <dimension> $m$, so equality holds. This constructs a binary <self-dual code> at every even length. Conversely the <dimension> identity already proves \b[every self-dual length-$n$ <linear code> has <dimension> $n/2$].
For a nonbinary example, over $\mathbb F_5$ take $X=\langle(1,2)\rangle$. Its generator has self-product $1+2^2=0$ in $\mathbb F_5$, so $X\subseteq X^\perp$. Both are one-dimensional, proving
$$
\boxed{\langle(1,2)\rangle\leq\mathbb F_5^2\text{ is self-dual}.}
$$
Back to article page