Professional Documents
Culture Documents
N T S
Yun Chen
Department Communication Systems
Room: BA 235, Phone: -1051, eMail: chen@nts.uni-due.de
NTS/IW Exercise problems for Page
UDE Coding Theory 1/57
Solution Problem 1
The discrete information source has a source alphabet X = {x1 , x2 , x3 }. To transmit the
symbols of the information source via a binary channel, the symbols are binary coded.
That means that a unique binary codeword is assigned to each symbol of the information
source.
The goal for source coding is to find a code that
• minimizes the lengths of the binary codewords to reduce the redundancy of the
code
1.1 The information content I(xi ) of a symbol xi with the probability of occurrence
p(xi ) is defined as
1
I(xi ) = ld = −ld (p(xi )) (1)
p(xi )
= − log2 (p(xi ))
log10 (p(xi )) log (p(xi ))
= − =− (2)
log10 (2) log (2)
So, the lower the probability of occurrence of a symbol is, the greater the information
content is and vice versa.
The unit of the information content is bit .
symbol
Using the given probability of occurrence of the symbols x1 , x2 and x3 yields:
bit
x1 : p(x1 ) = 0.2 =⇒ I(x1 ) = − log(0.2)
log(2)
= 2.32 (3)
symbol
bit
x2 : p(x2 ) = 0.1 =⇒ I(x2 ) = − log(0.1)
log(2)
= 3.32 (4)
symbol
bit
x3 : p(x3 ) = 0.7 =⇒ I(x3 ) = − log(0.7)
log(2)
= 0.51 (5)
symbol
1.2 The entropy of the information source is a measure for the average information
content of the source. The definition of the entropy of the source with N symbols
x1 , x2 , . . . , xN is:
H(X) = hI(xi )i
XN
= p(xi ) I(xi ) (6)
i=1
N
X 1
= p(xi ) ld (7)
i=1
p(xi )
1.3 The redundancy of the source Rs is a measure for the difference between the number
of binary decisions H0 that are necessary to select a symbol of the source (without
taking the probability of the symbols into account) and its entropy H(X).
Rs = H0 − H(X)
H0 = ld(N )
This is the maximum value for the entropy of an information source with N symbols
that are equiprobable.
The given source with N = 3 symbols yields:
bit
H0 = ld(3) = 1.58
symbol
So, the redundancy of the source is:
bit bit
Rs = 1.58 − 1.16 = 0.42
symbol symbol
1.4 Shannon- and Huffman-Code are codes, that fulfill the Shannon-Coding-Theorem:
“For every given information source with the entropy H(X), it is possible to find a
binary prefix-code, with an average codeword length L, with:”
Thereby, a prefix code is a code, where each codeword is not the beginning of ano-
ther codeword.
(d) Calculate the accumulated probability P (xi ) of every symbol. The ac-
cumulated probability is the sum of the probabilities of all previously
observed symbols in the sorted list.
(e) The code for the symbol xi is the binary value of the accumulated proba-
bility P (xi ), cut after L(xi ) digits.
Using this schematical way yields:
xi p(xi ) P (xi ) I(xi ) L(xi ) 2−1 2−2 2−3 2−4 2−5 2−6
x3 0.7 0 0.52 1 0 0 0 0 0 0
x1 0.2 0.7 2.32 3 1 0 1 1 0 0
x2 0.1 0.9 = 0.7 + 0.2 3.32 4 1 1 1 0 0 1
The symbol with the maximum probability has the minimum codewordlength
and vice versa.
The Shannon-Code is not the optimal code, because not all possible end points
of the codewordtree are used.
0 1
x3
0 1
0 1 0 1
x1
0 1 0 1 0 1
STEP 1. The symbols are sorted by their probabilities, such that the probabilities
decrease.
xi x3 x1 x2
p(xi ) 0.7 0.2 0.1
Code
STEP 2. A “1” is assigned to the symbol with the minimum probability and a
“0” is assigned to second smallest probability
xi x3 x1 x2
p(xi ) 0.7 0.2 0.1
Code 0 1
STEP 3. The two symbols with the minimum probability are combined to a
new pair of symbols. The probability of the new pair of symbols is the sum of the
single probabilities.
xi x3 x1 x2
p(xi ) 0.7 0.3 = 0.1 + 0.2
Code 0 1
xi x3 x1 x2
p(xi ) 0.7 0.3
Code 0 1
The assignment of “0” and “1” to combined symbols has to be made for every
symbol contained in the combined symbols. The assignment is made
from the left side.
xi x3 x1 x2
p(xi ) 0.7 0.3
Code 0 10 11
xi x3 x1 x2
p(xi ) 1.0 = 0.7 + 0.3
Code 0 10 11
The symbol with the maximum probability got the minimum codewordlength
and vice versa.
The Huffman-Code is called “optimal code”, because all possible end points
of the codewordtree are used.
0 1
x3
0 1
x1 x2
1.5 The redundancy of a code RC is a measure for the difference of the average code-
wordlength of the code L and the entropy of the information source H(X)
Rc = L − H(X)
• Shannoncode
bit
LShannon = 0.2 · 3 + 0.1 · 4 + 0.7 · 1 = 1.7
symbol
bit bit
=⇒ RCShannon = 1.7 − 1.16 = 0.54
symbol symbol
• Huffmancode
bit
LHuf f man = 0.2 · 2 + 0.1 · 2 + 0.7 · 1 = 1.3
symbol
bit bit
=⇒ RCHuf f man = 1.3 − 1.16 = 0.14
symbol symbol
So, the “optimal” Huffman-Code got a significantly smaller redundancy than the
Shannon-Code.
Solution Problem 2
The information source that is used in exercise 1 created the symbols statistically inde-
pendently. Thus, the probability of a sequence of two specific symbols xi , xj is:
In this case, the probability of a symbol xi under the condition that the previous trans-
mitted symbol xj is known is just the probability of the symbol xi
Now, the information source is more realistic. It creates the symbols statistically depen-
dently. This means, that the probability of the current transmitted symbol xi is different,
if the sequence of the previous transmitted symbol changes.
Generally, the probability of the current symbol xi depends on the knowlegde of the
previous transmitted sequence of symbols {xj , xk , xl , . . .} and the probability for this
sequence.
p(xi , xj , xk , xl , . . .) = p xi {xj , xk , xl , . . .} ·p {xj , xk , xl , . . .} (19)
| {z }
transition probability
Usually and also in this case the information source is a Markov source 1st order. This
means: Only the knowledge of the last transmitted symbol is necessary to determine the
transition probability. Thus, the probability of the current symbol xi depends only on
the knowledge of the last transmitted symbol xj and the probability for this symbol.
p xi {xj , xk , xl , . . .} = p(xi |xj )
N
X N
X
p(xi ) = p(xi , xj ) = p(xi |xj ) · p(xj ) (20)
j=1 j=1
N
X
p(xi |xj ) = 1 (21)
i=1
2.1 The Markov diagram is shown below. The given probabilities are marked bold.
p(x1 |x1 ) = 0
x1
p(x2 |x3 ) = 0
p(x2 ) = p(x2 |x1 ) · p(x1 ) + p(x2 |x2 ) · p(x2 ) + p(x2 |x3 ) · p(x3 )
= p(x2 |x1 ) · p(x1 )
p(x2 ) 0.1
=⇒ p(x2 |x1 ) = = = 0.5 (II)
p(x1 ) 0.2
( x3 , x1 , x ,x , x ,x , ··· )
| {z } | 3{z }2 | 3{z }2
zn zn−1 zn−2
↑ ↑ ↑
current last last before
symbol symbol last symbol
3 X
3
X 1
H(X, Y ) = p(xi , xj ) · ld
i=1 j=1
p(xi , xj )
p(x1 , x1 ) = 0 · 0.2 = 0
p(x1 .x2 ) = 0.8 · 0.1 = 0.08
p(x1 , x3 ) = 0.171 · 0.7 = 0.12
p(x2 , x1 ) = 0.5 · 0.2 = 0.1
p(x2 , x2 ) = 0 · 0.1 = 0
p(x2 , x3 ) = 0 · 0.7 = 0
p(x3 , x1 ) = 0.5 · 0.2 = 0.1
p(x3 , x2 ) = 0.2 · 0.1 = 0.02
p(x3 , x3 ) = 0.829 · 0.7 = 0.58
Definition: xi =
ˆ current transmitted symbol of the sequence
xj =
ˆ last transmitted symbol of the sequence
xk =
ˆ last before last transmitted symbol of the sequence
xl =
ˆ symbol,that was transmitted before xk
=⇒ zn = {xi , xj } =
ˆ current transmitted pair of symbols
=⇒ zn−1 = {xk , xl } =
ˆ last transmitted pair of symbols
coding using: p(zn |zn−1 ) = p({xi , xj }|{xk , xl })
= p({xi , xj }|xk )
p(xi , xj , xk )
=
p(xk )
p(xi |{xj , xk }) · p(xj , xk )
=
p(xk )
= p(xi |{xj , xk }) · p(xj |xk )
= p(xi |xj ) · p(xj |xk )
The codeword for the pair of symbols zn = {xi , xj } depends on the symbol xk , that
was transmitted before {xi , xj }
Solution Problem 3
N
X
pk (xi ) = pk (xi |xj ).pk−1 (xj )
j=1
=⇒ wk = wk−1 · P
Here:
Stationary 1st order Markov source in the steady state (Source was switched on a
long time ago), so the probability for a symbol does not depend anymore on the
state k.
=⇒ k −→ ∞
=⇒ pk (xi ) = pk−1 (xi ) = p(xi )
=
ˆ wk = wk−1 = w
The matrix equation can be rewritten by using the steady state probabilities wi =
p(xi ) as:
w = w·P
=⇒ (w1 , w2 , w3 , w4 ) = (w1 , w2 , w3 , w4 ) · P
The transition matrix P can be obtained by using the given Markov diagram:
zn x1 x2 x3 x4
zn−1
x1 0.75 0.25 0 0
x2 0 0.75 0.25 0
x3 0 0 0.5 0.5
x4 0.5 0 0 0.5
0.75 0.25 0 0
0 0.75 0.25 0
=⇒ P=
0
0 0.5 0.5
0.5 0 0 0.5
The steady state probabilities wi = p(xi ) can be obtained by evaluating the ma-
trix equation and using the normalization property of probabilities (sum over all
probabilities equals one):
3 1
w1 = w1 + w4 =⇒ w1 = 2w4
4 2
1 3
w2 = w1 + w2 =⇒ w2 = w1 = 2w4
4 4
1 1 1
w3 = w2 + w3 =⇒ w3 = w2
4 2 2
1 1
w4 = w3 + w4 =⇒ w3 = w4
2 2
w1 + w2 + w3 + w4 = 1
=⇒ 2w4 + 2w4 + w4 + w4 = 1
1
=⇒ w4 = p(x4 ) =
6
1
=⇒ w3 = p(x3 ) =
6
1
=⇒ w2 = p(x2 ) =
3
1
=⇒ w1 = p(x1 ) =
3
3.2 The steady state entropy is the expected value over all conditional entropies:
Solution Problem 4
Lempel Ziv algorithm : Source encoding without knowing the statistical proper-
ties of the information source like: type of source, pro-
babilities of symbols, transition probabilities ...
input of the encoder : Sequence of symbols
(output of the information source)
Encoding is done by using the repetitions of subsequences within the input sequence
to encode the input sequence
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
input
sequence
sliding window
Algorithm searches for repetitions of subsequences in the search buffer within the look
ahead buffer.
It transmits codewords c containing the starting position of the subsequence in the search
buffer, the number of repetitions and the next symbol after the repetition sequence in
the look ahead buffer instead of the whole input sequence.
General definitions:
Size of sliding window is : n
Length of look ahead buffer : Ls
=⇒ Length of search buffer: n − Ls
N = 8
n = 16
Ls = 8
• At the beginning of the encoding procedure, the search buffer is filled up with
’0’.
• The input sequence is shifted into the look ahead buffer and the algorithm
searches for subsequences within the search buffer that match to the beginning
sequence of the look ahead buffer. The longest repetition sequence is used. If
there are two or more repetition sequences with the same maximum length,
one is chosen arbitrarily. The repetition sequence starting in the search buffer
can overlap into the look ahead buffer.
• The codeword is determined and the input sequence is shifted by (number of
repetition symbols +1 ) into the sliding window.
• ...
starting position
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
0 0 0 0 0 0 0 0 0 0 4 0 4 0 5 3
repetition sequence encoded sequence
c1 = {5, 2, 4}
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
0 0 0 0 0 0 0 4 0 4 0 5 3 4 0 5
c2 = {6, 3, 5}
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
0 0 0 4 0 4 0 5 3 4 0 5 4 0 5 7
c3 = {2, 0, 3}
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
0 0 4 0 4 0 5 3 4 0 5 3 4 0 5 7
c4 = {4, 7, 7}
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
4 0 5 3 4 0 5 7 5 1
c5 = {2, 1, 1}
So, the encoder uses 5 code words with 3 symbols each (altogether 15 symbols) to
encode an input sequence of 18 symbols. The performance of the encoder improves,
if there are many repetitions within the input sequence.
• At the beginning of the decoding procedure, the search buffer is filled up with
’0’ and the look ahead buffer is empty.
• The codeword to be decoded tells the starting position, the length of the
repetition sequence and the next symbol. Using this information, the repetition
sequence together with the next symbol is written into the look ahead buffer.
This is the decoded sequence.
• The symbol sequence is shifted into the search buffer such that the look ahead
buffer is empty.
• ...
starting position
c1 = {5, 2, 4}
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
0 0 0 0 0 0 0 0 0 0 4
repetition sequence decoded sequence
c2 = {6, 3, 5}
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
0 0 0 0 0 0 0 4 0 4 0 5
c3 = {2, 0, 3}
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
0 0 0 4 0 4 0 5 3
c4 = {4, 7, 7}
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
0 0 4 0 4 0 5 3 4 0 5 3 4 0 5 7
c5 = {2, 1, 1}
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
4 0 5 3 4 0 5 7 5 1
Solution Problem 5
5.1
The probabilities for the input symbols are:
p(x1 ) = p1
p(x2 ) = 1 − p(x1 ) = 1 − p1
Using the transition probabilities one get probabilities for the output symbols:
p(y1 ) = p(x1 ) · p(y1 |x1 )
= p1 · (1 − perr )
p(y2 ) = (1 − p1 ) · (1 − perr )
p(y3 ) = p1 · perr + (1 − p1 ) · perr = perr
The information flow is the output entropy minus the information added on the
channel.
T (X, Y ) = H(Y ) − H(Y |X)
Using the definition of the output entropy and the probabilities for the output
symbols:
3
X 1
H(Y ) = p(yi ) · ld
i=1
p(yi )
1
= p1 · (1 − perr ) · ld
p1 · (1 − perr )
1
+(1 − p1 ) · (1 − perr ) · ld
(1 − p1 ) · (1 − perr )
1
+perr · ld
perr
1 1
= p1 · (1 − perr ) · ld + ld
p1 1 − perr
1 1
+(1 − p1 ) · (1 − perr ) · ld + ld
1 − p1 1 − perr
1
+perr · ld
perr
1 1
H(Y ) = (1 − perr ) · p1 · ld − ld
p1 1 − p1
1 1 1
+perr · ld − ld − ld
perr 1 − p1 1 − perr
1 1
+ld + ld
1 − p1 1 − perr
Using the output entropy and the irrelevance, the transinformation flow can be
determined:
1 1
=⇒ T (X, Y ) = (1 − perr ) · p1 · ld − ld
p1 1 − p1
1 1 1
+perr · ld − ld − ld
perr 1 − p1 1 − perr
1 1
+ld + ld
1 − p1 1 − perr
1 1 1
− perr · ld − ld + ld
perr 1 − perr 1 − perr
1 1
= (1 − perr ) · p1 · ld − ld
p1 1 − p1
1 1
+perr · −ld + ld
1 − p1 1 − p1
1 1 1
= (1 − perr ) · p1 · ld − ld + ld
p1 1 − p1 1 − p1
1 1
= (1 − perr ) · p1 · ld + (1 − p1 ) · ld
p1 1 − p1
= −(1 − perr ) · [p1 · ld (p1 ) + (1 − p1 ) · ld (1 − p1 )]
5.2
The channel capacity is the maximum transinformation flow with respect to the
probabilities of the input symbols:
1
C = · max T (X, Y )
∆T p(xi )
∂ !
T (X, Y ) = T ′ (X, Y ) = 0
∂p1
"
1 1
T ′ (X, Y ) = −(1 − perr ) · ld (p1 ) + p1 · ·
p1 ln(2)
#
1 1
−ld (1 − p1 ) − (1 − p1 ) ·
1 − p1 ln(2)
1 1
= −(1 − perr ) · ld (p1 ) + − ld (1 − p1 ) −
ln(2) ln(2)
!
= −(1 − perr ) · [ld (p1 ) − ld (1 − p1 )] = 0
!
=⇒ ld (p1 ) = ld (1 − p1 )
=⇒ p1 = 1 − P1
1
=⇒ p1 =
2
T (X, Y ) = (1 − perr )
1
p1 = 2
1
=⇒ C = (1 − perr ) ·
∆T
symbol
The source emitts symbols with a symbol rate Rsymbol , [Rsymbol ] = . So,
second
the information flow of the source is:
bit
R = H(X̂) · Rsymbol = 1.16 · Rsymbol
symbol
1
The channel capacity of the binary erasure channel is C = (1 − perr ) · ∆T where
1
∆T = Rbinary,c is the binary symbol period after source and channel encoding (so it
is the binary symbol period of the transmission via the channel) .
symbols
With Perr = 0.1 and the binary symbol rate over the channel of Rbinary,c = 1000 second
the channel capacity is:
C = (1 − perr ) · Rbinary,c
bit
= 900
second
So, the information flow of the source must be less than 900 bit .
second
bit bit
R = 1.16 · Rsymbol ≤ C = 900
symbol second
900 bit
−→ Rsymbol = second
1.16 bit
symbol
symbol
= 775.862
second
Solution Problem 6
c = u·G
Each information word corresponds to a unique code word and vice versa.
The number of rows of the generator matrix is the number of information bits k
of the information words, the number of columns of the generator matrix is the
number of code word bits n of the code words.
=⇒ k = 3
=⇒ n = 7
=⇒ N = 2k = 23 = 8 code words
k 3 Number of information bits
code rate =⇒ Rc = = = 0.43 =
ˆ ratio
n 7 Number of code word bits
With the information word u = u0 u1 u2 , the matrix multiplication is as follows:
c = u·G
1 1 0 1 0 0 1
c = u0 u 1 u2 · 1 0 1 0 0 1 1
1 1 1 0 1 0 0
= u0 · 1 1 0 1 0 0 1 +
| {z }
1 row of G
st
u1 · 1 0 1 0 0 1 1 +
| {z }
2nd row of G
u2 · 1 1 1 0 1 0 0
| {z }
3rd row of G
n
z
}| {
1 1 0 1 0 0 1
k 1 0 1 0 0 1 1 =G
1 1 1 0 1 0 0 wH (ci )
u0 = 0 0 0 0 0 0 0 0 0 0 = c0 0
u1 = 0 0 1 1 1 1 0 1 0 0 = c1 4
u2 = 0 1 0 1 0 1 0 0 1 1 = c2 4
u3 = 0 1 1 0 1 0 0 1 1 1 = c3 4
u4 = 1 0 0 1 1 0 1 0 0 1 = c4 4
u5 = 1 0 1 0 0 1 1 1 0 1 = c5 4
u6 = 1 1 0 0 1 1 1 0 1 0 = c6 4
u7 = 1 1 1 1 0 0 1 1 1 0 = c7 4
6.2 The minimun distance dmin of the code is the minimun number of digits, in which
two code words are different. It is shown in the lecture that the minimum distance
equals the minimum weight of the code words.
=⇒ number of errors in code words that can be detected at the decoder side:
te = dmin − 1 = 3
dmin −2
2
dmin is even
t =
dmin −1
2
dmin is odd
G −→ G′ G′ = k × n − matrix
c −→ c′
The generator matrix of the systematic code G′ has the following structure:
.
G′ = Ik .. P Ik : Identity matrix (k × k)
P : Parity bit matrix ( k × (n − k) )
1 0 0
I3 = 0 1 0
0 0 1
The rows of G′ are generated by combinations of the rows of G, such the first part
of the G′ is the identity matrix Ik
.
(1 + 2 + 3 ) row of G −→ 1
st nd rd 0 0 .. 1 1 1 0
. ′
(2nd + 3rd ) row of G −→ 0 1 0 .. 0 1 1 1
=G
(1st + 3rd ) row of G −→ .
0 0 1 .. 1 1 0 1
So, for the given code the parity bit matrix P is:
1 1 1 0
P= 0 1 1 1
1 1 0 1
The code words of the systematic code are obtained by the matrix equation:
c′ = u · G′
.
1 0 0 .. 1 1 1 0
G′ = ..
0 1 0 . 0 1 1 1
..
0 0 1 . 1 1 0 1
.
ua = (1 0 1) ( 1 0 1 .. 0 0 1 1 ) = c′a
| {z } | {z }
=ua parity check bits
..
ub = (0 1 1) ( 0 1 1 . 1 0 1 0 ) = c′b
| {z } | {z }
=ub parity check bits
Generation of H′
.
G′ = ( Ik .. P ) generator matrix
.
H′ = ( PT .. In−k ) parity check matrix
1 0 1
1 1 1 0 1 1 1
P = 0 1 1 1 −→ PT =
1
1 0
1 1 0 1
0 1 1
..
1 0 1 .
..
1 0 0 0
′ 1 1 1 . 0 1 0 0
=⇒ H = ..
1 1 0 . 0 0 1 0
..
0 1 1 . 0 0 0 1
H′ is parity check matrix for code c and code c′ and equivalent codes (codes with
the same set of code words) !
6.5 Transmission model:
u G′ x y H′ x (errorfree)
channel
y = x + e
↑ ↑
code word error vector
Syndrome vector :
T
s = y · H′
T
= (x + e) · H′
T T T
H′ } +e · H′ = e · H′
= |x ·{z
0
step 2: check s
if s 6= 0 =⇒ search in table
a). s included in the table
=⇒ determine error vector e
b). s not included in the table
=⇒ more than t = 1 errors
=⇒ not correctable
1 1 1 0
0 1 1 1
1 1 0 1
H′ T =
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
ya = ( 0 0 0 1 1 0 1 ) ( 1 1 0 1 ) = sa
yb = ( 1 1 1 0 0 0 0 ) ( 0 1 0 0 ) = sb
yc = ( 1 0 0 0 1 0 0 ) ( 1 0 1 0 ) = sc
The according error vectors are obtained from the syndrome table.
sa = ( 1 1 0 1 ) =⇒ ea = ( 0 0 1 0 0 0 0 )
sb = ( 0 1 0 0 ) =⇒ eb = ( 0 0 0 0 1 0 0 )
sc = ( 1 0 1 0 ) =⇒ not included
=⇒ ya,corr = ya + ea = ( 0 0 1 1 1 0 1 )
yb,corr = yb + eb = ( 1 1 1 0 1 0 0 )
yc,corr =⇒ not correctable
6.7
T
s = y · H′
T
=⇒ ( s0 s1 s2 s3 ) = ( y0 y1 y2 y3 y4 y5 y6 ) · H′
s0 = y0 + y2 + y3
s1 = y0 + y1 + y2 + y4
=⇒ parity equations
s2 = y0 + y1 + y5
s3 = y1 + y2 + y6
Solution Problem 7
Generally, for a binary (n, k) block code with the capability to correct t errors yields:
t
X
k n
=⇒ 2 · ≤ 2n
i
i=0
t
X
k n
=⇒ 2 · = 2n
i
i=0
=⇒ All received words fall into the decoding spheres with a codeword in the center.
decoding sphere
t=2
dH = 5
For each decoding sphere there is a valid codeword in the center and there are other
words in it, which are in maximum t bits difference. Each received word that falls within
the decoding sphere is decoded with the codeword in the center.
=⇒ These invalid words can be different from the valid codeword in the center in
dH = 1 bit
dH = 2 bits
..
.
dH = t bits
Generally, if an invalid word has a difference of t bits from a codeword, t ”1”s have to be
distributed to n bits
n
=⇒ possible invalid words that are different from the codeword in t bits
t
invalid words
codeword z }| {
z }| { n n n
1 + + +... +
|{z} 1 2 t
n | {z } | {z } | {z }
different in 1 bit different in 2 bits different in t bits
0
k k
n n n n
2 codewords =⇒ 2 · + + + ... +
0 1 2 t
| {z }
=1
t
k
X n
= 2 · ≤ 2n
i |{z}
i=0 total number of vectors
| {z }
number of vectors within decoding spheres
t
k
X n
2 · ≤ 2n
i
i=0
given: k = 4, t = 1
k n n
2 · + = 2n
0 1
=⇒ 1 + n = 2n−k = 2m
=⇒ 1 + (m + k) = 2m
=⇒ 1 + k = 2m − m
=⇒ 2m − m = 5
m 2m − m
1 1
2 2
3 5
4 12
=⇒ m = 3, n = k + m = 4 + 3 = 7
syndrome: s = e · HT
=⇒ all n rows of HT are different and no row is the all zero vector
=⇒ use all different vectors si (except s = 0) for the columns of H
.
1 1 1 0 .. 1 0 0
=⇒H = ..
1 1 0 1 . 0 1 0
..
1 0 1 1 . 0 0 1
.
= P .. In−k
T
.
G = Ik .. P
..
1 0 0 0 .
..
1 1 1
0 1 0 0 . 1 1 0
=⇒G = ..
0 0 1 0 . 1 0 1
..
0 0 0 1 . 0 1 1
te = dmin − 1 = 2
Solution Problem 8
Notation of sum-construction of a code
Ga Ga
Gnew =
0 Gb
=⇒ RM (0, 0) =⇒ n = 1, k = 1, dmin = 1
=⇒ G00 = (1)
RM (0, 1) =⇒ n = 2, k = 1, dmin = 2
=⇒ G01 = (1 1)
General
r = 0 =⇒ k = 1, n = 2m , dmin = 2m
=⇒ repitition code =⇒ G0 m = ( |1 1 {z
· · · 1} )
2m
m
r = m =⇒ dmin = 1, n = 2
k = 2m (without proof) =⇒ n = k
1 0 ··· 0
0 1 · · · 0
m
=⇒ uncoded =⇒ Gmm = Im = .. .. . . .. 2
. . . .
0 0 ··· 1
| {z }
2m
RM (r + 1, m + 1) = RM (r + 1, m) & RM (r, m)
Gr+1,m Gr+1,m
=⇒ Gr+1,m+1 =
0 Gr,m
Construction by submatrices:
· · · 1} )
G0 = ( |1 1 {z
n=2m
m
G1 = m × 2 matrix
where the columns contain all possible words of the length m
Gl = each row is the vector product of l different rows of G1
For 8.4 : G23
G0
=⇒ G23 = G1
G2
G0 = ( 1 1 1 1 1 1 1 1 )
| {z }
n=2m
0 0 0 0 1 1 1 1 row 1
G1 = 0 0 1 1 0 0 1 1 m row 2
0 1 0 1 0 1 0 1 row 3
| {z }
n=2m
0 0 0 0 0 0 1 1 row 1 × row 2
G2 = 0 0 0 0 0 1 0 1 row 1 × row 3
0 0 0 1 0 0 0 1 row 2 × row 3
8.1
G12 G12
G13 =
0 G02
G02 = ( 1 1 1 1 )
1 0 1 0 1010
=⇒ G1,3 = 0 1 0 1 0101
0 0 1 1 0011
0 0 0 0 1111
8.2
G22 G22
G23 =
0 G12
G22 =?
r = 2, m = 2 =⇒ uncoded =⇒ k = 22 = 4 = n
1 0 0 0
0 1 0 0
=⇒ G22 = 0
0 1 0
0 0 0 1
1 0 0 0 1 0 0 0 1
0
1 0 0
0 1 0 0 2
0
0 1 0
0 0 1 0 3
=⇒ G23 = 0 0 0 1 0 0 0 1
4 k=7
0 0 0 0 1 0 1 0 5
0 0 0 0 0 1 0 1 6
0 0 0 0 0 0 1 1 7
| {z }
n=8
8.3 RM (2, 3) =⇒ r = 2, m = 3
r
m
X m 3 3 3
n = 2 = 8, k= = + +
i=0
i 0 1 2
3! 3!
= 1+ +
1!2! 2!1!
= 1+3+3=7
dmin = 23−2 = 2 = min wH (c) | c ∈ RM (2, 3)
c 6= 0
=⇒ 1 = a+c+d+g
2 = d+g
3 = c+g
4 = g
5 = b+f
6 = f
7 = e
By simply matrix conversions it can be shown that this is equivalent to the result
from 8.2.
Solution Problem 9
9.1
RM (1, 3) : r = 1, m = 3
r
X m 3 3
n = 2m = 8, k= = + = 4, dmin = 2m−r = 22 = 4
i 0 1
i=0
submatrix construction:
1 1 1 1 1 1 1 1
G0 0 0 0 0 1 1 1 1
G13 = =
G1 0 0 1 1 0 0 1 1
0 1 0 1 0 1 0 1
9.2
u = (1 0 0 1)
x = u · G13 = (1 0 1 0 1 0 1 0)
a.) x0 = u0
b.) x1 = u0 + u 3
c.) x2 = u0 + u 2
d.) x3 = u0 + u 2 + u 3
e.) x4 = u0 + u 1
f.) x5 = u0 + u 1 + u 3
g.) x6 = u0 + u 1 + u 2
h.) x7 = u0 + u 1 + u 2 + u3
n o n o
a.) + b.) =⇒ u3 = x0 + x1 a.) + c.) =⇒ u2 = x0 + x2
n o n o
c.) + d.) =⇒ u3 = x2 + x3 b.) + d.) =⇒ u2 = x1 + x3
n o n o
e.) + f.) =⇒ u3 = x4 + x5 e.) + g.) =⇒ u2 = x4 + x6
n o n o
g.) + h.) =⇒ u3 = x6 + x7 f.) + h.) =⇒ u2 = x5 + x7
n o
a.) + e.) =⇒ u1 = x 0 + x 4
n o
b.) + f.) =⇒ u1 = x 1 + x 5
n o
c.) + g.) =⇒ u1 = x 2 + x 6
n o
d.) + h.) =⇒ u1 = x 3 + x 7
These are the equations on which to apply a majority vote. After determination of
u1 , u2 , u3 , start to determine u0 :
v = x + (0 u1 u2 u3 ) · G13
n o
a.) =⇒ u0 = x 0
n o
b.) =⇒ u0 = x 1 + u3
n o
c.) =⇒ u0 = x 2 + u2
n o
d.) =⇒ u0 = x 3 + u2 + u 3
n o
e.) =⇒ u0 = x 4 + u1
n o
f.) =⇒ u0 = x 5 + u1 + u 3
n o
g.) =⇒ u0 = x 6 + u1 + u 2
n o
h.) =⇒ u0 = x 7 + u1 + u 2 + u 3
9.4
x = (1 0 1 0 1 0 1 0)
1 1 0 1 0)
y = (1 0 1 |{z}
error
u3 = y0 + y1 = 1
u3 = y2 + y3 = 0
majority vote: u3 = 1
u3 = y4 + y5 = 1
u3 = y6 + y7 = 1
u2 = y0 + y2 = 0
u2 = y1 + y3 = 1
majority vote: u2 = 0
u2 = y4 + y6 = 0
u2 = y5 + y7 = 0
u1 = y0 + y4 = 0
u1 = y1 + y5 = 0
majority vote: u1 = 0
u1 = y2 + y6 = 0
u1 = y3 + y7 = 1
now determine u0 :
v = y + (0 u1 u2 u3 ) · G13
1 1 1 1 1 1 1 1
0 0 0 0 1 1 1 1
= (1 0 1 1 1 0 1 0) + (0 0 0 1) ·
0
0 1 1 0 0 1 1
0 1 0 1 0 1 0 1
= (1 1 1 0 1 1 1 1)
=⇒ u0 = 1
=⇒
u = (1 0 0 1)
9.5 dmin = 4
td = dmin − 1 = 3 errors can be detected.
dmin −2
tc = 2
= 1 error can be corrected.
Solution Problem 10
7 codeword bits =⇒ g4 = 0, g5 = 0, g6 = 0
g0 g1 g2 g3 g4 g5 g6
1 1 0 1 0 0 0
0 1 1 0 1 0 0
=⇒ =G
0 0 1 1 0 1 0
0 0 0 1 1 0 1
10.2
ua = ( 0 1 1 0 )
=⇒ ca = ua · G
1 1 0 1 0 0 0
0 1 1 0 1 0 0
= (0110)·
0
0 1 1 0 1 0
0 0 0 1 1 0 1
= ( 0 1 0 1 1 1 0 )
ub = (1010)
=⇒ cb = ub · G
1 1 0 1 0 0 0
0 1 1 0 1 0 0
= (1010)·
0
0 1 1 0 1 0
0 0 0 1 1 0 1
= ( 1 1 1 0 0 1 0 )
Vector ua = ( 0 1 1 0 ) = ( u0 u1 u2 u3 )
x0 x1 x2 x3 | {z }
length k=4
Vector ub = ( 1 0 1 0 ) = ( u0 u1 u2 u3 )
polynomial =⇒ ub (x) = u0 · x0 + u1 · x1 + u2 · x2 + u3 · x3
= 1 + 0 · x1 + 1 · x2 + 0 · x3
= 1 + x2
∗ Coding by multiplication of the information polynomial
with the generator polynomial
x + x2 + x4 Modulo 2 summation
x2 + x3 + x 5
(1 + 1 = 0)
= x + x3 + x4 + x5
= 0 + 1 · x + 0 · x2 + 1 · x3 + 1 · x4 + 1 · x5 + 0 · x6
! ( Degree of polynomial : n − 1 = 6 ) !
⇒ ca = ( 0 1 0 1 1 1 0 )
1 + x + x3
2
x + x3 + x5
= 1 + x + x2 + x5
= 1 + 1 · x + 1 · x2 + 0 · x3 + 0 · x4 + 1 · x5 + 0 · x6
⇒ cb = ( 1 1 1 0 0 1 0 )
Non systematic coding : c(x) = u(x) · g(x)
ub = ( 1 0 1 0 )
x3 + 0 + x + 1 = g(x) · 1
4
x + 0 + x2 + x1 = g(x) · x
x5 + 0 + x3 + x2 = g(x) · x2
x7 + 0 + x5 + x4 = g(x) · x4
x7 + 0 + 0 + 0 + 0 + 0 + 0 + 1 = x7 + 1
⇒r=7
4 2
Proof: (x7 + 1) : (x3 + x + 1) = x
| + x {z+ x + 1}
h(x)
x7 + x5 + x4
x5 + x4 + 1
x5 + x 3
+ x 2
4 3
x + x + x2 + 1
x4 + x2 + x
x3 + x + 1
x3 + x + 1
0
Easier: write down only the coefficients:
( target: 1 0 0 0 0 0 0 1 )
x7 x6 x5 x4 x3 x2 x1 x0
1 0 1 1
1 0 1 1
1 0 1 1
1 0 1 1
1 0 0 0 0 0 0 1 ˆ 7+1
=x
Number of information bits k :
degree of g(x) = n − k = 3
=⇒ k = n − degree of g(x)
= 7−3=4
Solution Problem 11
Galois-field
Direct fields : GF (p) , p = prime number
Extended fields : GF (p m ) , p = prime number
m = integer number, m > 1
11.1
a 0 1 2 3 4
−a 0 4 3 2 1
a−1 x 1 3 2 4
a · (a−1 ) = 1 mod 5
a + (−a) = 0 mod 5
= i · 5 + 1 mod 5
= n · 5 mod 5
= 1; 6; 11; 16; mod 5
with (−a) ∈ GF(5)
with (a−1 ) ∈ GF(5)
Singelton-Bound
A0 1 1 1 1 a0
A1 1 z −1 z −2 z −3 a1
A2 = − 1 z −2 z −4 z −6
·
a2
A3 1 z −3 z −6 z −9 a3
with z =primitive
ˆ element
=⇒ z = 2
24 = 16 = 1 mod 5
z n = z 0 = 1 mod 5
To get rid of any negative exponent, one can add k (pm − 1) to the exponent without
changing the result
m mod (p m −1)
=⇒ z i = z [i+k·(p −1)]
here
with pm − 1 = 51 − 1 = 4
1 1 1 1
1 z −1 z −2 z −3
MDFT = −
1 z −2 z −4 z −6
1 z −3 z −6 z −9
1 1 1 1
1 z3 z2 z1
= − 1 z2 z0 z2
1 z1 z2 z3
1 1 1 1
1 3 4 2
z=2, modulo 5 calculation = − 1 4 1 4
1 2 4 3
4 4 4 4
4 2 1 3
inverse elements =
4 1 4 1
4 3 1 2
aT = MIDFT · AT
a0 1 1 1 1 A0
a1 1 z1 z2 z3 A1
a2 = 1 z 2
·
z 4 z 6 A2
a3 1 z3 z6 z9 A3
1 1 1 1
m 1 z1 z2 z3
z i = z i mod (p −1) ! =
1 z2
z0 z2
1 z3 z2 z1
1 1 1 1
1 2 4 3
=⇒ MIDFT = 1 4
1 4
1 3 4 2
11.5 Coding:
Codeword in frequency domain:
.
A = A0 A1 .. 0 0
= 2 3 0 0
=⇒ Code word in time domain:
aT = MIDFT · AT
1 1 1 1 2
1 2 3 3
4
=
1 ·
4 4 0
1
1 3 2 4 0
1 1 1 1
1
+3· 2 +0· 4 3
= 2·
1 4
+0·
1 4
1 3 4 2
5 0
8 3
=
14 mod 5 = 4
11 1
=⇒ transmitted codeword: a = 0 3 4 1
11.6
AT = MDFT · aT
4 4 4 4 0
4 2 3 3
1
=
4 ·
1 1 4
4
4 3 2 1 1
4 4 4 4
4 2 1 3
= 0·
4 +3· 1 +4·
+1·
4 1
4 3 1 2
32 2
13 3
20 mod 5 = 0
=
15 0
Problem 12
Considered is : RS (4, 2) over GF(5)
General : RS (n, k) over GF (pm )
here
12.1 r = a + e (modulo pm = 5 operation)
r is the received vector in the time domain
=⇒ r = ( 0 3 4 1 ) + ( 0 0 3 0 )
= ( 0 3 7 1 ) (without modulo 5 operation)
= (0321)
RT = MDFT · rT
4 4 4 4 0 0+2+3+4
4 2 1 3 3 0+1+2+3
= 4 1 4 1
·
2 = 0+3+3+1
4 3 1 2 1 0+4+2+2
| {z }
MDFT , determined
in problem 8
4
1
=
2
3
=⇒ R = ( 4 1 ... 2 3 )
Without error:
.
R = ( A0 A1 .. 0 0 )
| {z } | {z }
information “parity frequencies”
word length
length k n−k
Here (with error):
.
R = ( 4 1 .. 2 3)
|{z}
S = ( S0 S1 ) = ( 2 3 )
| {z }
n−k=2
General: R = A + E
A=ˆ Codeword in the frequency domain
A consists of 0 in the last (n − k) digits
=⇒ S consists of the last (n − k) digits of R
=
ˆ the last (n − k) digits of E
time domain: ci · ei = 0 =⇒ ci = 0 if ei 6= 0
b
r =⇒ ci = 0 if error occurs at position i
frequency domain: C(x) · E(x) = 0 mod (xn − 1)
⇒ x = z i ( z is primitive element ) is a zero, if an error
occurs at position
Q i
⇒ C(x) = ( x − zi )
i,ei 6=0
Matrix representation :
Se · · · S0 C0
0
.. . .. ..
..
! ..
2t−e . .
·
.
e+1 =
.
(∗)
S
2t−1 · · · S 2t−e−1
Ce
0
| {z }
e+1
=⇒ C(x) = 1 + 1 · x
if the matrix equation (∗) is not solvable for e = 1 =⇒ try e = 2, 3, 4 · · · t
if the matrix equation (∗) is not solvable at all =⇒ no correction possible
e
X
Ej = −(C0−1 ) · Ci mod n · E(j−i) mod n j = 0···k − 1
i=1
=⇒ E = ( 2 3 2 3 )
12.4
 = R “ − ” E = (4 1 2 3)−(2 3 2 3)
(modulo 5 operation)
= (4 1 2 3)+(3 2 3 2)
= (7 3 5 5)
= (2 3 0 0)
Problem 13
Denotation of convolutional codes:
Information blocks
ur = (ur,1 , ur,2 , ur,3 , . . . , ur,k )
: actual block
ur−1 = (ur−1,1 , ur−1,2 , ur−1,3 , . . . , ur−1,k ) : previous block
length k ur−2 = (ur−2,1 , ur−2,2 , ur−2,3 , . . . , ur−2,k ) : before previous block
..
. :
Code block
Memory length
m is the memory length =
ˆ number of information blocks of the past that are used to
create ar .
13.1 Here
=⇒ m = 1
ar = (ar,1 , ar,2 )
=⇒ n = 2
• Coderate:
k 1
RC = =
n 2
1 (10)
0 (00) 0 1 1 (01)
0 (11)
Input Output
For example: Consider the highlighted values: they are obtained from the 2nd row
of the state table
If the actual state of the encoder is ’1’ and the input is ’0’ then the output is ’11’
and the next state will be ’0’.
13.3 The Trellis diagram describes also the states of the encoder, but with a temporal
approach.
• The starting state is always the zero state.
• The reaction of the encoder (output, next state) at the actual state to every
possible input is determined.
• Then the next state is considered and again the reaction of the encoder (output,
next state) at the actual state to every possible input is determined.
• And so on . . .
1(
1(
1(
1(
1(
10
10
10
10
10
)
)
1)
1)
1)
1)
0(1
0(1
0(1
0(1
1 1 1 1 1 1
1(01) 1(01) 1(01) 1(01)
0 1 2 3 4 5 time
• starting at zero state and ending at zero state, without being in the zero state
in between.
• Not all zero state way!
• The way has to be chosen that the number of ’1’ at the output is minimized.
1(
1(
1(
1(
10
10
10
10
10
)
)
1)
1)
1)
1)
0(1
0(1
0(1
0(1
1 1 1 1 1 1
1(01) 1(01) 1(01) 1(01)
0 1 2 3 4 5 time
Every different way, that starts at zero state and ends at zero state (except all zero
state way) has got a higher number of ’1’ at the output.
The free distance df is the number of ’1’ at the output using the fundamental way,
so that it is the distance to the all zero sequence.
=⇒ df = 3
The free distance is a measure for the capability to correct errors. The higher df ,
the higher is the capability to correct errors.
13.5 Every segment is terminated with a single ’0’. So, the sequence, that has to be
encoded is:
Termination
z}|{
1| 0{z1 1} | 0
u
The according way in the Trellis diagram is highlighted in the following diagram.
1(
1(
1(
1(
10
10
10
10
10
)
)
)
)
)
)
1)
1)
11
11
0(1
0(1
0(
0(
1 1 1 1 1 1
1(01) 1(01) 1(01) 1(01)
0 1 2 3 4 5 time
Terminated
uncoded sequence 1 0 1 1 0
encoded 1 0 1 1 1 0 0 1 1 1
• Finally, the way with the highest number of matches is used and retraced to
the beginning of the trellis diagram.
received
sequence a 10 10 10 00 11
1(
1(
1(
1(
3 4 5 8
10
10
10
10
10
)
)
1)
1)
1)
1)
0(1
0(1
0(1
0(1
2 3 5 5 7
1 1 1 1 1 1
1(01) 2 1(01) 3 1(01) 6 1(01) 7
decoded 1 0 1 1 0
corresponding codeword 1 0 1 1 1 0 0 1 1 1
received word 1 0 1 0 1 0 0 0 1 1
So, 2 bit errors are corrected, at 4th digit and 8th digit.