Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

📚 The CoCalc Library - books, templates and other resources

132928 views
License: OTHER
Kernel:
%%html <link href="http://mathbook.pugetsound.edu/beta/mathbook-content.css" rel="stylesheet" type="text/css" /> <link href="https://aimath.org/mathbook/mathbook-add-on.css" rel="stylesheet" type="text/css" /> <style>.subtitle {font-size:medium; display:block}</style> <link href="https://fonts.googleapis.com/css?family=Open+Sans:400,400italic,600,600italic" rel="stylesheet" type="text/css" /> <link href="https://fonts.googleapis.com/css?family=Inconsolata:400,700&subset=latin,latin-ext" rel="stylesheet" type="text/css" /><!-- Hide this cell. --> <script> var cell = $(".container .cell").eq(0), ia = cell.find(".input_area") if (cell.find(".toggle-button").length == 0) { ia.after( $('<button class="toggle-button">Toggle hidden code</button>').click( function (){ ia.toggle() } ) ) ia.hide() } </script>

Important: to view this notebook properly you will need to execute the cell above, which assumes you have an Internet connection. It should already be selected, or place your cursor anywhere above to select. Then press the "Run" button in the menu bar above (the right-pointing arrowhead), or press Shift-Enter on your keyboard.

ParseError: KaTeX parse error: \newcommand{\lt} attempting to redefine \lt; use \renewcommand

Section8.3Parity-Check and Generator Matrices

¶

We need to find a systematic way of generating linear codes as well as fast methods of decoding. By examining the properties of a matrix HH and by carefully choosing H,H\text{,} it is possible to develop very efficient methods of encoding and decoding messages. To this end, we will introduce standard generator and canonical parity-check matrices.

Suppose that HH is an m×nm \times n matrix with entries in Z2{\mathbb Z}_2 and n>m.n \gt m\text{.} If the last mm columns of the matrix form the m×mm \times m identity matrix, Im,I_m\text{,} then the matrix is a . More specifically, H=(A∣Im),H= (A \mid I_m)\text{,} where AA is the m×(n−m)m \times (n-m) matrix

(a11a12⋯a1,n−ma21a22⋯a2,n−m⋮⋮⋱⋮am1am2⋯am,n−m)\begin{equation*} \begin{pmatrix} a_{11} & a_{12} & \cdots & a_{1,n-m} \\ a_{21} & a_{22} & \cdots & a_{2,n-m} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m1} & a_{m2} & \cdots & a_{m,n-m} \end{pmatrix} \end{equation*}

and ImI_m is the m×mm \times m identity matrix

(10⋯001⋯0⋮⋮⋱⋮00⋯1).\begin{equation*} \begin{pmatrix} 1 & 0 & \cdots & 0 \\ 0 & 1 & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & 1 \end{pmatrix}. \end{equation*}

With each canonical parity-check matrix we can associate an n×(n−m)n \times (n-m)

G=(In−mA).\begin{equation*} G = \left( \frac{I_{n-m}}{A} \right). \end{equation*}

Our goal will be to show that an x\mathbf x satisfying Gx=yG {\mathbf x} = {\mathbf y} exists if and only if Hy=0.H{\mathbf y} = {\mathbf 0}\text{.} Given a message block x{\mathbf x} to be encoded, the matrix GG will allow us to quickly encode it into a linear codeword y.{\mathbf y}\text{.}

Example8.23

Suppose that we have the following eight words to be encoded:

(000),(001),(010),…,(111).\begin{equation*} (000), (001), (010), \ldots, (111). \end{equation*}

For

A=(011110101),\begin{equation*} A = \begin{pmatrix} 0 & 1 & 1 \\ 1 & 1 & 0 \\ 1 & 0 & 1 \end{pmatrix}, \end{equation*}

the associated standard generator and canonical parity-check matrices are

