# Definition:Standard Generator Matrix for Linear Code

## Definition

Let $n, k \in \Z_{>0}$ be strictly positive integers such that $n > k$.

Let $p$ be a prime number.

Let $\Z_p$ denote the set of residue classes modulo $p$.

A (standard) generator matrix $G$ over $\Z_p$ is a $k \times n$ matrix such that:

The elements of $G$ are elements of $\Z_p$
The first $k$ columns form the $k \times k$ identity matrix.

## Examples

### Linear $\tuple {3, 2}$-code in $\Z_2$

Let $G$ be the standard generator matrix:

$G := \begin{pmatrix} 1 & 0 & 1 \\ 0 & 1 & 1 \end{pmatrix}$

$G$ generates the linear code $C$:

$C = \set {000, 101, 011, 110}$

The minimum distance of $C$ is $2$, so $C$ detects $1$ transmission error and corrects none.

### Linear $\tuple {5, 3}$-code in $\Z_2$

Let $G$ be the standard generator matrix:

$G := \begin{pmatrix} 1 & 0 & 0 & 0 & 1 \\ 0 & 1 & 0 & 1 & 0 \\ 0 & 0 & 1 & 1 & 1 \end{pmatrix}$

$G$ generates the linear code $C$:

$C = \set {00000, 00111, 01010, 01101, 10001, 10110, 11011, 11100}$

The minimum distance of $C$ is $3$, so $C$ detects $1$ transmission error and corrects $0$ transmission errors.

### Linear $\tuple {6, 3}$-code in $\Z_2$

Let $G$ be the standard generator matrix:

$G := \begin{pmatrix} 1 & 0 & 0 & 1 & 1 & 0 \\ 0 & 1 & 0 & 1 & 0 & 1 \\ 0 & 0 & 1 & 0 & 1 & 1 \end{pmatrix}$

$G$ generates the linear code $C$:

$C = \set {000000, 100110, 010101, 110011, 001011, 101101, 011110, 111000}$

The minimum distance of $C$ is $3$, so $C$ detects $2$ transmission errors and corrects $1$ transmission error.

### Linear $\tuple {4, 2}$-code in $\Z_3$: Example 1

Let $G$ be the standard generator matrix:

$G := \begin{pmatrix} 1 & 0 & 2 & 1 \\ 0 & 1 & 1 & 2 \end{pmatrix}$

$G$ generates the linear code $C$:

$C = \set {0000, 0112, 0221, 1021, 1100, 1212, 2012, 2121, 2200}$

The minimum distance of $C$ is $2$, so $C$ detects $1$ transmission error and corrects $0$ transmission errors.

### Linear $\tuple {4, 2}$-code in $\Z_3$: Example 2

Let $G$ be the standard generator matrix:

$G := \begin{pmatrix} 1 & 0 & 1 & 1 \\ 0 & 1 & 1 & 2 \end{pmatrix}$

$G$ generates the linear code $C$:

$C = \set {0000, 0112, 0221, 1011, 1120, 1202, 2022, 2101, 2210}$

The minimum distance of $C$ is $3$, so $C$ detects $2$ transmission errors and corrects $1$ transmission error.

### Linear $\tuple {5, 3}$-code in $\Z_5$

Let $G$ be the standard generator matrix over $\Z_5$:

$G := \begin{pmatrix} 1 & 0 & 0 & 2 & 1 \\ 0 & 1 & 0 & 1 & 3 \\ 0 & 0 & 1 & 4 & 1 \\ \end{pmatrix}$

$G$ generates a linear code which detects $1$ transmission error and corrects $0$ transmission errors.