Since a code is a finite dimensional vector space over a finite field, it only has finitely many elements. To represent a code in a computer one may of course store all the elements. But there must be a simpler way of representing a code than by listing all of its elements, right? Yes, there is and this motivates the following definition.

A code is often represented by simply giving a generator matrix. To compute a generator matrix of a given code
of length
, first determine a basis for the code as a vector space over
, then put these basis vectors into a
matrix, where
.

(a) its sum with another row, or
(b) its scalar multiple with any non-zero element of
,
is called an elementary row operation.
If
is any matrix with entries in a field
then
(a) swapping any two columns, or
(b) replacing any column of
by its scalar multiple with any non-zero element of
,
is called a simple column operation.
proof: The rows of
still form a basis for the vector space
over
. ![]()

However, if we swap the first two columns of
, to get

These are called generalized (or shortened or extended) Reed-Solomon codes. (As we shall see later, in the context of cyclic codes, Reed-Solomon codes have
.) Note the parameters satisfy the Singleton bound, so these are MDS codes.
The generator matrix for
is of the form
.
The encoding matrix of a linear code
of dinension
is an
matrix
whose image is
. To compute the encoding matrix from the generator matrix is easy.
The proof of this is left as an exercise.
Many general properties about a linear code may be reduced to a corresponding property of its generator matrix. Can one determine the minimum distance of a code from its generator matrix? The following result answers this.
proof: By definition of
, there is a code word in
having exactly
non-zero entries. Thus by definition of
, there are
columns of
which are linearly dependent. If there were
columns of
which are linearly independent then there would be (by definition of
) a code word in
having exactly
non-zero entries. This would contradict the definition of
. ![]()