```HOMEWORK #10

Read first 5 sections of Notes on Linear Sequential Circuits, now
posted on the class website.

Problems:

In all these problems, + means XOR

1. Solve the following set of linear equations for the Xs in terms of the Zs.

Z1 = X1 + X3
Z2 = X1 + X2
Z3 = X1 + X2 + X3

Z=AX, where Z and X are column vectors and A is the matrix
101
110
111

Convert A to the identity matrix by a series of row operations,

101 r3=r3+r2  101 r1=r1+r3  100 r2=r2+r1  100
110           110           110           010
111           001           001           001

Apply the same sequence of row operations to the I matrix to obtain
the inverse.

100 r3=r3+r2  101 r1=r1+r3  111 r2=r2+r1  111
010           010           010           101
001           011           011           011

So, from the final matrix we obtain:
X1=Z1+Z2+Z3
X2=Z1+   Z3
X3=   Z2+Z3

2. Find all the null sequences of each of the following polynomials
(D3 means the 3rd power of D, represented also as D^3, etc.)
(a) D3 + D + I
Z=(I+D+D3)X=0
X=DX+D3X
Start with any initial sequence of 3 bits, excluding 000.  Then use
the recursion formula X=DX+D3X to generate the continuation of the
sequence bit by bit until the initial sequence is repeated (or, we
could stop if the sequence length reaches 7)
Starting with 001 we obtain: 0011101001, so the period is (0011101).
This is an m-sequence so we need go no further.

(b)  D4 + D3 + D2 + D + I.  The recursion formula here is
X=DX+D2X+D3X+D4X.
Starting with 0001 we obtain:
000110001, so we have one sequence (00011)
Choose another starting sequence of length 4 not in the above
sequence.

010100101...   (01010)

Choose another starting sequence not in either of the above sequences.
0111101111...  (01111)
Now we have used all 15 non-zero subsequences of length 4
(alternatively, we can say that the total length of all the sequences
found is 5+5+5=15.  So we have them all.  This prime polynomial is NOT
an m-polynomial and it has the 3 null sequences, (00011), (01010),
(01111)

3. Find the polynomial for which the following is the m-sequence
(maximal length null sequence).  1 1 0 0 0 1 0 0 1 1 0 1 0 1 1.

Since the sequence length is 15, which is 2^4 -1, the polynomial must
be of degree 4.  So the form is: D4+a3D3+a2D2+a1D+I, and we need to
find the values of the coefficients a3, a2, a1.
At every point in the sequence, the following equation must be
satisfied:  D4X+a3D3X+a2D2X+a1DX+X.
Find a length 5 subsequence of sequence beginning and ending with 0
and containing only one 1.  This will identify a coefficient that must
be a 0.  One such subsequence is 00100.  It gives us the equation:
0 + a3x0 + a2 + a1x0 + 0 = 0, which tells us that a2 must be 0.  A
second such equation can be derived from the subsequence 00010, which
generates the equation 0 + a3x0 + 0 + a1 + 0 = 0, which tells us that
a1=0. If we know that the sequence is an m-sequence, then we can
assume that a3=1, else the polynomial would be D^4 + I, which cannot
be an m-polynomial because it has and even number of terms and is thus
divisible by D+I so that it is not prime (being prime is a necessary,
but not sufficient condition for a polynomial to be an
m-polynomial).  If we are not sure that the polynomial is an
m-polynomial, then we could assume a3=1 and then find the m-sequences
of the resulting polynomial, which is D4+D3+I.  Or, we could identify
a3 directly from the subsequence 01001, which gives us the equation,
0+a3+0+0+1=0.  From this it is clear that a3=1.  In order to verify
that the D4+D3+I is an m-polynomial, we must then either generate the
null-sequences directly from it and then check to see if it has an
m-sequence that is the same as the given sequence, or else check all
consecutive subsequences of length 5 of the given m-sequence to see if
it the polynomial equation yields a 0 for each.

4. Factor the following polynomials: (a) D6 + D4 + I

All exponents of this polynomial are even numbers, so it is a
"square", namely, (D3+D2+I)^2  (check this out by multiplication).
D3+D2+I is prime, so we need go no further.

(b) D5 + D4 + D2 + I
This polynomial has an even number of terms, so it is divisible by
D+I.
Divide by D+I as below:

D4 +      D + I
------------------
D+I|D5 + D4 + D2 + I
D5 + D4
----------------
D2 + I
D2 + D
------
D+I
D+I
---
0
So we have D5 + D4 + D2 + I = (D+I)(D4 +  D + I)
We cannot factor any further because (D4 +  D + I) is an m-polynomial,
which is not hard to determine by simply generating the m-sequence.

5. Show that if S is any m-sequence, then S^R, (S written backwards)
is also an m-sequence.  Indicate how the corresponding polynomials are
related.

Consider the polynomial P= D3 + D + I.  This is an m-polynomial.  We
can represent it by a vector indicating the coefficient values
starting with that of the D3 term.  This gives us 1011.  The null
sequence of P is S = (1110100).  If we match 1011 against any length-4
subsequence of S, the number of matching 1's will always be even.  For
example, in 1110, the only matching 1's are the first and third.  In
0011 the third and 4th 1's match.  In 0100 there are no matching 1's.
This is a necessary and sufficient condition for the sequence to be a
null sequence of the polynomial.  If we reverse both S and P
(obtaining 1101 or D3 + D2 + I) the same applies.  So if any sequence
is an m-sequence corresponding to some polynomial P, the reverse of
the sequence is an m-sequence of the polynomial that is the reverse of
P.
```