Solutions to Homework 6
Math 5251 Fall 2006
Rogness

Unlike some of the previous materials I posted, I wrote these solutions out in Mathematica.  For convenience (mine) I didn't delete the Mathematica commands before posting this document online, but you should certainly feel free to ignore the bold-faced commands and just pay attention to the answers.

As always, these solutions aren't meant to be comprehensive, so let me know if you still have a question or spot a typo.  Thanks!

12.17

H = {{1, 1, 1, 0}, {0, 1, 0, 1}} ;

y = {{1, 0, 0, 1}} ;

y . Transpose[H]//MatrixForm

( {{1, 1}} )

12.A

We know the Hamming [7,4] code is generated by the matrix

G = {{1, 0, 0, 0, 0, 1, 1}, {0, 1, 0, 0, 1, 0, 1}, {0, 0, 1, 0, 1, 1, 0}, {0, 0, 0, 1, 1, 1, 1}} ;

MatrixForm[G]

( {{1, 0, 0, 0, 0, 1, 1}, {0, 1, 0, 0, 1, 0, 1}, {0, 0, 1, 0, 1, 1, 0}, {0, 0, 0, 1, 1, 1, 1}} )

This is in "standard form," G = [ I | A ], so we know that the generating matrix for C^⊥  is given by G^⊥= [ -A^t | I ].  More often we called this matrix H, because it's also the check matrix for the Hamming code.  See pages 223-224.

H = {{0, 1, 1, 1, 1, 0, 0}, {1, 0, 1, 1, 0, 1, 0}, {1, 1, 0, 1, 0, 0, 1}} ;

MatrixForm[H]

( {{0, 1, 1, 1, 1, 0, 0}, {1, 0, 1, 1, 0, 1, 0}, {1, 1, 0, 1, 0, 0, 1}} )

The dual code is a [7,3] code, and its codewords are all of the linear combinations of the rows of H:

Table[MatrixForm[Mod[{{a, b, c}} . H, 2]], {a, 0, 1}, {b, 0, 1}, {c, 0, 1}]//TableForm

( {{0, 0, 0, 0, 0, 0, 0}} )
( {{1, 1, 0, 1, 0, 0, 1}} )
( {{1, 0, 1, 1, 0, 1, 0}} )
( {{0, 1, 1, 0, 0, 1, 1}} )
( {{0, 1, 1, 1, 1, 0, 0}} )
( {{1, 0, 1, 0, 1, 0, 1}} )
( {{1, 1, 0, 0, 1, 1, 0}} )
( {{0, 0, 0, 1, 1, 1, 1}} )

One way to find the minimum weight of a linear code is via the proposition on page 222: d is equal to the minimum weight of the (non-zero) words.  By looking at the codewords we see the minimum weight is 4, so this code can in fact correct a single error.

14.02

Here's the matrix:

M = Table[RotateRight[{1, 1, 1, 0, 0, 0, 0, 0, 0}, i], {i, 0, 8}] ;

MatrixForm[M]

