From Projective Columns to a Code
A parity-check matrix defines a linear code as the set of vectors it sends to zero. The columns determine which coordinate combinations can cancel in that matrix product. For a p-ary Hamming code, the aim is to choose columns so that no one column is zero, no two columns are scalar multiples, and some three columns satisfy a nontrivial relation. These features rule out codewords of weights one and two while ensuring that a codeword of weight three exists.
Let \(p\) be a prime and let \(r\ge 2\). The field \(\mathbb{F}_p\) consists of the residues modulo \(p\), with addition and multiplication performed modulo \(p\). Work in the finite-dimensional vector space \(\mathbb{F}_p^r\). A one-dimensional subspace is a subspace of the form \(\operatorname{span}\{\mathbf{v}\}\) for some nonzero \(\mathbf{v}\in\mathbb{F}_p^r\). Its nonzero vectors are precisely the nonzero scalar multiples of \(\mathbf{v}\).
The convention gives exactly one representative from each one-dimensional subspace. Indeed, multiplying a nonzero vector by the inverse of its first nonzero coordinate makes that coordinate \(1\). If two such normalized vectors are nonzero scalar multiples of one another, their first nonzero coordinates occur in the same position, and both equal \(1\); the scalar must therefore be \(1\). Thus the normalized vectors are equal.
The one-dimensional subspaces partition the nonzero vectors of \(\mathbb{F}_p^r\): every nonzero vector belongs to the subspace it spans, and two such subspaces either coincide or share no nonzero vector. Each one-dimensional subspace has \(p-1\) nonzero vectors, one for each nonzero scalar in \(\mathbb{F}_p\). Since \(\mathbb{F}_p^r\) has \(p^r-1\) nonzero vectors, the number of columns is
Parameters of the Construction
A vector \(\mathbf{x}\in\mathbb{F}_p^n\) is a codeword exactly when its coordinates give a linear combination of the columns of \(\mathbf{H}\) equal to \(\mathbf{0}\). The rank of \(\mathbf{H}\) is \(r\): every column is in \(\mathbb{F}_p^r\), and the columns include all standard basis vectors \(\mathbf{e}_1,\dots,\mathbf{e}_r\), which are normalized representatives of their own one-dimensional subspaces. Those vectors span \(\mathbb{F}_p^r\).
Proof. The count of one-dimensional subspaces gives \(n=(p^r-1)/(p-1)\). Regard \(\mathbf{H}\) as the matrix of the linear map \(T:\mathbb{F}_p^n\to\mathbb{F}_p^r\) given by \(T(\mathbf{x})=\mathbf{H}\mathbf{x}\). Its image is all of \(\mathbb{F}_p^r\), since the columns include \(\mathbf{e}_1,\dots,\mathbf{e}_r\). Hence \(\operatorname{rank}\mathbf{H}=r\). By the Rank-Nullity Theorem, which states that the dimension of the domain of a linear map between finite-dimensional spaces equals the sum of its kernel dimension and image dimension, \(\dim\mathbf{C}=n-r\).
Define the Hamming weight \(\operatorname{wt}(\mathbf{x})\) to be the number of nonzero coordinates of \(\mathbf{x}\). The Hamming distance between two vectors is the number of coordinates in which they differ, so their distance is \(\operatorname{wt}(\mathbf{x}-\mathbf{y})\). In a linear code, the minimum distance between distinct codewords equals the least weight of a nonzero codeword: a difference of distinct codewords is a nonzero codeword, and each nonzero codeword is its difference from \(\mathbf{0}\).
No column of \(\mathbf{H}\) is zero, so a vector with just one nonzero coordinate cannot satisfy \(\mathbf{H}\mathbf{x}=\mathbf{0}\). Also, two distinct columns are not scalar multiples, because they represent different one-dimensional subspaces. A codeword with exactly two nonzero coordinates would give \(a\mathbf{h}_i+b\mathbf{h}_j=\mathbf{0}\) for distinct columns \(\mathbf{h}_i,\mathbf{h}_j\) and nonzero scalars \(a,b\). Rearranging gives \(\mathbf{h}_i=-b a^{-1}\mathbf{h}_j\), contradicting that the columns are not scalar multiples. Thus every nonzero codeword has weight at least three.
Finally, the columns include \(\mathbf{e}_1,\mathbf{e}_2,\mathbf{e}_1+\mathbf{e}_2\), each normalized as written. They are distinct representatives, and \(\mathbf{e}_1+\mathbf{e}_2-(\mathbf{e}_1+\mathbf{e}_2)=\mathbf{0}\) gives a codeword supported on those three columns, with coefficients \(1,1,-1\). All three coefficients are nonzero in \(\mathbb{F}_p\), including when \(p=2\), where \(-1=1\). Therefore a weight-three codeword exists, and the minimum distance is exactly \(3\). \(\square\)
Worked Constructions
Worked Example: The Projective Columns over \(\mathbb{F}_3^2\)
There are \(3^2-1=8\) nonzero vectors in \(\mathbb{F}_3^2\). Each one-dimensional subspace has \(3-1=2\) nonzero vectors, so there are \(8/2=4\) such subspaces. With the first-nonzero-coordinate convention, their representatives are \((1,0)^{\top}\), \((1,1)^{\top}\), \((1,2)^{\top}\), and \((0,1)^{\top}\). The last three entries \(1,2\) are residues modulo \(3\).
Use these vectors, in that order, as columns:
The first and fourth columns are \(\mathbf{e}_1\) and \(\mathbf{e}_2\), so \(\operatorname{rank}\mathbf{H}=2\). The length is \(n=4\), and rank-nullity gives dimension \(4-2=2\). For a direct check of a weight-three codeword, take \(\mathbf{x}=(1,2,0,1)^{\top}\). Multiplication modulo \(3\) gives
The vector has three nonzero entries. The theorem proves there is no nonzero codeword of smaller weight, so this code has parameters \([4,2,3]\) over \(\mathbb{F}_3\).
Worked Example: Binary Columns in Three Dimensions
In \(\mathbb{F}_2\), the only nonzero scalar is \(1\), so each one-dimensional subspace has only one nonzero vector. The seven nonzero vectors of \(\mathbb{F}_2^3\) are therefore the seven representatives. List them as \(\mathbf{e}_1,\mathbf{e}_2,\mathbf{e}_3,\mathbf{e}_1+\mathbf{e}_2,\mathbf{e}_1+\mathbf{e}_3,\mathbf{e}_2+\mathbf{e}_3,\mathbf{e}_1+\mathbf{e}_2+\mathbf{e}_3\). The parity-check matrix, displayed in two blocks to keep the columns readable, is
The two displayed blocks are the first four and last three columns of the same \(3\times7\) matrix. Its first three columns are \(\mathbf{e}_1,\mathbf{e}_2,\mathbf{e}_3\), so its rank is \(3\). Thus the length is \(7\), and the dimension is \(7-3=4\). The first, second, and fourth columns satisfy \(\mathbf{e}_1+\mathbf{e}_2+(\mathbf{e}_1+\mathbf{e}_2)=\mathbf{0}\) over \(\mathbb{F}_2\). Accordingly, the vector with entries \(1\) in positions \(1,2,4\) and \(0\) elsewhere is a codeword: its parity-check product is \((1+0+1,\;0+1+1,\;0+0+0)^{\top}=\mathbf{0}\) modulo \(2\). Its weight is \(3\), verifying the minimum distance. The parameters are \([7,4,3]\).
Worked Example: Thirteen Columns over \(\mathbb{F}_3^3\)
For \(p=3\) and \(r=3\), the number of columns is
The normalized representatives can be listed compactly in three groups: all vectors \((1,a,b)^{\top}\) with \(a,b\in\{0,1,2\}\); the three vectors \((0,1,c)^{\top}\) with \(c\in\{0,1,2\}\); and \((0,0,1)^{\top}\). The first group has \(3\cdot3=9\) vectors, the second has \(3\), and the last has \(1\), giving \(9+3+1=13\). These groups cover all normalized vectors according to whether the first nonzero coordinate is in position one, two, or three.
Among the columns are \(\mathbf{e}_1=(1,0,0)^{\top}\), \(\mathbf{e}_2=(0,1,0)^{\top}\), and \(\mathbf{e}_1+\mathbf{e}_2=(1,1,0)^{\top}\). The standard basis columns \(\mathbf{e}_1,\mathbf{e}_2,\mathbf{e}_3\) show that the parity-check matrix has rank \(3\); hence the code dimension is \(13-3=10\). To check the weight-three relation, give coefficient \(1\) to the \(\mathbf{e}_1\) and \(\mathbf{e}_2\) columns, and coefficient \(-1=2\) to the \((1,1,0)^{\top}\) column. Their contribution to the matrix product is
All three coefficients are nonzero, so this is a codeword of weight \(3\). The theorem gives minimum distance \(3\), and the parameters are \([13,10,3]\) over \(\mathbb{F}_3\).
Why One Representative Matters
The construction uses projective columns because scalar multiples point in the same one-dimensional direction. Including more than one vector from that direction would create proportional columns, and proportional columns yield a codeword of weight two. For example, over \(\mathbb{F}_3\), the columns \((1,0)^{\top}\) and \((2,0)^{\top}\) are proportional. The tempting two-coordinate vector \((1,1)^{\top}\) then gives
This is a weight-two codeword, so that column choice cannot give the minimum distance claimed for a Hamming code. The correction is to keep exactly one representative from each one-dimensional subspace. In \(\mathbb{F}_3^2\), this means four representatives, not three: there are eight nonzero vectors, divided into groups of two nonzero scalar multiples.
The resulting structure explains each parameter. Counting projective directions determines the length; the presence of every standard basis column forces full row rank and therefore determines the dimension; and the absence of zero or proportional columns rules out weights one and two. The three-column relation guarantees that the lower bound is attained. These arguments apply for every prime \(p\) and every \(r\ge2\), without requiring the parity-check matrix to be written out in full.
Check Your Understanding
Use the representative convention and perform all arithmetic in the stated field.
- How many one-dimensional subspaces of \(\mathbb{F}_5^2\) are there, and what is the resulting code length?
- List the normalized representatives for the one-dimensional subspaces of \(\mathbb{F}_2^2\).
- Why do the standard basis columns guarantee that the parity-check matrix has rank \(r\)?
- For \(p=3\), verify directly that the columns \((1,0)^{\top}\), \((0,1)^{\top}\), and \((1,1)^{\top}\) give a weight-three codeword.
- Explain why two proportional columns would produce a codeword of weight two.