Generator Matrix — Definition, Formula & Example
A generator matrix is a compact recipe for a linear error-correcting code. You multiply a short message by it to produce a longer codeword that carries extra check bits.
Let be an linear code over the finite field . A generator matrix for is a matrix over whose rows form a basis of . Then , and . is in systematic (standard) form when , where is a matrix.
Key Formula
Where:
- = Message: a row vector of length k with entries in the field (0s and 1s for binary codes)
- = Generator matrix with k rows and n columns
- = Codeword: a row vector of length n
- = The k × k identity matrix, which copies the message into the first k positions
- = The k × (n − k) parity part, which produces the check symbols
Worked Example
Problem: A binary [6, 3] code has the systematic generator matrix . Encode the message . All arithmetic is mod 2.
Step 1: The product is a combination of the rows of . The message has 1s in positions 1 and 3, so the codeword is row 1 plus row 3.
Step 2: Add the two rows entry by entry, reducing mod 2. In column 4 you get .
Step 3: Check the systematic structure. The first three bits repeat the message, and the last three are parity bits. Every message in gives one codeword, so the code has codewords.
Answer: The codeword is . Its first three bits are the original message, and its last three bits, , are the check bits.
Why It Matters
Generator matrices are how engineers specify the codes in QR codes, deep-space probe links, and computer memory with error correction. In a coding theory or abstract algebra course, you use to find the parity-check matrix , which then drives syndrome decoding.
Common Mistakes
Mistake: Using ordinary integer arithmetic when multiplying , which leaves entries like 2 in a binary codeword.
Correction: A binary code lives over , so you reduce every sum mod 2. Then . A codeword may contain only 0s and 1s.