( {{1, 1, 1, 0, 0, 0, 0, 0, 0}, {0, 1, 1, 1, 0, 0, 0, 0, 0}, {0, 0, 1, 1, 1, 0, 0, 0 ... {0, 0, 0, 0, 0, 0, 1, 1, 1}, {1, 0, 0, 0, 0, 0, 0, 1, 1}, {1, 1, 0, 0, 0, 0, 0, 0, 1}} )

There are a few ways to procede.  The first approach uses linear algebra by finding the row-reduced verion of the matrix.

RowReduce[M, Modulus2]//MatrixForm

( {{1, 0, 0, 0, 0, 0, 0, 1, 1}, {0, 1, 0, 0, 0, 0, 0, 1, 0}, {0, 0, 1, 0, 0, 0, 0, 0 ... {0, 0, 0, 0, 0, 0, 1, 1, 1}, {0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0}} )

We see that the resulting matrix has 7 non-zero rows, which means the dimension of the rowspace is 7.  However, I still have to find a generating polynomial, so this approach only gets me halfway.

The other approach is to notice that the polynomial b(x) used to generate the matrix is

b[x_] = 1 + x + x^2

1 + x + x^2

Now we can find the "best" generating polynomial, which is the GCD of b(x) and x^n-1; since we have a 9x9 matrix, n=9:

PolynomialGCD[b[x], x^9 - 1, Modulus2]

1 + x + x^2

(Aha!  So b(x) must already divide x^9-1.)  Now we can write down a "true" generating matrix for the code, by cycling the vector corresponding to b until its last 1 reaches the last column.

G = Table[RotateRight[{1, 1, 1, 0, 0, 0, 0, 0, 0}, i], {i, 0, 6}] ;

MatrixForm[G]

( {{1, 1, 1, 0, 0, 0, 0, 0, 0}, {0, 1, 1, 1, 0, 0, 0, 0, 0}, {0, 0, 1, 1, 1, 0, 0, 0 ... {0, 0, 0, 0, 1, 1, 1, 0, 0}, {0, 0, 0, 0, 0, 1, 1, 1, 0}, {0, 0, 0, 0, 0, 0, 1, 1, 1}} )

This is a 7x9 matrix, so the code must be a [9,7] code and have dimension 7.

14.04

Roughly following the approach in 14.02, we have

b[x_] = 0 + x + 0x^2 + 0x^3 + 0x^4 + x^5 + 0x^6 + x^7 + x^8

x + x^5 + x^7 + x^8

We can immediately replace b(x) with a polynomial which divides x^n-1 and generates the same code:

g[x_] = PolynomialGCD[b[x], x^9 - 1, Modulus2]

1 + x^3

As a 9-dimensional vector, that's 100100000, so the generating matrix is

G = Table[RotateRight[{1, 0, 0, 1, 0, 0, 0, 0, 0}, i], {i, 0, 5}] ;

MatrixForm[G]

( {{1, 0, 0, 1, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 1, 0, 0, 0, 0}, {0, 0, 1, 0, 0, 1, 0, 0 ... {0, 0, 0, 1, 0, 0, 1, 0, 0}, {0, 0, 0, 0, 1, 0, 0, 1, 0}, {0, 0, 0, 0, 0, 1, 0, 0, 1}} )

That's a 6x9 matrix, so C is a [9,6] code.  To find a check matrix we can procede as in 12.A, or we can use the special form of a check matrix for cyclic codes, as described on page 236:

h[x_] = PolynomialMod[PolynomialQuotient[x^9 - 1, g[x], x], 2]

1 + x^3 + x^6

So the check matrix is

H = Table[RotateRight[{1, 0, 0, 1, 0, 0, 1, 0, 0}, i], {i, 0, 2}] ;

MatrixForm[H]

( {{1, 0, 0, 1, 0, 0, 1, 0, 0}, {0, 1, 0, 0, 1, 0, 0, 1, 0}, {0, 0, 1, 0, 0, 1, 0, 0, 1}} )

We can verify that all the rows of G are orthogonal to the rows of H by computing the following matrix multiplication;

G . Transpose[H] ;

MatrixForm[Mod[%, 2]]

( {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}} )

(This works because each entry in that product comes from a dot product with a row of G with a column of H^t , and the columns of H^t are the rows of H.)

14.B

G = {{1, 1, 1, 0, 0, 0}, {0, 1, 1, 1, 1, 0}, {1, 0, 1, 0, 1, 1}} ;

MatrixForm[G]

( {{1, 1, 1, 0, 0, 0}, {0, 1, 1, 1, 1, 0}, {1, 0, 1, 0, 1, 1}} )

Because the rows of G are linearly independent (which you can see by inspection, or by row reduction, as we'll show in a second), this is a true generating matrix of size 3x6, so it generates a [6,3] code.

The standard form of the matrix can be found as follows.  I'll call this matrix G2.

G2 = RowReduce[G, Modulus2] ;

MatrixForm[G2]

( {{1, 0, 0, 1, 1, 0}, {0, 1, 0, 0, 1, 1}, {0, 0, 1, 1, 0, 1}} )

This is in the form [ I A ], so the check matrix is [ -A^t I ] and will have size (n-k)x n = 3x6.

H = {{1, 0, 1, 1, 0, 0}, {1, 1, 0, 0, 1, 0}, {0, 1, 1, 0, 0, 1}} ;

MatrixForm[H]

( {{1, 0, 1, 1, 0, 0}, {1, 1, 0, 0, 1, 0}, {0, 1, 1, 0, 0, 1}} )

By inspection, none of the columns in H are the same, and they're all nonzero.  Hence by the theorem on p234 (and the special-case corollary on p235), the minimum distance is at least 3 and it can correct at least one error.  In fact that's all that it can correct, because there are three columns which are linearly dependent.  (For example, the first three columsn added together give 0.)  So the minimum distance is exactly 3.

The syndrome corresponding to 0 transmission errors should always be 0:

{{0, 0, 0, 0, 0, 0}} . Transpose[H]//MatrixForm

( {{0, 0, 0}} )

The syndromes for single digit errors are calculated by e H^t:

Print["Error Vector            Syndrome"]

Table[{MatrixForm[{RotateRight[{1, 0, 0, 0, 0, 0}, i]}], MatrixForm[{RotateRight[{1, 0, 0, 0, 0, 0}, i]} . Transpose[H]]}, {i, 0, 5}]//TableForm

Error Vector            Syndrome

( {{1, 0, 0, 0, 0, 0}} ) ( {{1, 1, 0}} )
( {{0, 1, 0, 0, 0, 0}} ) ( {{0, 1, 1}} )
( {{0, 0, 1, 0, 0, 0}} ) ( {{1, 0, 1}} )
( {{0, 0, 0, 1, 0, 0}} ) ( {{1, 0, 0}} )
( {{0, 0, 0, 0, 1, 0}} ) ( {{0, 1, 0}} )
( {{0, 0, 0, 0, 0, 1}} ) ( {{0, 0, 1}} )

To decode the first word:

y = {0, 1, 1, 0, 1, 1} ;

Mod[{y} . Transpose[H], 2]//MatrixForm

( {{1, 0, 1}} )

So the error vector is 001000 and the corrected word is

{y - {0, 0, 1, 0, 0, 0}}//MatrixForm

( {{0, 1, 0, 0, 1, 1}} )

The syndrome for the second word is

y = {1, 1, 0, 1, 1, 0} ;

Mod[{y} . Transpose[H], 2]//MatrixForm

( {{0, 1, 1}} )

Which corresponds to an error in the second bit, so the corrected word is 100110.

17.06

In class I called this type of matrix "Vandermonde (1st Version)," and you can find its determinant using the amazing theorem on page 278.  Here's the correct answer (Mathematica is just doing number crunching here, nothing amazing):

vars = {5, 6, 7, 8} ;

M = {vars^0, vars^1, vars^2, vars^3} ;

MatrixForm[M]

Det[M]

( {{1, 1, 1, 1}, {5, 6, 7, 8}, {25, 36, 49, 64}, {125, 216, 343, 512}} )

12


Created by Mathematica  (December 16, 2006) Valid XHTML 1.1!