G=(100010001011110101)\begin{equation*} G= \begin{pmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \\ 0 & 1 & 1 \\ 1 & 1 & 0 \\ 1 & 0 & 1 \end{pmatrix} \end{equation*}

and

H=(011100110010101001),\begin{equation*} H = \begin{pmatrix} 0 & 1 & 1 & 1 & 0 & 0 \\ 1 & 1 & 0 & 0 & 1 & 0 \\ 1 & 0 & 1 & 0 & 0 & 1 \end{pmatrix}, \end{equation*}

respectively.

Observe that the rows in HH represent the parity checks on certain bit positions in a 6-tuple. The 1s in the identity matrix serve as parity checks for the 1s in the same row. If x=(x1,x2,x3,x4,x5,x6),{\mathbf x} = (x_1, x_2, x_3, x_4, x_5, x_6)\text{,} then

0=Hx=(x2+x3+x4x1+x2+x5x1+x3+x6),\begin{equation*} {\mathbf 0} = H{\mathbf x} = \begin{pmatrix} x_2 + x_3 + x_4 \\ x_1 + x_2 + x_5\\ x_1 + x_3 + x_6 \end{pmatrix}, \end{equation*}

which yields a system of equations:

x2+x3+x4=0x1+x2+x5=0x1+x3+x6=0.\begin{align*} x_2 + x_3 + x_4 & = 0\\ x_1 + x_2 + x_5 & = 0\\ x_1 + x_3 + x_6 & = 0. \end{align*}

Here x4x_4 serves as a check bit for x2x_2 and x3;x_3\text{;} x5x_5 is a check bit for x1x_1 and x2;x_2\text{;} and x6x_6 is a check bit for x1x_1 and x3.x_3\text{.} The identity matrix keeps x4,x_4\text{,} x5,x_5\text{,} and x6x_6 from having to check on each other. Hence, x1,x_1\text{,} x2,x_2\text{,} and x3x_3 can be arbitrary but x4,x_4\text{,} x5,x_5\text{,} and x6x_6 must be chosen to ensure parity. The null space of HH is easily computed to be

(000000)(001101)(010110)(011011)(100011)(101110)(110101)(111000).\begin{equation*} \begin{array}{cccc} (000000) & (001101) & (010110) & (011011) \\ (100011) & (101110) & (110101) & (111000). \end{array} \end{equation*}

An even easier way to compute the null space is with the generator matrix GG (Table 8.24).

Message Word x\mathbf xCodeword GxG \mathbf x
000000000
001001101
010010110
011011011
100100011
101101110
110110101
111111000
Table8.24A matrix-generated code
Theorem8.25

If H∈Mm×n(Z2)H \in {\mathbb M}_{m \times n}({\mathbb Z}_2) is a canonical parity-check matrix, then Null(H){\rm Null}(H) consists of all x∈Z2n{\mathbf x} \in {\mathbb Z}_2^n whose first n−mn-m bits are arbitrary but whose last mm bits are determined by Hx=0.H{\mathbf x} = {\mathbf 0}\text{.} Each of the last mm bits serves as an even parity check bit for some of the first n−mn-m bits. Hence, HH gives rise to an (n,n−m)(n, n-m)-block code.

We leave the proof of this theorem as an exercise. In light of the theorem, the first n−mn - m bits in x{\mathbf x} are called and the last mm bits are called . In Example 8.23, the first three bits are the information bits and the last three are the check bits.

Theorem8.26

Suppose that GG is an n×kn \times k standard generator matrix. Then C={y:Gx=y for x∈Z2k}C = \left\{{\mathbf y} : G{\mathbf x} ={\mathbf y}\text{ for }{\mathbf x}\in {\mathbb Z}_2^k\right\} is an (n,k)(n,k)-block code. More specifically, CC is a group code.

Proof

Let Gx1=y1G {\mathbf x}_1 = {\mathbf y}_1 and Gx2=y2G {\mathbf x}_2 ={\mathbf y}_2 be two codewords. Then y1+y2{\mathbf y}_1 + {\mathbf y}_2 is in CC since

G(x1+x2)=Gx1+Gx2=y1+y2.\begin{equation*} G( {\mathbf x}_1 + {\mathbf x}_2) = G {\mathbf x}_1 + G {\mathbf x}_2 = {\mathbf y}_1 + {\mathbf y}_2. \end{equation*}

We must also show that two message blocks cannot be encoded into the same codeword. That is, we must show that if Gx=Gy,G {\mathbf x} = G {\mathbf y}\text{,} then x=y.{\mathbf x} = {\mathbf y}\text{.} Suppose that Gx=Gy.G {\mathbf x} = G {\mathbf y}\text{.} Then

Gx−Gy=G(x−y)=0.\begin{equation*} G {\mathbf x} - G {\mathbf y} = G( {\mathbf x} - {\mathbf y}) = {\mathbf 0}. \end{equation*}

However, the first kk coordinates in G(x−y)G( {\mathbf x} - {\mathbf y}) are exactly x1−y1,…,xk−yk,x_1 -y_1, \ldots, x_k - y_k\text{,} since they are determined by the identity matrix, Ik,I_k\text{,} part of G.G\text{.} Hence, G(x−y)=0G( {\mathbf x} - {\mathbf y}) = {\mathbf 0} exactly when x=y.{\mathbf x} = {\mathbf y}\text{.}

Before we can prove the relationship between canonical parity-check matrices and standard generating matrices, we need to prove a lemma.

Lemma8.27

Let H=(A∣Im)H = (A \mid I_m ) be an m×nm \times n canonical parity-check matrix and G=(In−mA)G = \left( \frac{I_{n-m} }{A} \right) be the corresponding n×(n−m)n \times (n-m) standard generator matrix. Then HG=0.HG = {\mathbf 0}\text{.}

Proof

Let C=HG.C = HG\text{.} The ijijth entry in CC is

cij=∑k=1nhikgkj=∑k=1n−mhikgkj+∑k=n−m+1nhikgkj=∑k=1n−maikδkj+∑k=n−m+1nδi−(m−n),kakj=aij+aij=0,\begin{align*} c_{ij} & = \sum_{k=1}^n h_{ik} g_{kj}\\ & = \sum_{k=1}^{n-m} h_{ik} g_{kj} + \sum_{k=n-m+1}^n h_{ik} g_{kj}\\ & = \sum_{k=1}^{n-m} a_{ik} \delta_{kj} + \sum_{k=n-m+1}^n \delta_{i-(m-n),k} a_{kj}\\ & = a_{ij} + a_{ij}\\ & = 0, \end{align*}

where

δij={1,i=j0,i≠j\begin{equation*} \delta_{ij} = \begin{cases} 1, & i = j \\ 0, & i \neq j \end{cases} \end{equation*}

is the Kronecker delta.

Theorem8.28

Let H=(A∣Im)H = (A \mid I_m ) be an m×nm \times n canonical parity-check matrix and let G=(In−mA)G = \left( \frac{I_{n-m} }{A} \right) be the n×(n−m)n \times (n-m) standard generator matrix associated with H.H\text{.} Let CC be the code generated by G.G\text{.} Then y{\mathbf y} is in CC if and only if Hy=0.H {\mathbf y} = {\mathbf 0}\text{.} In particular, CC is a linear code with canonical parity-check matrix H.H\text{.}

Proof

First suppose that y∈C.{\mathbf y} \in C\text{.} Then Gx=yG {\mathbf x} = {\mathbf y} for some x∈Z2m.{\mathbf x} \in {\mathbb Z}_2^m\text{.} By Lemma 8.27, Hy=HGx=0.H {\mathbf y} = HG {\mathbf x} = {\mathbf 0}\text{.}

Conversely, suppose that y=(y1,…,yn)t{\mathbf y} = (y_1, \ldots, y_n)^{\rm t} is in the null space of H.H\text{.} We need to find an x{\mathbf x} in Z2n−m{\mathbb Z}_2^{n-m} such that Gxt=y.G {\mathbf x}^{\rm t} = {\mathbf y}\text{.} Since Hy=0,H {\mathbf y} = {\mathbf 0}\text{,} the following set of equations must be satisfied:

a11y1+a12y2+⋯+a1,n−myn−m+yn−m+1=0a21y1+a22y2+⋯+a2,n−myn−m+yn−m+1=0⋮am1y1+am2y2+⋯+am,n−myn−m+yn−m+1=0.\begin{align*} a_{11} y_1 + a_{12} y_2 + \cdots + a_{1, n-m} y_{n-m} + y_{n-m+1} & = 0\\ a_{21} y_1 + a_{22} y_2 + \cdots + a_{2, n-m} y_{n-m} + y_{n-m+1} & = 0\\ & \vdots \\ a_{m1} y_1 + a_{m2} y_2 + \cdots + a_{m, n-m} y_{n-m} + y_{n-m+1} & = 0. \end{align*}

Equivalently, yn−m+1,…,yny_{n-m+1}, \ldots, y_n are determined by y1,…,yn−m:y_1, \ldots, y_{n-m}\text{:}

yn−m+1=a11y1+a12y2+⋯+a1,n−myn−myn−m+1=a21y1+a22y2+⋯+a2,n−myn−m⋮yn−m+1=am1y1+am2y2+⋯+am,n−myn−m.\begin{align*} y_{n-m+1} & = a_{11} y_1 + a_{12} y_2 + \cdots + a_{1, n-m} y_{n-m}\\ y_{n-m+1} & = a_{21} y_1 + a_{22} y_2 + \cdots + a_{2, n-m} y_{n-m}\\ & \vdots\\ y_{n-m+1} & = a_{m1} y_1 + a_{m2} y_2 + \cdots + a_{m, n-m} y_{n-m}. \end{align*}

Consequently, we can let xi=yix_i = y_i for i=1,…,n−m.i= 1, \ldots, n - m\text{.}

It would be helpful if we could compute the minimum distance of a linear code directly from its matrix HH in order to determine the error-detecting and error-correcting capabilities of the code. Suppose that

e1=(100⋯00)te2=(010⋯00)t⋮en=(000⋯01)t\begin{align*} {\mathbf e}_1 & = (100 \cdots 00)^{\rm t}\\ {\mathbf e}_2 & = (010 \cdots 00)^{\rm t}\\ & \vdots\\ {\mathbf e}_n & = (000 \cdots 01)^{\rm t} \end{align*}

are the nn-tuples in Z2n{\mathbb Z}_2^n of weight 1. For an m×nm \times n binary matrix H,H\text{,} HeiH{\mathbf e}_i is exactly the iith column of the matrix H.H\text{.}

Example8.29

Observe that

(111001001011001)(01000)=(101).\begin{equation*} \begin{pmatrix} 1 & 1 & 1 & 0 & 0 \\ 1 & 0 & 0 & 1 & 0 \\ 1 & 1 & 0 & 0 & 1 \end{pmatrix} \begin{pmatrix} 0 \\ 1 \\ 0 \\ 0 \\ 0 \end{pmatrix} = \begin{pmatrix} 1 \\ 0 \\ 1 \end{pmatrix}. \end{equation*}

We state this result in the following proposition and leave the proof as an exercise.

Proposition8.30

Let ei{\mathbf e}_i be the binary nn-tuple with a 11 in the iith coordinate and 00's elsewhere and suppose that H∈Mm×n(Z2).H \in {\mathbb M}_{m \times n}({\mathbb Z}_2)\text{.} Then HeiH{\mathbf e}_i is the iith column of the matrix H.H\text{.}

Theorem8.31

Let HH be an m×nm \times n binary matrix. Then the null space of HH is a single error-detecting code if and only if no column of HH consists entirely of zeros.

Proof

Suppose that Null(H){\rm Null}(H) is a single error-detecting code. Then the minimum distance of the code must be at least 2. Since the null space is a group code, it is sufficient to require that the code contain no codewords of less than weight 2 other than the zero codeword. That is, ei{\mathbf e}_i must not be a codeword for i=1,…,n.i = 1, \ldots, n\text{.} Since HeiH{\mathbf e}_i is the iith column of H,H\text{,} the only way in which ei{\mathbf e}_i could be in the null space of HH would be if the iith column were all zeros, which is impossible; hence, the code must have the capability to detect at least single errors.

Conversely, suppose that no column of HH is the zero column. By Proposition 8.30, Hei≠0.H{\mathbf e}_i \neq {\mathbf 0}\text{.}

Example8.32

If we consider the matrices

H1=(111001001011001)\begin{equation*} H_1 = \begin{pmatrix} 1 & 1 & 1 & 0 & 0 \\ 1 & 0 & 0 & 1 & 0 \\ 1 & 1 & 0 & 0 & 1 \end{pmatrix} \end{equation*}

and

H2=(111001000011001),\begin{equation*} H_2 = \begin{pmatrix} 1 & 1 & 1 & 0 & 0 \\ 1 & 0 & 0 & 0 & 0 \\ 1 & 1 & 0 & 0 & 1 \end{pmatrix}, \end{equation*}

then the null space of H1H_1 is a single error-detecting code and the null space of H2H_2 is not.

We can even do better than Theorem 8.31. This theorem gives us conditions on a matrix HH that tell us when the minimum weight of the code formed by the null space of HH is 2. We can also determine when the minimum distance of a linear code is 3 by examining the corresponding matrix.

Example8.33

If we let

H=(111010011100)\begin{equation*} H = \begin{pmatrix} 1 & 1 & 1 & 0 \\ 1 & 0 & 0 & 1 \\ 1 & 1 & 0 & 0 \end{pmatrix} \end{equation*}

and want to determine whether or not HH is the canonical parity-check matrix for an error-correcting code, it is necessary to make certain that Null(H){\rm Null}(H) does not contain any 4-tuples of weight 2. That is, (1100),(1100)\text{,} (1010),(1010)\text{,} (1001),(1001)\text{,} (0110),(0110)\text{,} (0101),(0101)\text{,} and (0011)(0011) must not be in Null(H).{\rm Null}(H)\text{.} The next theorem states that we can indeed determine that the code generated by HH is error-correcting by examining the columns of H.H\text{.} Notice in this example that not only does HH have no zero columns, but also that no two columns are the same.

Theorem8.34

Let HH be a binary matrix. The null space of HH is a single error-correcting code if and only if HH does not contain any zero columns and no two columns of HH are identical.

Proof

The nn-tuple ei+ej{\mathbf e}_{i} +{\mathbf e}_{j} has 1s in the iith and jjth entries and 0s elsewhere, and w(ei+ej)=2w( {\mathbf e}_{i} +{\mathbf e}_{j}) = 2 for i≠j.i \neq j\text{.} Since

0=H(ei+ej)=Hei+Hej\begin{equation*} {\mathbf 0} = H({\mathbf e}_{i} +{\mathbf e}_{j}) = H{\mathbf e}_{i} + H{\mathbf e}_{j} \end{equation*}

can only occur if the iith and jjth columns are identical, the null space of HH is a single error-correcting code.

Suppose now that we have a canonical parity-check matrix HH with three rows. Then we might ask how many more columns we can add to the matrix and still have a null space that is a single error-detecting and single error-correcting code. Since each column has three entries, there are 23=82^3 = 8 possible distinct columns. We cannot add the columns

(000),(100),(010),(001).\begin{equation*} \begin{pmatrix} 0 \\ 0 \\ 0 \end{pmatrix}, \begin{pmatrix} 1 \\ 0 \\ 0 \end{pmatrix}, \begin{pmatrix} 0 \\ 1 \\ 0 \end{pmatrix}, \begin{pmatrix} 0 \\ 0 \\ 1 \end{pmatrix}. \end{equation*}

So we can add as many as four columns and still maintain a minimum distance of 3.

In general, if HH is an m×nm \times n canonical parity-check matrix, then there are n−mn-m information positions in each codeword. Each column has mm bits, so there are 2m2^m possible distinct columns. It is necessary that the columns 0,e1,…,em{\mathbf 0}, {\mathbf e}_1, \ldots, {\mathbf e}_m be excluded, leaving 2m−(1+m)2^m - (1 + m) remaining columns for information if we are still to maintain the ability not only to detect but also to correct single errors.