Coding Theory Book
Coding Theory Book
Coding Theory Book
This chapter is based on lecture notes from coding theory courses taught by Venkatesan Guruswami at University at Washington and CMU; by Atri Rudra at University at Buffalo, SUNY
and by Madhu Sudan at MIT.
This version is dated July 16, 2014. For the latest version, please go to
http://www.cse.buffalo.edu/ atri/courses/coding-theory/book/
The material in this chapter is supported in part by the National Science Foundation under
CAREER grant CCF-0844796. Any opinions, findings and conclusions or recomendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the
National Science Foundation (NSF).
Chapter 1
The Fundamental Question
1.1 Overview
Communication is a fundamental need of our modern lives. In fact, communication is something that humans have been doing for a long time. For simplicity, let us restrict ourselves to
English. It is quite remarkable that different people speaking English can be understood pretty
well: even if e.g. the speaker has an accent. This is because English has some built-in redundancy, which allows for errors" to be tolerated. This came to fore for one of the authors when
his two and a half year old son, Akash, started to speak his own version of English, which we will
dub Akash English." As an example,
Figure 1.1: Decoding in Akash English, one gets I need little little (trail)mix."
With some practice Akashs parents were able to decode" what Akash really meant. In fact,
19
Akash could communicate even if he did not say an entire word properly and gobbled up part(s)
of word(s).
The above example shows that having redundancy in a language allows for communication
even in the presence of (small amounts of ) differences and errors. Of course in our modern
digital world, all kinds of entities communicate (and most of the entities do not communicate
in English or any natural language for that matter.) Errors are also present in the digital world,
so these digital communications also use redundancy.
Error-correcting codes (henceforth, just codes) are clever ways of representing data so that
one can recover the original information even if parts of it are corrupted. The basic idea is to
judiciously introduce redundancy so that the original information can be recovered even when
parts of the (redundant) data have been corrupted.
For example, when packets are transmitted over the Internet, some of the packets get corrupted or dropped. Packet drops are resolved by the TCP layer by a combination of sequence
numbers and ACKs. To deal with data corruption, multiple layers of the TCP/IP stack use a form
of error correction called CRC Checksum [57]. From a theoretical point of view, the checksum
is a terrible code (for that matter so is English). However, on the Internet, the current dominant
mode of operation is to detect errors and if errors have occurred, then ask for retransmission.
This is the reason why the use of checksum has been hugely successful in the Internet. However,
there are other communication applications, where re-transmission is not an option. Codes are
used when transmitting data over the telephone line or via cell phones. They are also used in
deep space communication and in satellite broadcast (for example, TV signals are transmitted
via satellite). Indeed, asking the Mars Rover to re-send an image just because it got corrupted
during transmission is not an option this is the reason that for such applications, the codes
used have always been very sophisticated.
Codes also have applications in areas not directly related to communication. In particular,
in the applications above, we want to communicate over space. Codes can also be used to communicate over time. For example, codes are used heavily in data storage. CDs and DVDs work
fine even in presence of scratches precisely because they use codes. Codes are used in Redundant Array of Inexpensive Disks (RAID) [8] and error correcting memory [7]. (Sometimes in the
Blue Screen of Death displayed by Microsoft Windows family of operating systems, you might
see a line saying something along the lines of parity check failed" this happens when the code
used in the error-correcting memory cannot recover from error(s). Also for certain consumers
of memory, e.g. banks, do not want to suffer from even one bit flipping (this e.g. could mean
someones bank balance either got halved or doubled neither of which are welcome.1 ) Codes
are also deployed in other applications such as paper bar codes, for example, the bar code used
by UPS called MaxiCode [6]. Unlike the Internet example, in all of these applications, there is
no scope for re-transmission."
In this book, we will mainly think of codes in the communication scenario. In this framework, there is a sender who wants to send (say) k message symbols over a noisy channel. The
sender first encodes the k message symbols into n symbols (called a codeword) and then sends
1
This is a bit tongue-in-cheek: in real life banks have more mechanisms to prevent one bit flip from wreaking
havoc.
20
it over the channel. The receiver gets a received word consisting of n symbols. The receiver then
tries to decode and recover the original k message symbols. Thus, encoding is the process of
adding redundancy and decoding is the process of removing errors.
Unless mentioned otherwise, in this book we will make the following assumption
The sender and the receiver only communicate via the channel.a In other words, other then
some setup information about the code, the sender and the receiver do not have any other
information exchange (other than of course what was transmitted over the channel). In
particular, no message is more likely to be transmitted over another.
a
The scenario where the sender and receiver have a side-channel" is an interesting topic that has been
studied but it outside the scope of this book.
The fundamental question that will occupy our attention for almost the entire book is the
tradeoff between the amount of redundancy used and the number of errors that can be corrected by a code. In particular, we would like to understand
Question 1.1.1. How much redundancy do we need to correct a given amount of errors? (We
would like to correct as many errors as possible with as little redundancy as possible.)
Intuitively, maximizing error correction and minimizing redundancy are contradictory goals:
a code with higher redundancy should be able to tolerate more number of errors. By the end of
this chapter, we will see a formalization of this question.
Once we determine the optimal tradeoff, we will be interested in achieving the optimal
tradeoff with codes with efficient encoding and decoding. (A DVD player that tells its consumer
that it will recover from a scratch on a DVD by tomorrow is not going to be exactly a best-seller.)
In this book, we will primarily define efficient algorithms to be ones that run in polynomial
time.2
We are not claiming that this is the correct notion of efficiency in practice. However, we believe that it is a good
definition as the first cut" quadratic or cubic time algorithms are definitely more desirable than exponential time
algorithms: see Section C.4 for more on this.
3
Note that q need not be a constant and can depend on n: well see codes in this book where this is true.
21
assume least structure on and hence, are most generic. Vectors work well when has some
structure (and in particular is what is known as a field, which we will see next chapter). Functions work when the set of coordinates has structure (e.g., [n] may come from a finite field of
size n). In such cases functional representation will be convenient. For now however the exact
representation does not matter and the reader can work with representation as sequences.
We will also frequently use the following alternate way of looking at a code. Given a code
C n , with |C | = M , we will think of C as a mapping of the following form:
C : [M ] n ,
where [x] for any integer x 1 denotes the set {1, 2, , . . . , x}.
We will also need the notion of dimension of a code.
Definition 1.2.2 (Dimension of a code). Given a code C n , its dimension is given by
def
k = logq |C |.
Let us begin by looking at two specific codes. Both codes are defined over = {0, 1} (also
known as binary codes). In both cases |C | = 24 and we will think of each of the 16 messages as a
4 bit vector.
We first look at the so called parity code, which we will denote by C . Given a message
(x 1 , x 2 , x 3 , x 4 ) {0, 1}4 , its corresponding codeword is given by
C (x 1 , x 2 , x 3 , x 4 ) = (x 1 , x 2 , x 3 , x 4 , x 1 x 2 x 3 x 4 ),
where the denotes the EXOR (also known as the XOR or Exclusive-OR) operator. In other
words, the parity code appends the parity of the message bits (or taking the remainder of the
sum of the message bits when divided by 2) at the end of the message. Note that such a code
uses the minimum amount of non-zero redundancy.
The second code we will look at is the so called repetition code. This is a very natural code
(and perhaps the first code one might think of ). The idea is to repeat every message bit a fixed
number of times. For example, we repeat each of the 4 message bits 3 times and we us use C 3,r ep
to denote this code.
Let us now try to look at the tradeoff between the amount of redundancy and the number of
errors each of these codes can correct. Even before we begin to answer the question, we need
to define how we are going to measure the amount of redundancy. One natural way to define
redundancy for a code with dimension k and block length n is by their difference n k. By this
definition, the parity code uses the least amount of redundancy. However, one pitfall" of such
a definition is that it does not distinguish between a code with k = 100 and n = 102 and another
code with dimension and block length 2 and 4 respectively. Intuitively the latter code is using
more redundancy. This motivates the following notion of measuring redundancy.
Definition 1.2.3 (Rate of a code). The rate of a code with dimension k and block length n is
given by
def k
R = .
n
22
Note that higher the rate, lesser the amount of redundancy in the code. Also note that as
k n, R 1.4 Intuitively, the rate of a code is the average amount of real information in each of
the n symbols transmitted over the channel. So in some sense rate captures the complement
of redundancy. However, for historical reasons we will deal with the rate R (instead of the more
obvious 1R) as our notion of redundancy. Given the above definition, C and C 3,r ep have rates
of 54 and 13 . As was to be expected, the parity code has a higher rate than the repetition code.
We have formalized the notion of redundancy as the rate of a code. To formalize Question 1.1.1, we need to formally define what it means to correct errors. We do so next.
Further, in this book, we will always consider the case k > 0 and n < and hence, we can also assume that
R > 0.
23
c hannel
m
C (m )
e n c o d in g f u n c tio n
y = C (m ) + e
e
d e c o d in g f u n c tio n
Recall we are assuming that the decoder has no side information about the transmitted message.
24
Any error pattern can occur during transmission as long as the total number of errors is bounded. Note that this means that the location as well as the nature6 of the
errors is arbitrary.
We will frequently refer to Hammings model as the Adversarial Noise Model. It is important
to note that the atomic unit of error is a symbol from the alphabet. So for example, if the error
pattern is (1, 0, 1, 0, 0, 0) and we consider the alphabet to be {0, 1}, then the pattern has two errors.
However, if our alphabet is {0, 1}3 (i.e. we think of the vector above as ((1, 0, 1), (0, 0, 0)), with
(0, 0, 0) corresponding to the zero element in {0, 1}3 ), then the pattern has only one error. Thus,
by increasing the alphabet size we can also change the adversarial noise model. As the book
progresses, we will see how error correction over a larger alphabet is easier than error correction
over a smaller alphabet.
However, the above is not the only way to model noise. For example, we could also have
following error model:
No more than 1 error can happen in any contiguous three-bit block.
First note that, for the channel model above, no more than four errors can occur when a codeword in C 3,r ep is transmitted. (Recall that in C 3,r ep , each of the four bits is repeated three times.)
Second, note that the decoding function that takes the majority vote of each block can successfully recover the transmitted codeword for any error pattern, while in the worst-case noise
model it could only correct at most one error. This channel model is admittedly contrived, but
it illustrates the point that the error-correcting capabilities of a code (and a decoding function)
are crucially dependent on the noise model.
A popular alternate noise model is to model the channel as a stochastic process. As a concrete example, let us briefly mention the binary symmetric channel with crossover probability
0 p 1, denoted by BSCp , which was first studied by Shannon. In this model, when a (binary)
codeword is transferred through the channel, every bit flips independently with probability p.
Note that the two noise models proposed by Hamming and Shannon are in some sense two
extremes: Hammings model assumes no knowledge about the channel (except that a bound
on the total number of errors is known7 while Shannons noise model assumes complete knowledge about how noise is produced. In this book, we will consider only these two extreme noise
models. In real life, the situation often is somewhere in between.
For real life applications, modeling the noise model correctly is an extremely important
task, as we can tailor our codes to the noise model at hand. However, in this book we will
not study this aspect of designing codes at all, and will instead mostly consider the worst-case
noise model. Intuitively, if one can communicate over the worst-case noise model, then one
could use the same code to communicate over pretty much every other noise model with the
same amount of noise.
6
For binary codes, there is only one kind of error: a bit flip. However, for codes over a larger alphabet, say {0, 1, 2},
0 being converted to a 1 and 0 being converted into a 2 are both errors, but are different kinds of errors.
7
A bound on the total number of errors is necessary; otherwise, error correction would be impossible: see
Exercise 1.3.
25
We now return to C and examine its error-correcting capabilities in the worst-case noise
model. We claim that C cannot correct even one error. Suppose 01000 is the received word.
Then we know that an error has occurred, but we do not know which bit was flipped. This is
because the two codewords 00000 and 01001 differ from the received word 01000 in exactly
one bit. As we are assuming that the receiver has no side information about the transmitted
codeword, no decoder can know what the transmitted codeword was.
Thus, since it cannot correct even one error, from an error-correction point of view, C is
a terrible code (as it cannot correct even 1 error). However, we will now see that C can detect
one error. Consider the following algorithm. Let y = (y 1 , y 2 , y 3 , y 4 , y 5 ) be the received word.
Compute b = y 1 y 2 y 3 y 4 y 5 and declare an error if b = 1. Note that when no error has
occurred during transmission, y i = x i for 1 i 4 and y 5 = x 1 x 2 x 3 x 4 , in which case
b = 0 as required. If there is a single error then either y i = x i 1 (for exactly one 1 i 4) or
y 5 = x 1 x 2 x 3 x 4 1. It is easy to check that in this case b = 1. In fact, one can extend this
argument to obtain the following result (see Exercise 1.4).
Proposition 1.3.2. The parity code C can detect an odd number of errors.
Let us now revisit the example that showed that one cannot correct one error using C .
Consider two codewords in C , u = 00000 and v = 10001 (which are codewords corresponding
to messages 0000 and 1000, respectively). Now consider the scenarios in which u and v are
each transmitted and a single error occurs resulting in the received word r = 10000. Thus, given
the received word r and the fact that at most one error can occur, the decoder has no way of
knowing whether the original transmitted codeword was u or v. Looking back at the example, it
is clear that the decoder is confused" because the two codewords u and v do not differ in many
positions. This notion is formalized in the next section.
Definition 1.4.2 (Minimum distance). Let C n . The minimum distance (or just distance) of
C is defined to be
d = min (c1 , c2 )
c1 )=c2 C
It is easy to check that the repetition code C 3,r ep has distance 3. (Indeed, any two distinct
messages will differ in at least one of the message bits. After encoding, the difference in one
message bit will translate into a difference of three bits in the corresponding codewords.) We
now claim that the distance of C is 2. This is a consequence of the following observations.
If two messages m1 and m2 differ in at least two places then (C (m1 ),C (m2 )) 2 (by only
looking at the first four bits of the codewords). If two messages differ in exactly one place then
the parity bits in the corresponding codewords are different which implies a Hamming distance of 2 between the codewords. Thus, C has smaller distance than C 3,r ep and can correct
less number of errors than C 3,r ep , which seems to suggest that a larger distance implies greater
error-correcting capabilities. The next result formalizes this intuition.
Proposition 1.4.1. The following statements are equivalent for a code C :
1. C has minimum distance d 2,
2. If d is odd, C can correct (d 1)/2 errors.
3. C can detect d 1 errors.
4. C can correct d 1 erasures.8
Remark 1.4.1. Property (2) above for even d is slightly different. In this case, one can correct up
to d2 1 errors but cannot correct d2 errors. (See Exercise 1.6.)
Before we prove Proposition 1.4.1, let us apply it to the codes C and C 3,r ep which have
distances of 2 and 3 respectively. Proposition 1.4.1 implies the following facts that we have
already proved:
C 3,r ep can correct 1 errors (Proposition 1.3.1).
C can detect 1 error but cannot correct 1 error (Proposition 1.3.2).
The proof of Proposition 1.4.1 will need the following decoding function. Maximum likelihood decoding (MLD) is a well-studied decoding method for error correcting codes, which
outputs the codeword closest to the received word in Hamming distance (with ties broken arbitrarily). More formally, the MLD function denoted by D M LD : n C is defined as follows. For
every y n ,
D M LD (y) = arg min (c, y).
cC
In the erasure noise model, the receiver knows where the errors have occurred. In this model, an erroneous
symbol is denoted by ?", with the convention that any non-? symbol is a correct symbol.
27
IF
Proof of Proposition 1.4.1 We will complete the proof in two steps. First, we will show that if
property 1 is satisfied then so are properties 2,3 and 4. Then we show that if property 1 is not
satisfied then none of properties 2,3 or 4 hold.
1. implies 2. Assume C has distance d . We first prove 2 (for this case assume that d = 2t + 1).
We now need to show that there exists a decoding function such that for all error patterns with
at most t errors it always outputs the transmitted message. We claim that the MLD function
has this property. Assume this is not so and let c1 be the transmitted codeword and let y be the
received word. Note that
(y, c1 ) t .
(1.1)
As we have assumed that MLD does not work, D M LD (y) = c2 )= c1 . Note that by the definition of
MLD,
(y, c2 ) (y, c1 ).
(1.2)
Consider the following set of inequalities:
(c1 , c2 ) (c2 , y) + (c1 , y)
2(c1 , y)
2t
= d 1,
(1.3)
(1.4)
(1.5)
(1.6)
where (1.3) follows from the triangle inequality (see Exercise 1.5), (1.4) follows from (1.2) and
(1.5) follows from (1.1). (1.6) implies that the distance of C is at most d 1, which is a contradiction.
1. implies 3. We now show that property 3 holds, that is, we need to describe an algorithm
that can successfully detect whether errors have occurred during transmission (as long as the
total number of errors is bounded by d 1). Consider the following error detection algorithm:
check if the received word y = c for some c C (this can be done via an exhaustive check). If
no errors occurred during transmission, y = c1 , where c1 was the transmitted codeword and the
algorithm above will accept (as it should). On the other hand if 1 (y, c1 ) d 1, then by the
fact that the distance of C is d , y ) C and hence the algorithm rejects, as required.
28
1. implies 4. Finally, we prove that property 4 holds. Let y ( {?})n be the received word.
First we claim that there is a unique c = (c 1 , . . . , c n ) C that agrees with y (i.e. y i = c i for every i such that y i )=?). (For the sake of contradiction, assume that this is not true, i.e. there
exists two distinct codewords c1 , c2 C such that both c1 and c2 agree with y in the unerased
positions. Note that this implies that c1 and c2 agree in the positions i such that y i )=?. Thus,
(c1 , c2 ) |{i |y i =?}| d 1, which contradicts the assumption that C has distance d .) Given
the uniqueness of the codeword c C that agrees with y in the unerased position, here is an
algorithm to find it: go through all the codewords in C and output the desired codeword.
1. implies 2. For the other direction of the proof, assume that property 1 does not hold, that
is, C has distance d 1. We now show that property 2 cannot hold, that is, for every decoding
function there exists a transmitted codeword c1 and a received word y (where (y, c1 ) (d 1)/2)
such that the decoding function cannot output c1 . Let c1 )= c2 C be codewords such that
(c1 , c2 ) = d 1 (such a pair exists as C has distance d 1). Now consider a vector y such that
(y, c1 ) = (y, c2 ) = (d 1)/2. Such a y exists as d is odd and by the choice of c1 and c2 . Below is
an illustration of such a y (same color implies that the vectors agree on those positions):
d 1
2
n d +1
d 1
2
c1
c2
Now, since y could have been generated if either of c1 or c2 were the transmitted codeword,
no decoding function can work in this case.9
1. implies 3. For the remainder of the proof, assume that the transmitted word is c1 and
there exists another codeword c2 such that (c2 , c1 ) = d 1. To see why property 3 is not true,
let y = c2 . In this case, either the error detecting algorithm detects no error or it declares an
error when c2 is the transmitted codeword and no error takes place during transmission.
9
Note that this argument is just a generalization of the argument that C cannot correct 1 error.
29
1. implies 4. We finally argue that property 4 does not hold. Let y be the received word in
which the positions that are erased are exactly those where c1 and c2 differ. Thus, given y both
c1 and c2 could have been the transmitted codeword and no algorithm for correcting (at most
d 1) erasures can work in this case.
Question 1.4.1. What is the largest rate R that a code with distance d can have?
We have seen that the repetition code C 3,r ep has distance 3 and rate 1/3. A natural follow-up
question (which is a special case of Question 1.4.1) is to ask
Question 1.4.2. Can we have a code with distance 3 and rate R > 13 ?
cC H ,c)=0
30
(1.7)
and
min w t (c) =
cC H ,c)=0
min (c1 , c2 )
c1 )=c2 C H
(1.8)
The proof of (1.7) follows from a case analysis on the Hamming weight of the message bits. Let
us use x = (x 1 , x 2 , x 3 , x 4 ) to denote the message vector.
Case 0: If w t (x) = 0, then C H (x) = 0, which means we do not have to consider this codeword.
Case 1: If w t (x) = 1 then at least two parity check bits in (x 2 x 3 x 4 , x 1 x 2 x 4 , x 1 x 3 x 4 )
are 1. So in this case, w t (C H (x)) 3.
Case 2: If w t (x) = 2 then at least one parity check bit in (x 2 x 3 x 4 , x 1 x 2 x 4 , x 1 x 3 x 4 )
is 1. So in this case, w t (C H (x)) 3.
Case 3: If w t (x) 3 then obviously w t (C H (x)) 3.
Thus, we can conclude that
cC H ,c)=0
along with the lower bound that we just obtained proves (1.7).
We now turn to the proof of (1.8). For the rest of the proof, let x = (x 1 , x 2 , x 3 , x 4 ) and y =
(y 1 , y 2 , y 3 , y 4 ) denote the two distinct messages. Using associativity and commutativity of the
operator, we obtain that
C H (x) +C H (y) = C H (x + y),
where the +" operator is just the bit-wise of the operand vectors. Further, it is easy to verify
that for two vectors u, v {0, 1}n , (u, v) = w t (u + v) (see Exercise 1.10). Thus, we have
min
x)=y{0,1}4
(C H (x),C H (y)) =
=
min
w t (C H (x + y))
min
w t (C H (x)),
x)=y{0,1}4
x)=0{0,1}4
where the second equality follows from the observation that {x+y|x )= y {0, 1}n } = {x {0, 1}n |x )=
0}. Recall that w t (C H (x)) = 0 if and only if x = 0 and This completes the proof of (1.8). Combining (1.7) and (1.8), we conclude that C H has a distance 3.
The second part of the proof could also have been shown in the following manner. It can
be verified easily that the Hamming code is the set {x G H |x {0, 1}4 }, where G H is the following
matrix (where we think x as a row vector).10
1 0 0 0 0 1 1
0 1 0 0 1 0 1
GH =
0 0 1 0 1 1 0
0 0 0 1 1 1 1
10
Indeed (x 1 , x 2 , x 3 , x 4 ) G H = (x 1 , x 2 , x 3 , x 4 , x 2 x 3 x 4 , x 1 x 3 x 4 , x 1 x 2 x 4 ), as desired.
31
In fact, any binary code (of dimension k and block length n) that is generated11 by a k n
matrix is called a binary linear code. (Both C and C 3,r ep are binary linear codes: see Exercise 1.11.) This implies the following simple fact.
Lemma 1.5.2. For any binary linear code C and any two messages x and y, C (x)+C (y) = C (x+y).
Proof. For any binary linear code, we have a generator matrix G. The following sequence of
equalities (which follow from the distributivity and associativity properties of the boolean EXOR
and AND operators) proves the lemma.
C (x) +C (y) = x G + y G
= (x + y) G
= C (x + y)
We stress that in the lemma above, x and y need not be distinct. Note that due to the fact that
b b = 0 for every b {0, 1}, x+x = 0, which along with the lemma above implies that C (0) = 0.12
We can infer the following result from the above lemma and the arguments used to prove (1.8)
in the proof of Proposition 1.5.1.
Proposition 1.5.3. For any binary linear code, minimum distance is equal to minimum Hamming weight of any non-zero codeword.
Thus, we have seen that C H has distance d = 3 and rate R = 74 while C 3,r ep has distance d = 3
and rate R = 31 . Thus, the Hamming code is provably better than the repetition code (in terms
of the tradeoff between rate and distance) and thus, answers Question 1.4.2 in the affirmative.
The next natural question is
Question 1.5.1. Can we have a distance 3 code with a rate higher than that of C H ?
We will address this question in the next section.
That is, C = {x G|x {0, 1}k }, where addition is the operation and multiplication is the AND operation.
This of course should not be surprising as for any matrix G, we have 0 G = 0.
32
(1.9)
See Figure 1.4 for an illustration. Note that for all x {0, 1}n (see Exercise 1.14),
{0, 1}n
1
c1
c2
Figure 1.4: Hamming balls of radius 1 are disjoint. The figure is technically not correct: the balls
above are actually balls in the Euclidean space, which is easier to visualize than the Hamming
space.
|B (x, 1)| = n + 1.
(1.10)
Now consider the union of all Hamming balls centered around some codeword. Obviously their
union is a subset of {0, 1}n . In other words,
'
'
'(
'
' B (c, 1)' 2n .
(1.11)
'
'
cC
13
Assume that y B (c1 , 1)B (c2 , 1), that is (y, c1 ) 1 and (y, c2 ) 1. Thus, by the triangle inequality (c1 , c2 )
2 < 3, which is a contradiction.
33
cC
k
= 2 (n + 1),
(1.12)
where (1.12) follows from (1.10) and the fact that C has dimension k. Combining (1.12) and
(1.11) and taking log2 of both sides we will get the desired bound:
k n log2 (n + 1).
Thus, Theorem 1.6.1 shows that for n = 7, C H has the largest possible dimension for any
binary code of block length 7 and distance 3 (as for n = 7, n log2 (n + 1) = 4). In particular,
it also answers Question 1.5.1 for n = 7 in the negative. Next, will present the general form of
Hamming bound.
,
) n
(q 1)i .
k n logq
i
i =0
*
(d 1)
2
B (c1 , e) B (c2 , e) = 0.
(1.13)
, e n
)
|B (x, e)| =
(q 1)i .
i
i =0
(1.14)
14
Assume that y B (c1 , e)B (c2 , e), that is (y, c1 ) e and (y, c2 ) e. Thus, by the triangle inequality, (c1 , c2 )
2e d 1, which is a contradiction.
34
Indeed
any vector in B (x, e) must differ from x in exactly 0 i e positions. In the summation
.n /
is the number of ways of choosing the differing i positions and in each such position, a
i
vector can differ from x in q 1 ways.
Now consider the union of all Hamming balls centered around some codeword. Obviously
their union is a subset of [q]n . In other words,
'
'
'
'(
' B (c, e)' q n .
(1.15)
'
'
cC
cC
, e n
)
(q 1)i ,
=q
i =0 i
k
(1.16)
where (1.16) follows from (1.14) and the fact that C has dimension k. Combining (1.16) and
(1.15) and taking logq of both sides we will get the desired bound:
, , e n
)
(q 1)i .
k n logq
i
i =0
The Hamming bound leads to the following definition:
Definition 1.7.2. Codes that meet Hamming bound are called perfect codes.
Intuitively, a perfect
+ leads to the following perfect packing": if one constructs Ham* code
around all the codewords, then we would cover the entire ambient
ming balls of radius d 1
2
space, i.e. every possible vector will lie in one of these Hamming balls.
One example of perfect code is the (7, 4, 3)2 Hamming code that we have seen in this chapter
(so is the family of general Hamming codes that we will see in the next chapter). A natural
question to ask is if
Question 1.7.1. Other than the Hamming codes, are there any other perfect (binary) codes?
We will see the answer shortly.
1.8 Exercises
Exercise 1.1. Show that any t -error correcting code is also t -error detecting but not necessarily
the other way around.
35
Exercise 1.8. In this problem we will consider a noise model that has both errors and erasures. In
particular, let C be an (n, k, d ) code. As usual a codeword c C is transmitted over the channel
and the received word is a vector y ( {?})n , where as before a ? denotes an erasure. We will
use s to denote the number of erasures in y and e to denote the number of (non-erasure) errors
that occurred during transmission. To decode such a vector means to output a codeword c C
such that the number of positions where c disagree with y in the n s non-erased positions is
at most e. For the rest of the problem assume that
2e + s < d .
(1.17)
1. Argue that the output of the decoder for any C under (1.17) is unique.
2. Let C be a binary code (but not necessarily linear). Assume that there exists a decoder D
that can correct from < d /2 many errors in T (n) time. Then under (1.17) one can perform
decoding in time O(T (n)).
36
Exercise 1.12. Let G be a generator matrix of an (n, k, d )2 binary linear code. Then G has at least
kd ones in it.
Exercise 1.13. Argue that in any binary linear code, either all all codewords begin with a 0 of
exactly half of the codewords begin with a 0.
Exercise 1.14. Prove (1.10).
Exercise 1.15. Show that there is no binary code with block length 4 that achieves the Hamming
bound.
Exercise 1.16. () There are n people in a room, each of whom is given a black/white hat chosen
uniformly at random (and independent of the choices of all other people). Each person can see
the hat color of all other people, but not their own. Each person is asked if (s)he wishes to guess
their own hat color. They can either guess, or abstain. Each person makes their choice without
knowledge of what the other people are doing. They either win collectively, or lose collectively.
They win if all the people who dont abstain guess their hat color correctly and at least one
person does not abstain. They lose if all people abstain, or if some person guesses their color
incorrectly. Your goal below is to come up with a strategy that will allow the n people to win
with pretty high probability. We begin with a simple warmup:
(a) Argue that the n people can win with probability at least 21 .
Next we will see how one can really bump up the probability of success with some careful modeling, and some knowledge of Hamming codes. (Below are assuming knowledge of the general
Hamming code (see Section 2.4). If you do not want to skip ahead, you can assume that n = 7
in the last part of this problem.
(b) Lets say that a directed graph G is a subgraph of the n-dimensional hypercube if its vertex
set is {0, 1}n and if u v is an edge in G, then u and v differ in at most one coordinate.
Let K (G) be the number of vertices of G with in-degree at least one, and out-degree zero.
Show that the probability of winning the hat problem equals the maximum, over directed
subgraphs G of the n-dimensional hypercube, of K (G)/2n .
(c) Using the fact that the out-degree of any vertex is at most n, show that K (G)/2n is at most
n
for any directed subgraph G of the n-dimensional hypercube.
n+1
(d) Show that if n = 2r 1, then there exists a directed subgraph G of the n-dimensional hyn
percube with K (G)/2n = n+1
.
Hint: This is where the Hamming code comes in.
37
38
Foreword
This chapter is based on lecture notes from coding theory courses taught by Venkatesan Guruswami at University at Washington and CMU; by Atri Rudra at University at Buffalo, SUNY
and by Madhu Sudan at MIT.
This version is dated July 16, 2014. For the latest version, please go to
http://www.cse.buffalo.edu/ atri/courses/coding-theory/book/
The material in this chapter is supported in part by the National Science Foundation under
CAREER grant CCF-0844796. Any opinions, findings and conclusions or recomendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the
National Science Foundation (NSF).
Chapter 2
A Look at Some Nicely Behaved Codes:
Linear Codes
Let us now pause for a bit and think about how we can represent a code. In general, a code
C : [q]k [q]n can be stored using nq k symbols from [q] (n symbols for each of the q k codewords) or nq k log q bits. For constant rate codes, this is exponential space, which is prohibitive
even for modest values of k like k = 100. A natural question is whether we can do better. Intuitively, the code must have some extra structure that would facilitate a succinct representation
of the code. We will now look at a class of codes called linear codes that have more structure
than general codes which leads to some other nice properties. We have already seen binary linear codes in Section 1.5, that is, C {0, 1}n is linear code if for all c1 , c2 C , c1 +c2 C , where the
+" denotes bit-wise EXOR.
Definition 2.0.1 (Linear Codes). Let q be a prime power (i.e. q = p s for some prime p and
integer s 1). C {0, 1, ..., q 1}n is a linear code if it is a linear subspace of {0, 1, ..., q 1}n . If C
has dimension k and distance d then it will be referred to as an [n, k, d ]q or just an [n, k]q code.
Of course the above definition is not complete because we have not defined a linear subspace yet. We do that next.
To see this note that the sequence a, a + 1, a + 2, . . . , a + p 1 are p consecutive numbers and
thus, exactly one of them is a multiple of p, which happens for b = p a mod p, as desired.
Now fix an a {1, . . . , p 1}. Next we argue for the existence of a unique multiplicative universe a 1 . Consider the set of numbers {a p b}b{1,...,p1} . We claim that all these numbers are
unique. To see this, note that if this is not the case, then there exist b 1 '= b 2 {0, 1, . . . , p 1} such
that a b 1 = a b 2 mod p, which in turn implies that a (b 1 b 2 ) = 0 mod p. Since a and b 1 b 2
are non-zero numbers, this implies that p divides a (b 1 b 2 ). Further, since a and |b 1 b 2 | are
both at most p 1, this implies that factors of a and (b 1 b 2 ) mod p when multiplied together
results in p, which is a contradiction since p is prime. Thus, this implies that there exists a
unique element b such that a b = 1 mod p and thus, b is the required a 1 .
One might think that there could be different fields with the same number of elements.
However, this is not the case:
Theorem 2.1.3. For every prime power q there is a unique finite field with q elements (up to
isomorphism1 ).
Thus, we are justified in just using Fq to denote a finite field on q elements.
(2.1)
Note that for example (1, 1, 1) + (3, 3, 3) = (4, 4, 4) S 1 and 2 (4, 4, 4) = (3, 3, 3) S 1 as required
by the definition. Here is another somewhat less trivial example of a linear subspace over F33 :
S 2 = {(0, 0, 0), (1, 0, 1), (2, 0, 2), (0, 1, 1), (0, 2, 2), (1, 1, 2), (1, 2, 0), (2, 1, 0), (2, 2, 1).
(2.2)
Remark 2.2.1. Note that the second property implies that 0 is contained in every linear subspace. Further for any subspace over F2 , the second property is redundant: see Exercise 2.3.
Before we state some properties of linear subspaces, we state some relevant definitions.
1
An isomorphism : S S ( is a map (such that F = (S, +, ) and F( = (S ( , , ) are fields) where for every a 1 , a 2 S,
we have (a 1 + a 2 ) = (a 1 ) (a 2 ) and (a 1 a 2 ) = (a 1 ) (a 2 ).
41
Definition 2.2.2 (Span). Given a set B = {v1 , . . . , v" }. The span of B is the set of vectors
!
#
"
"
a i vi |a i Fq for every i ["] .
i =1
Definition 2.2.3 (Linear independence of vectors). We say that v1 , v2 , . . . vk are linearly independent if for every 1 i k and for every k 1-tuple (a 1 , a 2 , . . . , a i 1 , a i +1 , . . . , a k ) Fk1
q ,
vi '= a 1 v1 + . . . + a i 1 vi 1 + a i +1 vi +1 + . . . + a k vk .
In other words, vi is not in the span of the set {v1 , . . . , vi 1 , vi +1 , . . . , vn }.
For example the vectors (1, 0, 1), (1, 1, 1) S 2 are linearly independent.
Definition 2.2.4 (Rank of a matrix). The rank of matrix in Fkk
is the maximum number of
q
kn
linearly independent rows (or columns). A matrix in Fq with rank min(k, n) is said to have full
rank.
One can define the row (column) rank of a matrix as the maximum number of linearly independent rows (columns). However, it is a well-known theorem that the row rank of a matrix
is the same as its column rank. For example, the matrix below over F3 has full rank (see Exercise 2.4):
$
%
1 0 1
G2 =
.
(2.3)
0 1 1
Any linear subspace satisfies the following properties (the full proof can be found in any
standard linear algebra textbook).
Theorem 2.2.1. If S Fq n is a linear subspace then
1. |S| = q k for some k 0. The parameter k is called the dimension of S.
2. There exists v1 , ..., vk S called basis elements (which need not be unique) such that every
x S can be expressed as x = a 1 v1 + a 2 v2 + ... + a n vn where a i Fq for 1 i k. In other
words, there exists a full rank kn matrix G (also known as a generator matrix) with entries
from Fq such that every x S, x = (a 1 , a 2 , ...a k ) G where
v1
v2
G =
.
..
vk
3. There exists a full rank (n k) n matrix H (called a parity check matrix) such that for
every x S, H xT = 0.
4. G and H are orthogonal, that is, G H T = 0.
42
Proof Sketch.
Property 1. We begin with the proof of the first property. For the sake of contradiction, let
us assume that q k < |S| < q k+1 , for some k 0. Iteratively, we will construct a set of linearly
independent vectors B S such that |B | k + 1. Note that by the definition of a linear subspace
the span of B should be contained in S. However, this is a contradiction as the size of the span
of B is at least2 q k+1 > |S|.
To complete the proof, we show how to construct the set B in a greedy fashion. In the first
step pick v1 to be any non-zero vector in S and set B {v1 } (we can find such a vector as |S| >
q k 1). Now say after the step t (for some t k), |B | = t . Now the size of the span of the current
B is q t q k < |S|. Thus there exists a vector vt +1 S \ B that is linearly independent of vectors
in B . Set B B {vt +1 }. Thus, we can continue building B till |B | = k + 1, as desired.
Property 2. We first note that we can pick B = {v1 , . . . , vk } to be any set of k linearly independent vectors this just follows from the argument above for Property 1.1. This is because the
span of B is contained in S. However, since |S| = q k and the span of B has q k vectors, the two
have to be the same.
Property 3. Property 3 above follows from another fact that every linear subspace S has a null
space N Fnq such that for every x S and y N , x, y = 0. Further, it is known that N itself is
a linear subspace of dimension n k. (The claim that N is also a linear subspace follows from
the following two facts: for every x, y, z Fnq , (i) x, y + z = x, y + x, z and (ii) for any a Fq ,
x, ay = a x, y.) In other words, there exists a generator matrix H for it. This matrix H is called
the parity check matrix of S.
Property 4. See Exercise 2.7.
As examples, the linear subspace S 1 in (2.1) has as one of its generator matrices
,
1 1 1
1 2 2
2 2 1
G1 =
and as one of its parity check matrices
H1 =
Further, the linear subspace S 2 in (2.2) has G 2 as one of its generator matrices and has the following as one of its parity check matrices
H2 =
1 1 2 .
43
Lemma 2.2.2. Given matrix G of dimension k n that is a generator matrix of subspace S 1 and
matrix H of dimension (n k)n that is a parity check matrix of subspace S 2 such that G H T = 0,
then S 1 = S 2 .
Proof. We first prove that S 1 S 2 . Given any c S 1 , there exists x Fkq such that c = xG. Then,
cH T = xG H T = 0,
which implies that c S 2 , as desired.
To complete the proof note that as H has full rank, its null space (or S 2 ) has dimension
n (n k) = k (this follows from a well known fact from linear algebra). Now as G has full rank,
the dimension of S 1 is also k. Thus, as S 1 S 2 , it has to be the case that S 1 = S 2 .3
1 0 0 0 0 1 1
0 1 0 0 1 0 1
G =
0 0 1 0 1 1 0
0 0 0 1 1 1 1
C is also characterized by an (n k)n parity check matrix H . We claim that the following
matrix is a parity check matrix of the [7, 4, 3]2 Hamming code:
0 0 0 1 1 1 1
H = 0 1 1 0 0 1 1
1
0 1 0 1 0 1
Indeed, it can be easily verified that G H T = 0. Then Lemma 2.2.2 proves that H is indeed
a parity check matrix of the [7, 4, 3]2 Hamming code.
We now look at some consequences of the above characterizations of an [n, k]q linear code
C . We started this chapter with a quest for succinct representation of a code. Note that both the
generator matrix and the parity check matrix can be represented using O(n 2 ) symbols from Fq
(which is much smaller than the exponential representation of a general code). More precisely
(see Exercise 2.9),
Proposition 2.3.1. Any [n, k]q linear code can be represented with min(nk, n(n k)) symbols
from Fq .
3
If not, S 1 S 2 which implies that that |S 2 | |S 1 | + 1. The latter is not possible if both S 1 and S 2 have the same
dimension.
44
There is an encoding algorithm for C that runs in O(n 2 ) (in particular O(kn)) time given a
message m Fkq , the corresponding codeword C (m) = m G, where G is the generator matrix of
C . (See Exercise 2.10.)
Proposition 2.3.2. For any [n, k]q linear code, given its generator matrix, encoding can be done
with O(nk) operations over Fq .
There is an error-detecting algorithm for C that runs in O(n 2 ). This is a big improvement
over the naive brute force exponential time algorithm (that goes through all possible codewords
c C and checks if y = c). (See Exercise 2.11.)
Proposition 2.3.3. For any [n, k]q linear code, given its parity check matrix, error detection can
be performed in O(n(n k)) operations over Fq .
Next, we look at some alternate characterizations of the distance of a linear code.
Proof. To show that d is the same as the minimum weight we show that d is no more than the
minimum weight and d is no less than the minimum weight.
First, we show that d is no more than the minimum weight. We can see this by considering
(0, c( ) where c( is the non-zero codeword in C with minimum weight; its distance from 0 is
equal to its weight. Thus, we have d w t (c( ), as desired.
Now, to show that d is no less than the minimum weight, consider c1 '= c2 C such that
(c1 , c2 ) = d . Note that c1 c2 C (this is because c2 = 1 c2 C , where 1 is the additive
inverse of 1 in Fq and c1 c2 = c1 + (c2 ), which by the definition of linear codes is in C ). Now
note that w t (c1 c2 ) = (c1 , c2 ) = d , since the non-zero symbols in c1 c2 occur exactly in the
positions where the two codewords differ. Further, since c1 '= c2 , c1 c2 '= 0, which implies that
the minimum Hamming weight of any non-zero codeword in C is at most d .
Next, we look at another property implied by the parity check matrix of a linear code.
Proposition 2.3.5. For any [n, k, d ]q code C with parity check matrix H , d is the minimum number of linearly dependent columns in H .
Proof. By Proposition 2.3.4, we need to show that the minimum weight of a non-zero codeword
in C is the minimum number of linearly dependent columns. Let t be the minimum number of
linearly dependent columns in H . To prove the claim we will show that t d and t d .
45
For the first direction, Let c '= 0 C be a codeword with w t (c) = d . Now note that, by the
definition of the parity check matrix, H cT = 0. Working through the matrix multiplication, this
.
gives us that ni=1 c i H i , where
H = H1 H2 Hi
Hn
and c = (c 1 , . . . , c n ). Note that we can skip multiplication for those columns for which the corresponding bit c i is zero, so for this to be zero, those H i with c i '= 0 are linearly dependent. This
means that d t , as the columns corresponding to non-zero entries in c are one instance of
linearly dependent columns.
For the other direction, consider the minimum set of columns from H , H i 1 , H i 2 , . . . , H i t that
are linearly dependent. This implies that there exists non-zero elements c i( , . . . , c i( Fq such
1
that c i( H i 1 + . . . + c i( H i t = 0. (Note that all the c i( are non-zero as no set of less than t columns
i
are linearly dependent.) Now extend c i( , . . . , c i( to the vector c( such that c (j = 0 for j ' {i 1 , . . . , i t }.
1
t
Note that c( C and thus, d w t (c( ) = t (where recall t is the minimum number of linearly
independent columns in H ).
0 0 0 1 1 1 1
H3 = 0 1 1 0 0 1 1 .
1 0 1 0 1 0 1
Note that by its definition, the code that has Hr as its parity check matrix has block length 2r 1
and dimension 2r r 1. This leads to the formal definition of the general Hamming code.
Definition 2.4.1. The [2r 1, 2r r 1]2 Hamming code, denoted by C H ,r has parity check matrix
Hr .
0}.
In other words, the general [2r 1, 2r r 1]2 Hamming code is the code {c {0, 1}2
|Hr cT =
Next we argue that the above Hamming code has distance 3 (in Proposition 1.5.1 we argued
this for r = 3).
46
Proof. No two columns in Hr are linearly dependent. If they were, we would have Hir + Hr =
0, but this is impossible since they differ in at least one bit (being binary representations of
integers, i '= j ). Thus, by Proposition 2.3.5, the distance is at least 3. It is at most 3, since (e.g.)
H1r + H2r + H3r = 0.
Now note that under the Hamming bound for d = 3 (Theorem 1.6.1), k n log2 (n + 1), so
for n = 2r 1, k 2r r 1. Hence, the Hamming code is a perfect code. (See Definition 1.7.2.)
In Question 1.7.1, we asked which codes are perfect codes. Interestingly, the only perfect
binary codes are the following:
The Hamming codes which we just studied.
The trivial [n, 1, n]2 codes for odd n (which have 0n and 1n as the only codewords): see
Exercise 2.21.
Two codes due to Golay [23].
0
di
.
ni
(C H ) = lim
i 2i
47
3
1
= 0.
We will mostly work with family of codes from now on. This is necessary as we will study the
asymptotic behavior of algorithms for codes, which does not make sense for a fixed code. For
example, when we say that a decoding algorithm for a code C takes O(n 2 ) time, we would be
implicitly assuming that C is a family of codes and that the algorithm has an O(n 2 ) running time
when the block length is large enough. From now on, unless mentioned otherwise, whenever
we talk about a code, we will be implicitly assuming that we are talking about a family of codes.
Given that we can only formally talk about asymptotic run time of algorithms, we now also
state our formal notion of efficient algorithms:
Well call an algorithm related to a code of block length n to be efficient, if it runs in time
polynomial in n.
For all the specific codes that we will study in this book, the corresponding family of codes
will be a family" in a more natural sense. In other words, all the specific codes in a family of
codes will be the same" code except with different parameters. A bit more formally, we will consider families {C i }i , where given i , one can compute a sufficient description of C i efficiently.4
Finally, the definition of a family of code allows us to present the final version of the the
big motivating question for the book. The last formal version of the main question we considered was Question 1.4.1, where we were interested in the tradeoff of rate R and distance d . The
comparison was somewhat unfair because R was a ratio while d was an integer. A more appropriate comparison should be between rate R and the relative distance . Further, we would be
interested in tackling in the main motivating question for families of codes, which results in the
following final version:
Question 2.5.1. What is the optimal tradeoff between R(C ) and (C ) that can be achieved by
some code family C ?
We stress that this is not always going to be the case. In particular, we will consider random" codes where this
efficient constructibility will not be true.
48
then we declare a decoding failure.) Algorithm 2 formally presents this algorithm (where C H ,r
is the [2r 1, 2r r 1, 3]2 Hamming code).5
Algorithm 2 Naive Decoder for Hamming Code
I NPUT: Received word y
O UTPUT: c if (y, c) 1 else Fail
1: IF y C H ,r THEN
2:
RETURN
3: FOR i = 1 . . . n DO
4:
5:
6:
y( y + ei
IF y( C H ,r THEN
RETURN y(
7: RETURN
Fail
It is easy to check that Algorithm 2 can correct up to 1 error. If each of the checks y( C H ,r
can be done in T (n) time, then the time complexity of the proposed algorithm will be O(nT (n)).
Note that since C H ,r is a linear code (and dimension k = n O(log n)) by Proposition 2.3.3, we
have T (n) = O(n log n). Thus, the proposed algorithm has running time O(n 2 log n).
Note that Algorithm 2 can be generalized to work for any linear code C with distance 2t +
1 (and hence, can correct up to t errors): go through all possible error vectors z [q]n (with
w t (z) t ) and check if y z is in the code or not. Algorithm 3 presents the formal algorithm
(where C is an [n, k, 2t + 1]q code). The number of error patterns z considered by Algorithm 3
Algorithm 3 Decoder for Any Linear Code
I NPUT: Received word y
O UTPUT: c C if (y, c) t else Fail
1: FOR i = 0 . . . t DO
2:
3:
4:
5:
FOR
FOR
6: RETURN
Fail
. , is6 it =0 ni (q 1)i O((nq)t ). Further by Proposition 2.3.3, Step 4 can be performed with O(n 2 )
operations over Fq . Thus, Algorithm 3 runs in with O(n t +2 q t ) operations over Fq , which for
q being polynomial small in n, is n O(t ) operations. In other words, the algorithm will have
5
Formally speaking, a decoding algorithm should return the transmitted message x but Algorithm 2 actually
returns C H ,r (x). However, since C H ,r is a linear code, it is not too hard to see that one can obtain x from C H ,r (x) in
O(n 3 ) time see Exercise 2.22. Further, for C H ,r one can do this in O(n) time see Exercise 2.23.
6
Recall (1.14).
49
polynomial running time for codes with constant distance (though the running time would not
be practical even for moderate values of t ).
However, it turns out that for Hamming codes there exists a decoding algorithm with an
O(n 2 ) running time. To see this first note that if the received word y has no errors then Hr yT = 0.
If not, y = c + ei , where c C and ei which is the unit vector with the only nonzero element at
the i -th position. Thus, if Hri stands for the i -th column of Hr ,
Hr yT = Hr cT + Hr (ei )T = Hr (ei )T = Hri ,
where the second equality follows as Hr cT = 0, which in turn follows from the fact that c C .
In other words, Hr yT gives the location of the error. This leads to Algorithm 4.
Algorithm 4 Efficient Decoder for Hamming Code
I NPUT: Received word y
O UTPUT: c if (y, c) 1 else Fail
1: b Hr yT .
3: IF y ei C H THEN
4:
RETURN
5: RETURN
y ei
Fail
Since Step 1 in Algorithm 4 is a matrix vector multiplication (which can be done in O(n log n)
time as the matrix is O(log n)n) and Step 3 by Proposition 2.3.3 can be performed in O(n log n)
time, Algorithm 4 runs in O(n log n) time. Thus,
Theorem 2.6.1. The [n = 2r 1, 2r r 1, 3]2 Hamming code is 1-error correctable. Further, decoding can be performed in time O(n log n).
),
where Hr is the binary representation of 0 j 2r 1 (that is, it contains all the vectors in
j
{0, 1}r ). Further note that the j th bit of the codeword c is x, Hr . Group all the columns of the
generator matrix into pairs (u, v) such that v = u + ei (i.e. v and u are the same except in the i th
position). Notice that this partitions all the columns into 2r 1 disjoint pairs. Then,
x, v = x, u + ei = x, u + x, ei = x, u + x i = x, u + 1.
Thus we have that exactly one of x, v and x, u is 1. As the choice of the pair (u, v) was arbitrary,
we have proved that for any non-zero codeword c such that c C H ad , w t (c) = 2r 1 .
For the simplex code, we observe that all codewords of C H ad ,3 are obtained by padding a 0 to
the beginning of the codewords in C Si m,r , which implies that all non-zero codewords in C Si m,r
also have a weight of 2r 1 , which completes the proof.
We remark that the family of Hamming code has a rate of 1 and a (relative) distance of 0
while the families of Simplex/Hadamard codes have a rate of 0 and a relative distance of 1/2.
Notice that both code families either have rate or relative distance equal to 0. Given this, the
following question is natural special case of Question 2.5.1:
Question 2.7.1. Does there exist a family of codes C such that R(C ) > 0 and (C ) > 0 hold
simultaneously?
Codes that have the above property are called asymptotically good.
2.8 Exercises
Exercise 2.1. Prove that the set of rationals (i.e. the set of reals of the form ba , where both a and
b '= 0 are integers), denoted by Q, is a field.
Exercise 2.2. Let q be a prime power. Let x Fq such that x ' {0, 1}. Then prove that for any
n q 1:
n
"
x n+1 1
xi =
.
x 1
i =0
Exercise 2.3. Prove that for q = 2, the second condition in Definition 2.2.1 is implied by the first
condition.
Exercise 2.4. Prove that G 2 from (2.3) has full rank.
51
Exercise 2.5. In this problem we will look at the problem of solving a system of linear equations over Fq . That is, one needs to solve for unknowns x 1 , . . . , x n given the following m linear
equations (where a i , j , b i Fq for 1 i m and 1 j n):
a 1,1 x 1 + a 1,2 x 2 + + a 1,n x n = b 1 .
a 2,1 x 1 + a 2,2 x 2 + + a 2,n x n = b 2 .
..
.
(b) What happens if A does not have full rank? Show how one can modify the algorithm
above to either upper triangulate a matrix or report that it does not have full rank.
(Convince yourself that your modification works.)
(c) Call a system of equations A xT = bT consistent if there exists a solution to x Fnq .
Show that there exists an O(n 3 ) algorithm that finds the solution if the system of
equations is consistent and A has full rank (and report fail" otherwise).
4. (m < n case) Assume that A has full rank, i.e. has a rank of m. In this scenario either the
system of equations is inconsistent or there are q nm solutions to x. Modify the algorithm
from above to design an O(m 2 n) time algorithm to output the solutions (or report that the
system is inconsistent).
Note that in case the system is consistent there will be q nm solutions, which might
be much bigger than O(m 2 n). Show that this is not a problem as one can represent
the solutions as system of linear equations. (I.e. one can have n m free" variables
and m bound" variables.)
7
For this problem, any basic operation over Fq takes unit time.
52
5. (m > n case) Assume that A has full rank, i.e. a rank of n. In this scenario either the
system of equations is inconsistent or there is a unique solution to x. Modify the algorithm
from above to design an O(m 2 n) time algorithm to output the solution (or report that the
system is inconsistent).
6. (Non-full rank case) Give an O(m 2 n) algorithm for the general case, i.e. the m n matrix A
need not have full rank. (The algorithm should either report that the system of equations
is inconsistent or output the solution(s) to x.)
Exercise 2.6. Prove that the span of k linearly independent vectors over Fq has size exactly q k .
Exercise 2.7. Let G and H be a generator and parity check matrix of the same linear code of
dimension k and block length n. Then G H T = 0.
Exercise 2.8. Let C be an [n, k]q linear code with a generator matrix with no all zeros columns.
Then for every position i [n] and Fq , the number of codewords c C such that c i = is
exactly q k1 .
Exercise 2.9. Prove Proposition 2.3.1.
Exercise 2.10. Prove Proposition 2.3.2.
Exercise 2.11. Prove Proposition 2.3.3.
Exercise 2.12. A set of vector S Fnq is called t -wise independent if for every set of positions
I with |I | = t , the set S projected to I has each of the vectors in Ftq appear the same number
of times. (In other words, if one picks a vector (s 1 , . . . , s n ) from S at random then any of the t
random variables are uniformly and independently random over Fq ).
Prove that any linear code C whose dual C has distance d is (d 1)-wise independent.
Exercise 2.13. A set of vectors S Fk2 is called -biased sample space if the following property
holds. Pick a vector X = (x 1 , . . . , x k ) uniformly at random from S. Then X has bias at most , that
is, for every I [k],
1 2
3
2
31
1
1
"
"
1
1
x i = 0 Pr
x i = 1 1 .
1Pr
1
1
i I
i I
We will look at some connections of such sets to codes.
1. Let C be
4, 1 an [n,
- k]
, 12 code
- 5such that all non-zero codewords have Hamming weight in the
range 2 n, 2 + n . Then there exists an -biased space of size n.
2. Let C be
that all non-zero codewords have Hamming weight in the
4, an [n,
- k], 2 code
- such
5
range 12 n, 12 + n for some constant 0 < < 1/2. Then there exists an -biased
1
space of size n O(
log(1/))
Exercise 2.14. Let C be an [n, k, d ]q code. Let y = (y 1 , . . . , y n ) (Fq {?})n be a received word8
such that y i =? for at most d 1 values of i . Present an O(n 3 ) time algorithm that outputs a
codeword c = (c 1 , . . . , c n ) C that agrees with y in all un-erased positions (i.e., c i = y i if y i '=?) or
states that no such c exists. (Recall that if such a c exists then it is unique.)
8
A ? denotes an erasure.
53
Exercise 2.15. In the chapter, we did not talk about how to obtain the parity check matrix of a
linear code from its generator matrix. In this problem, we will look at this conversion" procedure.
(a) Prove that any generator matrix G of an [n, k]q code C (recall that G is a k n matrix) can
be converted into another equivalent generator matrix of the form G( = [Ik |A], where Ik is
the k k identity matrix and A is some k (n k) matrix. By equivalent," we mean that
the code generated by G( has a linear bijective map to C .
Note that the code generated by G( has the message symbols as its first k symbols in the
corresponding codeword. Such codes are called systematic codes. In other words, every
linear code can be converted into a systematic code. Systematic codes are popular in
practice as they allow for immediate access to the message symbols.
(b) Given an k n generator matrix of the form [Ik |A], give a corresponding (n k) n parity check matrix. Briefly justify why your construction of the parity check matrix is correct.
Hint: Try to think of a parity check matrix that can be decomposed into two submatrices: one will be closely related to A and the other will be an identity matrix, though the
latter might not be a k k matrix).
(c) Use part (b) to present a generator matrix for the [2r 1, 2r r 1, 3]2 Hamming code.
Exercise 2.16. So far in this book we have seen that one can modify one code to get another
code with interesting properties (for example, the construction of the Hadamard code from the
Simplex code from Section 2.7 and Exercise 1.7). In this problem you will need to come up with
more ways of constructing new codes from existing ones.
Prove the following statements (recall that the notation (n, k, d )q code is used for general
codes with q k codewords where k need not be an integer, whereas the notation [n, k, d ]q code
stands for a linear code of dimension k):
1. If there exists an (n, k, d )2m code, then there also exists an (nm, km, d ( d )2 code.
2. If there exists an [n, k, d ]2m code, then there also exists an [nm, km, d ( d ]2 code.
3. If there exists an [n, k, d ]q code, then there also exists an [n d , k 1, d ( 5d /q6]q code.
,
,
4. If there exists an [n, k, n]q code, then for every m 1, there also exists an n m , k/m, 1 (1 )m n m q m
code.
4
,
5
5. If there exists an [n, k, n]2 code, then for every m 1, there also exists an n m , k, 21 1 (1 2)m n m 2
code.
Note: In all the parts, the only things that you can assume about the original code are only the
parameters given by its definition nothing else!
54
Exercise 2.17. Let C 1 be an [n, k 1 , d 1 ]q code and C 2 be an [n, k 2 , d 2 ]q code. Then define a new
code as follows:
C 1 7C 2 = {(c1 , c1 + c2 )|c1 C 1 , c2 C 2 }.
Next we will prove interesting properties of this operations on codes:
1. If G i is the generator matrix for C i for i [2], what is a generator matrix for C 1 7C 2 ?
def
q r 1
q1 .
Exercise 2.20. Design the best 6-ary code (family) with distance 3 that you can.
Hint: Start with a 7-ary Hamming code.
Exercise 2.21. Prove that the [n, 1, n]2 code for odd n (i.e. the code with the all zeros and all ones
vector as it only two codewords) attains the Hamming bound (Theorem 1.7.1).
Exercise 2.22. Let C be an [n, k]q code with generator matrix G. Then given a codeword c C
one can compute the corresponding message in time O(kn 2 ).
Exercise 2.23. Given a c C H ,r , one can compute the corresponding message in time O(n).
Exercise 2.24. Let C be an (n, k)q code. Prove that if C can be decoded from e errors in time
T (n), then it can be decoded from n + c errors in time O((nq)c T (n)).
Exercise 2.25. Show that the bound of kd of the number of ones in the generator matrix of any
binary linear code (see Exercise 1.12) cannot be improved for every code.
, -
Exercise 2.26. Let C be a linear code. Then prove that C = C .
Exercise 2.27. Note that for any linear code C , the codewords 0 is in both C and C . Show that
there exists a linear code C such that it shares a non-zero codeword with C .
Exercise 2.28. A linear code C is called self-orthogonal if C C . Show that
1. The binary repetition code with even number of repetitions is self-orthogonal.
2. The Hadamard code C H ad ,r is self-orthogonal.
Exercise 2.29. A linear code C is called self dual if C = C . Show that for
1. Any self dual code has dimension n/2.
2. Prove that the following code is self-dual
{(x, x)|x Fk2 }.
Exercise 2.30. Given a code C a puncturing of C is another code C ( where the same set of positions are dropped in all codewords of C . More precisely, if C n and the set of punctured
positions is P [n], then the punctured code is {(c i )i 'P |(c 1 , . . . , c n ) C }.
Prove that a linear code with no repetitions (i.e. there are no two positions i '= j such that for
every codeword c C , c i = c i ) is a puncturing of the Hadamard code. Hence, Hadamard code is
the longest" linear code that does not repeat.
Exercise 2.31. In this problem we will consider the long code. For the definition, we will use the
functional way of looking at the ambient space as mentioned in Remark 1.2.1. A long code of
dimension k is a binary code such that the codeword corresponding to x = Fk2 , is the function
k
f : {0, 1}2 {0, 1} defined as follows. For any m {0, 1}F2 , we have f ((m )Fk ) = m x . Derive the
2
parameters of the long code.
Finally, argue that the long code is the code with the longest block length such that the
codewords do not have a repeated coordinate (i.e. there does not exists i '= j such that for every
codeword c, c i = c j ). (Contrast this with the property of Hadamard code above.)
56
57
Foreword
This chapter is based on lecture notes from coding theory courses taught by Venkatesan Guruswami at University at Washington and CMU; by Atri Rudra at University at Buffalo, SUNY
and by Madhu Sudan at MIT.
This version is dated August 15, 2014. For the latest version, please go to
http://www.cse.buffalo.edu/ atri/courses/coding-theory/book/
The material in this chapter is supported in part by the National Science Foundation under
CAREER grant CCF-0844796. Any opinions, findings and conclusions or recomendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the
National Science Foundation (NSF).
Chapter 3
Probability as Fancy Counting and the q-ary
Entropy Function
In the first half of this chapter, we will develop techniques that will allow us to answer questions
such as
where [0, 1] is shorthand for the interval of all real numbers between 0 and 1. In this book, we
will primarily deal with the following special distribution:
Definition 3.1.1 (Uniform Distribution). The uniform distribution over D, denoted by U D , is
given by
1
for every x D.
U D (x) =
|D|
Typically we will drop the subscript when the domain D is clear from the context.
59
U (G)
G
"
"
"
"
"
"
"
"
0
0
0
0
0
1
0
1
0
0
0
0
0
1
0
1
0
0
0
1
0
0
0
1
1
0
1
1
1
0
1
1
#
#
#
#
#
#
#
#
1
16
1
16
1
16
1
16
1
16
1
16
1
16
1
16
V00
0
0
0
0
0
0
0
0
V01
V10
0
1
1
2
0
1
1
2
0
0
0
0
1
1
1
1
V11
G
"
"
"
"
"
"
"
"
1
0
1
0
1
1
1
1
1
0
1
0
1
1
1
1
0
0
0
1
0
0
0
1
1
0
1
1
1
0
1
1
#
#
#
#
#
#
#
#
U (G)
V00
V01
V10
V11
1
16
1
16
1
16
1
16
1
16
1
16
1
16
1
16
xD
p(x) V (x).
$
%
For example, given (i , j ) {0, 1}2 , let Vi j denote the random variable Vi j (G) = w t (i , j ) G ,
for any G F22
2 . The last four columns of Table 3.1 list the values of these four random variables.
In this book, we will mainly consider binary random variables, i.e., with I = {0, 1}. In particular, given a predicate or event E over D, we will define its indicator variable 1E to be 1 if E is
1
In general, I need not be finite. However, for this book this definition suffices.
60
true and 0 if E is false. Sometimes, we will abuse notation and use E instead of 1E . For example,
consider the expectations of the four indicator variables:
'
&
1
E 1V00 =0 = 16
= 1.
16
&
'
1
1
E 1V01 =0 = 4
= .
16
4
&
'
1
1
E 1V10 =0 = 4
= .
16
4
&
'
1
1
E 1V11 =0 = 4
= .
16
4
(3.1)
(3.2)
(3.3)
m
!
i =1
Vi =
m
!
E [Vi ] .
i =1
xD
V (x) p(x)
*
m
! !
xD i =1
m !
!
i =1 xD
m
!
Vi (x) p(x)
Vi (x) p(x)
E[Vi ].
(3.4)
(3.5)
(3.6)
(3.7)
i =1
In the equalities above, (3.4) and (3.7) follow from the definition of expectation of a random
variable. (3.5) follows from the definition of V and (3.6) follows by switching the order of the
two summations.
61
As an example, we have
' 3
&
(3.8)
E 1V01 =0 + 1V10 =0 + 1V11 =0 =
4
Frequently, we will need to deal with the probability of the union" of events. We will use
the following result to upper bound such probabilities:
Proposition 3.1.3 (Union Bound). Given m binary random variables A 1 , . . . , A m , we have
+
)
(*
m
m
!
,
Pr
Ai = 1
Pr [A i = 1] .
i =1
i =1
Then we have
Pr
(*
m
,
i =1
Ai = 1 =
p(x)
(3.9)
p(x)
(3.10)
xm
S
i =1 i
m !
!
i =1 xS i
m
!
i =1
Pr[A i = 1].
(3.11)
In the above, (3.9) and (3.11) follow from the definition of S i . (3.10) follows from the fact that
some of the x i S i get counted more than once.
We remark that the union bound is tight when the events are disjoint. (In other words, using
the notation in the proof above, when S i S j = ( for every i )= j .)
As an example, let A 1 = 1V01 =0 , A 2 = 1V10 =0 and A 3 = 1V11 =0 . Note that in this case the event
A 1 A 2 A 3 is the same as the event that there exists a non-zero m {0, 1}2 such that w t (mG) =
0. Thus, the union bound implies (that under the uniform distribution over F22
2 )
&
' 3
Pr There exists an m {0, 1}2 \ {(0, 0)}, such that w t (mG) = 0 .
4
(3.12)
Finally, we present two bounds on the probability of a random variable deviating significantly from its expectation. The first bound holds for any random variable:
Lemma 3.1.4 (Markov Bound). Let V be a non-zero random variable. Then for any t > 0,
Pr[V t ]
In particular, for any a 1,
E[V ]
.
t
Pr[V a E[V ]]
62
1
.
a
Proof. The second bound follows from the first bound by substituting t = a E[V ]. Thus, to
complete the proof, we argue the first bound. Consider the following sequence of relations:
!
!
E[V ] =
i Pr[V = i ] +
i Pr[V = i ]
(3.13)
i [0,t )
i t
i Pr[V = i ]
i t
i [t ,)
Pr[V = i ]
= t Pr[V t ].
(3.14)
(3.15)
(3.16)
In the above relations, (3.13) follows from the definition of expectation of a random variable and
the fact that V is positive. (3.14) follows as we have dropped some non-negative terms. (3.15)
follows by noting that in the summands i t . (3.16) follows from the definition of Pr[V t ].
The proof is complete by noting that (3.16) implies the claimed bound.
The second bound works only for sums of independent random variables. We begin by
defining independent random variables:
Definition 3.1.3 (Independence). Two random variables A and B are called independent if for
every a and b in the ranges of A and B , we have
Pr[A = a B = b] = Pr[A = a] Pr[B = b].
For example, for the uniform distribution in Table 3.1, let A denote the bit G 0,0 and B denote
the bit G 0,1 . It can be verified that these two random variables are independent. In fact, it can be
verified all the random variables corresponding to the four bits in G are independent random
variables. (Well come to a related comment shortly.)
Another related concept that we will use is that of probability of an event happening conditioned on another event happening:
Definition 3.1.4 (Conditional Probability). Given two events A and B defined over the same
domain and probability distribution, we define the probability of A conditioned on B as
Pr[A|B ] =
Pr[A and B ]
.
Pr[B ]
4/16 1
= .
1/2
2
The above definition implies that two events A and B are independent if and only if Pr[A] =
Pr[A|B ]. We will also use the following result later on in the book (see Exercise 3.2):
Pr[1V01 =1 |G 0,0 = 0] =
Lemma 3.1.5. For any two events A and B defined on the same domain and the probability
distribution:
Pr[A] = Pr[A|B ] Pr[B ] + Pr[A|B ] Pr[B ].
63
Next, we state the deviation bound. (We only state it for sums of binary random variables,
which is the form that will be needed in the book.)
Theorem 3.1.6 (Chernoff Bound). Let X 1 , . . . , X m be independent binary random variables and
define X = X i . Then the multiplicative Chernoff bound sates
Pr [|X E(X )| > E(X )] < e
E(X )/3
m/2
We omit the proof, which can be found in any standard textbook on randomized algorithms.
Finally, we present an alternate view of uniform distribution over product spaces" and then
use that view to prove a result that we will use later in the book. Given probability distributions
p 1 and p 2 over domains D1 and D2 respectively, we define the product distribution p 1 p 2 over
D1 D2 as follows: every element (x, y) D1 D2 under p 1 p 2 is picked by choosing x from
D1 according to p 1 and y is picked independently from D2 under p 2 . This leads to the following
observation (see Exercise 3.3).
Lemma 3.1.7. For any m 1, the distribution U D1 D2 Dm is identical to the distribution U D1
U D2 U Dm .
For example, the uniform distribution in Table 3.1 can be described equivalently as follows:
pick each of the four bits in G independently and uniformly at random from {0, 1}.
We conclude this section by proving the following result:
Lemma 3.1.8. Given a non-zero vector m Fkq and a uniformly random k n matrix G over Fq ,
the vector m G is uniformly distributed over Fnq .
Proof. Let the ( j , i )th entry in G (1 j k, 1 i n) be denoted by g j i . Note that as G is a random k n matrix over Fq , by Lemma 3.1.7, each of the g j i is an independent uniformly random
element from Fq . Now, note that we would be done if we can show that for every 1 i n, the
i th entry in m G (call it b i ) is an independent uniformly random element from Fq . To finish
the proof, we prove this latter fact. If we denote m = (m 1 , . . . , m k ), then b i = kj=1 m j g j i . Note
that the disjoint entries of G participate in the sums for b i and b j for i )= j . Given our choice of
G, this implies that the random variables b i and b j are independent. Hence, to complete the
proof we need to prove that b i is a uniformly independent element of Fq . The rest of the proof
is a generalization of the argument we used in the proof of Proposition 2.7.1.
Note that to show that b i is uniformly distributed over Fq , it is sufficient to prove that b i
takes every value in Fq equally often over all the choices of values that can be assigned to
g 1i , g 2i , . . . , g ki . Now, as m is non-zero, at least one of the its element is non-zero: without loss of
generality assume that m 1 )= 0. Thus, we can write b i = m 1 g 1i + kj=2 m j g j i . Now, for every fixed
assignment of values to g 2i , g 3i , . . . , g ki (note that there are q k1 such assignments), b i takes a
different value for each of the q distinct possible assignments to g 1i (this is where we use the
assumption that m 1 )= 0). Thus, over all the possible assignments of g 1i , . . . , g ki , b i takes each of
the values in Fq exactly q k1 times, which proves our claim.
64
Note that the above inequality proves the existence of C with property P .
As an example consider Question 3.0.1. To answer this in the affirmative, we note that the
set of all [2, 2]2 linear codes is covered by the set of all 2 2 matrices over F2 . Then, we let D be
the uniform distribution over F222 . Then by Proposition 2.3.4 and (3.12), we get that
Pr [There is no [2, 2, 1]2 code]
U F22
2
3
< 1,
4
which by the probabilistic method answers the Question 3.0.1 in the affirmative.
For the more general case, when we apply the probabilistic method, the typical approach
will be to define (sub-)properties P 1 , . . . , P m such that P = P 1 P 2 P 3 . . .P m and show that for
every 1 i m:
. / 1
&
'
Pr C doesnt have property P i = Pr P i < .
m
&
'
2
Finally, by the union bound, the above will prove that Pr C doesnt have property P < 1, as
desired.
As an example, an alternate way to answer Question 3.0.1 in the affirmative is the following.
Define P 1 = 1V01 1 , P 2 = 1V10 1 and P 3 = 1V11 1 . (Note that we want a [2, 2]2 code that satisfies
P 1 P 2 P 3 .) Then, by (3.1), (3.2) and (3.3), we have for i [3],
. / 1 1
&
'
Pr C doesnt have property P i = Pr P i = < ,
4 3
as desired.
Finally, we mention a special case of the general probabilistic method that we outlined
above. In particular, let P denote the property that the randomly chosen C satisfies f (C ) b.
Then we claim (see Exercise 3.4) that E[ f (C )] b implies that Pr[C has property P ] > 0. Note
that this implies that E[ f (C )] b implies that there exists a code C such that f (C ) b.
Note that P = P 1 P 2 P m .
65
Definition 3.3.1 (q-ary Entropy Function). Let q be an integer and x be a real number such that
q 2 and 0 x 1. Then the q-ary entropy function is defined as follows:
H q (x) = x logq (q 1) x logq (x) (1 x) logq (1 x).
Figure 3.1 presents a pictorial representation of the H q function for the first few values of q.
For the special case of q = 2, we will drop the subscript from the entropy function and denote
1
q=2
q=3
q=4
0.9
0.8
0.7
Hq(x) --->
0.6
0.5
0.4
0.3
0.2
0.1
0
0
0.2
0.4
0.6
0.8
x --->
Figure 3.1: A plot of H q (x) for q = 2, 3 and 4. The maximum value of 1 is achieved at x = 11/q.
H2 (x) by just H (x), that is, H (x) = x log x (1 x) log(1 x), where log x is defined as log2 (x)
(we are going to follow this convention for the rest of the book).
Under the lens of Shannons entropy function, H (x) denotes the entropy of the distribution
over {0, 1} that selects 1 with probability x and 0 with probability 1 x. However, there is no
similar analogue for the more general H q (x). The reason why this quantity will turn out to be
so central in this book is that it is very closely related to the volume" of a Hamming ball. We
make this connection precise in the next subsection.
The choice of 0 as the center for the Hamming ball above was arbitrary: since the volume
of a Hamming ball is independent of its center (as is evident from the last equality above), we
could have picked any center.
We will prove the following result:
Proposition 3.3.1. Let q 2 be an integer and 0 p 1 q1 be a real. Then for large enough n:
(i) V ol q (pn, n) q Hq (p)n ; and
(ii) V ol q (pn, n) q Hq (p)no(n) .
Proof. We start with the proof of (i). Consider the following sequence of relations:
1 = (p + (1 p))n
* +
n n
!
=
p i (1 p)ni
i
i =0
* +
* +
pn
n
!
!
n i
n i
ni
p (1 p)ni
p (1 p)
+
=
i =pn+1 i
i =0 i
* +
pn
!
n i
p (1 p)ni
i
i =0
* +
"
#
pn
!
p i
n
i
(q 1)
=
(1 p)ni
i
q
1
i =0
* +
"
#i
pn
!
p
n
i
n
(q 1) (1 p)
=
(q 1)(1 p)
i =0 i
* +
"
#pn
pn
!
p
n
i
n
(q 1) (1 p)
(q 1)(1 p)
i =0 i
* +
#
"
pn
!
p pn
n
(1 p)(1p)n
(q 1)i
=
q
1
i
i =0
V ol q (pn, n)q Hq (p)n .
(3.17)
(3.18)
(3.19)
(3.20)
(3.21)
In the above, (3.17) follows from the binomial expansion. (3.18) follows by dropping the second
p
sum and (3.19) follows from that facts that (q1)(1p) 1 (as3 p 1 1/q) and pn 1 (for large
enough n).0 Rest1 of the steps except (3.21) follow from rearranging the terms. (3.21) follows as
p
pn
q Hq (p)n = q1
(1 p)(1p)n .
(3.21) implies that
p
(q1)(1p)
1 is true if
p
1p
q1
1 ,
67
q1
q ,
We now turn to the proof of part (ii). For this part, we will need Stirlings approximation for
n! (Lemma B.1.2).
By the Stirlings approximation, we have the following inequality:
* +
n
n!
=
pn
(pn)!((1 p)n)!
>
=
where $(n) = e
(n/e)n
p pn (1 p)(1p)n
/
2p(1p)n
$(n),
1
e 1 (n)2 (pn)2 ((1p)n)
2
2p(1 p)n
(3.22)
Now consider the following sequence of relations that complete the proof:
* +
n
(q 1)pn
V ol q (pn, n)
pn
>
(q 1)pn
p pn (1 p)(1p)n
$(n)
q Hq (p)no(n) .
(3.23)
(3.24)
(3.25)
In the above (3.23) follows by only looking at one term. (3.24) follows from (3.22) while (3.25)
follows from the definition of H q () and the fact that for large enough n, $(n) is q o(n) .
Next, we consider how the q-ary entropy function behaves for various ranges of its parameters.
H q () + .
Next, we consider the case when q = 2o(1/) . We begin by claiming that for small enough ,
if q 1/2 then logq (q 1) 1 .
Indeed, logq (q 1) = 1 + (1/ ln q) ln(1 1/q) = 1 O
(and small enough $).%
1
Finally, if q = 2o , then for fixed ,
1
q ln q
$1%
as desired. For q 1/2 , Lemma 3.3.3 shows that 1 H q () 1 H1/2 () < 1 , as desired.
We will also be interested in how H q (x) behaves for fixed x and increasing q:
Lemma 3.3.3. Let q 2 be an integer and let 0 1 1/q, then for any real m 1 such that
q
m1
"
1+
1
q 1
#q1
(3.26)
we have
H q () H q m ().
Proof. Note that H q (0) = H q m (0) = 0. Thus, for the rest of the proof we will assume that
(0, 1 1/q].
As observed in the proof of Proposition 3.3.2, we have
H q () =
1
log(q 1)
+ H ()
.
log q
log q
#
"
#
log(q 1) log(q m 1)
1
1
H q () H q m () =
+ H ()
.
log q
m log q
log q m log q
The above in turn implies that
1
H ()
m log q (H q () H q m ()) = log(q 1)m log(q m 1) +
(m 1)
The last equality follows from the fact that by Lemma B.2.2, for 0 < x < 1, ln(1 x) = O(x).
69
H (1 1/q)
(m 1)
(3.27)
1 1/q
#
"
log q
q
m
m
+
= log(q 1) log(q 1) + (m 1) log
q 1 q 1
"
#
"
#
(q 1)m
q m1 m1
q1
= log
q
qm 1
q 1
*
m1 +
(q 1) q m1 q q1
= log
qm 1
(3.28)
In the above (3.27) follows from the fact that H ()/ is decreasing5 in and that 1 1/q.
(3.28) follows from the the claim that
m1
(q 1) q q1 q.
Indeed the above follows from (3.26).
Finally, note that (3.28) completes the proof.
Since (1 + 1/x)x e (by Lemma B.2.3), we also have that (3.26) is also satisfied for m 1 +
Further, we note that (3.26) is satisfied for every m 2 (for any q 3), which leads to the
following (also see Exercise 3.5):
1
ln q .
Corollary 3.3.4. Let q 3 be an integer and let 0 1 1/q, then for any m 2, we have
H q () H q m ().
Next, we look at the entropy function when its input is very close to 1.
Proposition 3.3.5. For small enough > 0,
"
#
1
H q 1 1 c q 2 ,
q
where c q is a constant that only depends on q.
Proof. The intuition behind the proof is the following. Since the derivative of H q (x) is zero at
x = 1 1/q, in the Taylor expansion of H q (1 1/q ) the term will vanish. We will now make
this intuition more concrete. We will think of q as fixed and 1/ as growing. In particular, we
will assume that < 1/q. Consider the following equalities:
"
"
"
#
# "
#
#
1
1 1/q
1
1
H q (1 1/q ) = 1 logq
+ logq
+
q
q 1
q
q
5
Indeed, H ()/ = log(1/) (1/ 1) log(1 ). Note that the first term is deceasing in . We claim that the
second term is also decreasing in this e.g. follows from the observation that (1/ 1) ln(1 ) = (1 )(1 +
/2! + 2 /3! + ) = 1 /2 2 (1/2 1/3!) is also decreasing in .
70
=
=
=
## "
#
"
#
" "
q
1
1 (q)/(q 1)
1
1
+
+ logq
logq
q
q 1
q
1 + q
3 "
# "
# "
#4
1
q
1
1 (q)/(q 1)
1
ln 1
+ ln
ln q
q 1
q
1 + q
3
"
#"
2 2
1
q
q
1
q
2
1 + o( )
+
2
ln q
q 1 2(q 1)
q
q 1
2 2
2 2 #4
q
q
q +
2
2(q 1)
2
3
2 2
1
q
q
1 + o(2 )
ln q
q 1 2(q 1)2
"
#4
#"
1
q 2
2 q 3 (q 2)
+
+
q
q 1
2(q 1)2
4
3
1
2 q 2
2 q 2 2 q 2 (q 2)
2
1 + o( )
ln q
2(q 1)2 q 1
2(q 1)2
= 1
1
(3.29)
(3.30)
2 q 2
+ o(2 )
2 ln q(q 1)
2 q 2
4 ln q(q 1)
(3.31)
(3.29) follows from the fact that for |x| < 1, ln(1 + x) = x x 2 /2 + x 3 /3 . . . (Lemma B.2.2) and
by collecting the 3 and smaller terms in o(2 ). (3.30) follows by rearranging the terms and by
absorbing the 3 terms in o(2 ). The last step is true assuming is small enough.
Next, we look at the entropy function when its input is very close to 0.
Proposition 3.3.6. For small enough > 0,
" ##
1
1
log
.
H q () =
log q
"
Proof. By definition
H q () = logq (q 1) + logq (1/) + (1 ) logq (1/(1 )).
Since all the terms in the RHS are positive we have
H q () log(1/)/ log q.
(3.32)
Further, by Lemma B.2.2, (1 ) logq (1/(1 )) 2/ ln q for small enough . Thus, this implies
that
" #
2 + ln(q 1)
1
1
H q ()
+
ln
.
(3.33)
ln q
ln q
71
We will also work with the inverse of the q-ary entropy function. Note that H q () on the
domain [0, 11/q] is an bijective map into [0, 1]. Thus, we define H q1 (y) = x such that H q (x) = y
and 0 x 1 1/q. Finally, we will need the following lower bound.
Lemma 3.3.7. For every 0 y 1 1/q and for every small enough > 0,
H q1 (y 2 /c q0 ) H q1 (y) ,
where c q0 1 is a constant that depends only on q.
Proof. It is easy to check that H q1 (y) is a strictly increasing convex function in the range y
[0, 1]. This implies that the derivative of H q1 (y) increases with y. In particular, (H q1 )0 (1)
(H q1 )0 (y) for every 0 y 1. In other words, for every 0 < y 1, and (small enough) > 0,
H q1 (y)H q1 (y)
H q1 (1)H q1 (1)
and H q1 is increasing completes the proof if one picks c q0 = max(1, 1/c q ) and = 2 /c q0 .
1 1/q
3.4 Exercises
Exercise 3.1. Prove Lemma 3.1.1.
Exercise 3.2. Prove Lemma 3.1.5.
Exercise 3.3. Prove Lemma 3.1.7.
Exercise 3.4. Let P denote the property that the randomly chosen C satisfies f (C ) b. Then
E[ f (C )] b implies that Pr[C has property P ] > 0.
Exercise 3.5. Show that for any Q q 2 and 1 1/q, we have HQ () H q ().
72
Foreword
This chapter is based on lecture notes from coding theory courses taught by Venkatesan Guruswami at University at Washington and CMU; by Atri Rudra at University at Buffalo, SUNY
and by Madhu Sudan at MIT.
This version is dated August 15, 2014. For the latest version, please go to
http://www.cse.buffalo.edu/ atri/courses/coding-theory/book/
The material in this chapter is supported in part by the National Science Foundation under
CAREER grant CCF-0844796. Any opinions, findings and conclusions or recomendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the
National Science Foundation (NSF).
Chapter 4
What Can and Cannot Be Done-I
In this chapter, we will try to tackle Question 2.5.1. We will approach this trade-off in the following way:
If we fix the relative distance of the code to be , what is the best rate R that we can
achieve?
Note that an upper bound on R is a negative result, while a lower bound on R is a positive result.
In this chapter, we will consider only one positive result, i.e. a lower bound on R called the
Gilbert-Varshamov bound in Section 4.2. In Section 4.1, we recall a negative result that we have
already seen Hamming bound and state its asymptotic version to obtain an upper bound on
R. We will consider two other upper bounds: the Singleton bound (Section 4.3), which gives
a tight upper bound for large enough alphabets (but not binary codes) and the Plotkin bound
(Section 4.4).
R 1 Hq
+ o(1).
2
See Figure 4.1 for a pictorial description of the Hamming bound for binary codes.
75
Hamming bound
GV bound
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
0
0.2
0.4
0.6
0.8
Figure 4.1: The Hamming and GV bounds for binary codes. Note that any point below the GV
bound is achievable by some code while no point above the Hamming bound is achievable by
any code. In this part of the book we would like to push the GV bound as much up as possible
while at the same time try and push down the Hamming bound as much as possible.
Add v to C
4: RETURN C
3:
c3
c2
c5
c1
c4
d 1
[q]n
Figure 4.2: An illustration of Gilberts greedy algorithm (Algorithm 5) for the first five iterations.
cannot add it later. Indeed, since we only add vectors to C , if a vector v [q]n is ruled out in a
certain iteration of Step 2 because (c, v) < d , then in all future iterations, we have (v, c) < d
and thus, this v will never be added in Step 3 in any future iteration.
The running time of Algorithm 5 is q O(n) . To see this note that Step 2 in the worst-case could
be repeated for every vector in [q]n , that is at most q n times. In a naive implementation, for
each iteration, we cycle through all vectors in [q]n and for each vector v [q]n , iterate through
all (at most q n ) vectors c C to check whether (c, v) < d . If no such c exists, then we add v to C
otherwise, we move to the next v. However, note that we can do slightly better since we know
that once a v is rejected" in an iteration, itll keep on being rejected in the future iterations, we
can fix up an ordering of vectors in [q]n and for each vector v in this order, check whether it can
be added to C or not. If so, we add v to C , else we move to the next vector in the order. This
algorithm has time complexity O(nq 2n ), which is still q O(n) .
Further, we claim that after termination of Algorithm 5
!
cC
B (c, d 1) [q]n .
This is because if not, then there exists a vector v [q]n \C , such that (v, c) d and hence v can
77
be added to C . However, this contradicts the fact that Algorithm 5 has terminated. Therefore,
"
"
"!
"
" B (c, d 1)" q n .
"
"
(4.1)
cC
cC
"
"
"!
"
"
|B (c, d 1)| " B (c, d 1)"" ,
cC
cC
|B (c, d 1)| q n
cC
Since
cC V ol q (d
V ol q (d 1, n) q n .
1, n) = V ol q (d 1, n) |C |, we have
|C |
qn
V ol q (d 1, n)
qn
q nHq ()
(4.2)
= q n(1Hq ()) ,
as desired. In the above, (4.2) follows from the fact that
V ol q (d 1, n) V ol q (n, n)
q nHq () ,
(4.3)
where the second inequality follows from the upper bound on the volume of a Hamming ball in
Proposition 3.3.1.
It is worth noting that the code from Algorithm 5 is not guaranteed to have any special structure. In particular, even storing the code can take exponential space. We have seen in Proposition 2.3.1 that linear codes have a much more succinct representation. Thus, a natural question
is:
Question 4.2.1. Do linear codes achieve the R 1 H q () tradeoff that the greedy construction achieves?
Next, we will answer the question in the affirmative.
78
V ol q (d 1, n)
qn
q nHq ()
,
qn
(4.4)
where (4.4) follows from (4.3). Thus, by the union bound (Lemma 3.1.3)
P r [There exists a non-zero m, w t (mG) < d ] q k q n(1Hq ())
= q n ,
needed for the volume bound (recall the bound in Proposition 3.3.1): V ol q (n, n) q Hq ()n to
hold. It is natural to wonder if the above is just an artifact of the proof or, for example,
79
c1
c2
ci
c+i
cj
c+i
cM
d 1
n d +1
Figure 4.3: Construction of a new code in the proof of the Singleton bound.
Question 4.2.2. Does there exists a code with R > 0 and > 1 q1 ?
We will return to this question in Section 4.4.
Hamming bound
GV bound
Singleton bound
0.8
0.6
0.4
0.2
0
0
0.2
0.4
0.6
0.8
Figure 4.4: The Hamming, GV and Singleton bound for binary codes.
Note that the asymptotic version of the Singleton bound states that k/n 1 d /n + 1/n. In
other words,
R 1 + o(1).
Figure 4.4 presents a pictorial description of the asymptotic version of the Singleton bound.
It is worth noting that the bound is independent of the alphabet size. As is evident from Figure 4.4, the Singleton bound is worse than the Hamming bound for binary codes. However, this
bound is better for larger alphabet sizes. In fact, we will look at a family of codes called ReedSolomon codes in Chapter 5 that meets the Singleton bound. However, the alphabet size of the
Reed-Solomon codes increases with the block length n. Thus, a natural follow-up question is
the following:
Question 4.3.1. Given a fixed q 2, does there exist a q-ary code that meets the Singleton
bound?
Well see an answer to this question in the next section.
Theorem 4.4.1 (Plotkin bound). The following holds for any code C [q]n with distance d :
%
&
1. If d = 1 q1 n, |C | 2qn.
&
%
2. If d > 1 q1 n, |C |
qd
qd (q1)n .
Note that the Plotkin bound (Theorem 4.4.1) implies that a code with relative distance
1 q1 , must necessarily have R = 0, which answers Question 4.2.2 in the negative.
Before we prove Theorem 4.4.1, we make couple of remarks. We first note that the upper
bound in the first part of Theorem 4.4.1 can be improved to 2n for q = 2. (See Exercise 4.11.)
Second, it can be shown that this bound is tight see Exercise 4.12. Third, the statement of
Theorem 4.4.1 gives a trade-off only for relative distance greater than 1 1/q. However, as the
following corollary shows, the result can be extended to work for 0 1 1/q. (See Figure 4.5
for an illustration for binary codes.)
%
&
q
Corollary 4.4.2. For any q-ary code with distance , R 1 q1 + o(1).
qd
q1
C x = {(c nn + +1 , . . . c n ) | (c 1 . . . c N ) C , (c 1 . . . c nn + ) = x} .
Define d = n. For all x, C x% has distance
d as C has distance d .1 Additionally, it has block length
&
q
qd
qd ,
qd (q 1)n +
(4.5)
where the second inequality follows from the fact that qd (q 1)n + is an integer.
Note that by the definition of C x :
|C | =
+
x[q]nn
|C x | ,
x[q]nn
In other words, R 1
1
qd = q
q
q1
&
nn +
qd q
n q1 d +o(n)
=q
%
&
q
n 1 q1 +o(1)
+ o(1) as desired.
If for some x, c1 ,= c2 C x , (c1 , c2 ) < d , then ((x, c1 ), (x, c2 )) < d , which implies that the distance of C is less
than d (as by definition of C x , both (x, c1 ), (x, c2 ) C ).
82
Hamming bound
GV bound
Singleton bound
Plotkin bound
0.8
0.6
0.4
0.2
0
0
0.2
0.4
0.6
0.8
Figure 4.5: The current bounds on the rate R vs. relative distance for binary codes. The GV
bound is a lower bound on rate while the other three bounds are upper bounds on R.
Note that Corollary 4.4.2 implies that for any q-ary code of rate R and relative distance
(where q is a constant independent of the block length of the code), R < 1 . In other words,
this answers Question 4.3.1 in the negative.
Let us pause for a bit at this point and recollect the bounds on R versus that we have proved
till now. Figure 4.5 depicts all the bounds we have seen till now (for q = 2). The GV bound is
the best known lower bound at the time of writing of this book. Better upper bounds are known
and we will see one such trade-off (called the Elias-Bassalygo bound) in Section 8.1.
Now, we turn to the proof of Theorem 4.4.1, for which we will need two more lemmas.
The first lemma deals with vectors over real spaces. We quickly recap the necessary definin
tions. Consider
) a vector v in R , that is, a tuple of n real numbers. This vector has (Euclidean)
norm -v- = v 12 + v 22 + . . . + v n2 , and is a unit vector if and only if its norm is 1. The inner product
$
of two vectors, u and v, is u, v = i u i v i . The following lemma gives a bound on the number
of vectors that can exist such that every pair is at an obtuse angle with each other.
Lemma 4.4.3 (Geometric Lemma). Let v1 , v2 , . . . , vm RN be non-zero vectors.
1. If vi , v j 0 for all i ,= j , then m 2N .
2. Let vi be unit vectors for 1 i m. Further, if vi , v j < 0 for all i ,= j , then m 1 + 1 .2
(Item 1 is tight: see Exercise 4.13.) The proof of the Plotkin bound will need the existence of a
map from codewords to real vectors with certain properties, which the next lemma guarantees.
2
Note that since vi and v j are both unit vectors, vi , v j is the cosine of the angle between them.
83
Lemma 4.4.4 (Mapping Lemma). Let C [q]n . Then there exists a function f : C Rnq such
that
1. For every c C , - f (c)- = 1.
2. For every c1 ,= c2 such that c1 , c2 C , f (c1 ), f (c2 ) = 1
q
q1
&%
(c1 ,c2 )
n
&
We defer the proofs of the lemmas above to the end of the section. We are now in a position
to prove Theorem 4.4.1.
Proof of Theorem 4.4.1 Let C = {c1 , c2 , . . . , cm }. For all i ,= j ,
,
,
*
+
(ci , c j )
q
q
d
f (ci ), f (c j ) 1
1
.
q 1
n
q 1 n
The first inequality holds
by
%
& Lemma 4.4.4, and the second holds as C has distance d .
For part 1, if d = 1 q1 n =
(q1)n
,
q
+
f (ci ), f (c j ) 0
q1
q
,
q
d
qd (q 1)n
f (ci ), f (c j ) 1
=
q 1 n
(q 1)n
&
%
def qd (q1)n
> 0, we can apply the second part of Lemma 4.4.3. Thus, m 1 +
and, since =
(q1)n
(q1)n
qd (q1)n
qd
qd (q1)n ,
as desired
(4.6)
Since rotating all the vectors by the same amount does not change the sign of the inner
product (nor does scaling any of the vectors), w.l.o.g. we can assume that vm = 1, 0, . . . , 0. For
1 i m 1, denote the vectors as vi = i , yi , for some i R and yi RN 1 . Now, for any
$
i ,= 1, v1 , vi = 1i + m
i =2 0 = i . However, note that (4.6) implies that v1 , vi 0, which in turn
implies that
i 0.
(4.7)
84
Next, we claim that at most one of y1 , . . . , ym1 can be the all zeroes vector, 0. If not, assume
w.l.o.g., that y1 = y2 = 0. This in turn implies that
v1 , v2 = 1 2 + y1 , y2
= 1 2 + 0
= 1 2
> 0,
where the last inequality follows from the subsequent argument. As v1 = 1 , 0 and v2 = 2 , 0
are non-zero, this implies that 1 , 2 ,= 0. (4.7) then implies that 1 , 2 < 0. However, v1 , v2 > 0
contradicts (4.6).
Thus, w.l.o.g., assume that v1 , . . . , vm2 are all non-zero vectors. Further, note that for every
i ,= j [m 2], yi , y j = vi , v j i j vi , v j 0. Thus, we have reduced problem on m
vectors with dimension N to an equivalent problem on m2 vectors with dimension dimension
N 1. If we continue this process, we can conclude that every loss in dimension of the vector
results in twice in loss in the numbers of the vectors in the set. Induction then implies that
m 2N , as desired.
We now move on to the proof of the second part. Define z = v1 + . . . + vm . Now consider the
following sequence of relationships:
. /
m
-z- = -vi - + 2 vi , v j m + 2
() = m(1 m + ).
2
i =1
i<j
2
m
#
The inequality follows from the facts that each vi is a unit vector and the assumption that for
every i ,= j , vi .v j . As -z-2 0,
m(1 m + ) 0.
Thus, we have m 1 + 1 , as desired.
Finally, we prove Lemma 4.4.4.
Proof of Lemma 4.4.4. We begin by defining a map : [q] Rq with certain properties. Then
we apply to all the coordinates of a codeword to define the map f : Rq Rnq that satisfies the
claimed properties. We now fill in the details.
Define : [q] Rq as follows. For every i [q], we define
(i ) =
1 1
(q 1)
1
, ,...,
,...
q q
q
q
1 23 4
i th position
That is, all but the i th position in (i ) Rq has a value of 1/q and the i th position has value
(q 1)/q.
85
Next, we record two properties of that follow immediately from its definition. For every
i [q],
(q 1) (q 1)2 (q 1)
+
=
.
(4.8)
(i )2 =
q2
q2
q
Also for every i ,= j [q],
(i ), ( j ) =
(q 2) 2(q 1)
1
.
q2
q2
q
(4.9)
We are now ready to define our final map f : C Rnq . For every c = (c 1 , . . . , c n ) C , define
f (c) =
(The multiplicative factor
q
n(q1)
7
8
q
(c 1 ), (c 2 ), . . . , (c n ) .
n(q 1)
To complete the proof, we will show that f satisfies the claimed properties. We begin with
condition 1. Note that
n "
#
"
q
"(i )"2 = 1,
- f (c)-2 =
(q 1)n i =1
where the first equality follows from the definition of f and the second equality follows from
(4.8).
We now turn to the second condition. For notational convenience define c1 = (x 1 , . . . , x n )
and c2 = (y 1 , . . . , y n ). Consider the following sequence of relations:
*
n *
+ #
+
f (c1 ), f (c2 ) =
f (x % ), f (y % )
%=1
# *
%:x % ,= y %
(x % ), (y % ) +
# *
%:x % =y %
: ,
(x % ), (y % )
+
q
n(q 1)
-: ,
#
q
q 1
1
+
=
q
n(q 1)
%:x % =y %
%:x % ,= y % q
;
, ,
-< ,
1
q 1
q
= (c1 , c2 )
+ (n (c1 , c2 ))
q
q
n(q 1)
-;
<
,
1 q 1
q
+
= 1 (c1 , c2 )
n(q 1) q
q
,
-,
q
(c1 , c2 )
= 1
,
q 1
n
9
(4.10)
(4.11)
as desired. In the above, (4.10) is obtained using (4.9) and (4.8) while (4.11) follows from the
definition of the Hamming distance.
!
86
4.5 Exercises
Exercise 4.1. Pick a (n k) n matrix H over Fq at random. Show that with high probability the
code whose parity check matrix is H achieves the GV bound.
Exercise 4.2. Recall the definition of an -biased space from Exercise 2.13. Show that there exists
an -biased space of size O(k/2 ).
Hint: Recall part 1 of Exercise 2.13.
Exercise 4.3. Argue that a random linear code as well as its dual both lie on the corresponding
GV bound.
Exercise 4.4. In Section 4.2.2, we saw that random linear code meets the GV bound. It is natural
to ask the question for general random codes. (By a random (n, k)q code, we mean the following:
for each of the q k messages, pick a random vector from [q]n . Further, the choices for each
codeword is independent.) We will do so in this problem.
1. Prove that a random q-ary code with rate R > 0 with high probability has relative distance
H q1 (1 2R ). Note that this is worse than the bound for random linear codes in
Theorem 4.2.1.
2. Prove that with high probability the relative distance of a random q-ary code of rate R is
at most H q1 (1 2R) + . In other words, general random codes are worse than random
linear codes in terms of their distance.
Hint: Use Chebyshevs inequality.
Exercise 4.5. We saw that Algorithm 5 can compute an (n, k)q code on the GV bound in time
q O(n) . Now the construction for linear codes is a randomized construction and it is natural to
ask how quickly can we compute an [n, k]q code that meets the GV bound. In this problem,
we will see that this can also be done in q O(n) deterministic time, though the deterministic
algorithm is not that straight-forward anymore.
1. Argue that Theorem 4.2.1 gives a q O(kn) time algorithm that constructs an [n, k]q code
on the GV bound. (Thus, the goal of this problem is to shave" off a factor of k from the
exponent.)
,n
2. A k n Toeplitz Matrix A = {A i , j }ki =1,
satisfies the property that A i , j = A i 1, j 1 . In other
j =1
words, any diagonal has the same value. For example, the following is a 4 6 Toeplitz
matrix:
1 2 3 4 5 6
7 1 2 3 4 5
8 7 1 2 3 4
9 8 7 1 2 3
Prove the following claim: For any non-zero m Fkq , the vector m T is uniformly disC
D
tributed over Fnq , that is for every y Fnq , Pr m T = y = q n .
3. Briefly argue why the claim in part 2 implies that a random code defined by picking its
generator matrix as a random Toeplitz matrix with high probability lies on the GV bound.
4. Conclude that an [n, k]q code on the GV bound can be constructed in time q O(k+n) .
Exercise 4.6. Show that one can construct the parity check matrix of an [n, k]q code that lies on
the GV bound in time q O(n) .
Exercise 4.7. So far in Exercises 4.5 and 4.6, we have seen two constructions of [n, k]q code on
the GV bound that can be constructed in q O(n) time. For constant rate codes, at the time of
writing of this book, this is fastest known construction of any code that meets the GV bound.
For k = o(n), there is a better construction known, which we explore in this exercise.
We begin with some notation. For the rest of the exercise we will target a distance of d = n.
Given a message m Fkq and an [n, k]q code C , define the indicator variable:
Wm (C ) =
1 if w t (C (m)) < d
0
otherwise.
Further, define
D(C ) =
Wm (C ).
mFkq \{0}
We will also use D(G) and Wm (G) to denote the variables above for the code C generated by G.
Given an k n matrix M , we will use M i to denote the i th column of M and M i to denote
the column submatrix of M that contains the first i columns. Finally below we will use G to
denote a uniformly random k n generator matrix and G to denote a specific instantiation of
the generator matrix. We will arrive at the final construction in a sequence of steps. In what
follows define k < (1 H q ())n for large enough n.
1. Argue that C has a distance d if and only if D(C ) < 1.
2. Argue that E [D(G )] < 1.
3. Argue that for any 1 i < n and fixed k n matrix G,
F
G
F
G
min E D(G )|G i = G i , G i +1 = v E D(G )|G i = G i .
vFkq
4. We are now ready to define the algorithm to compute the final generator matrix G: see Algorithm 6. Prove that Algorithm 6 outputs a matrix G such that the linear code generated
by G is an [n, k, n]q code. Conclude that this code lies on the GV bound.
88
2: FOR every 1 i n DO
3:
C
D
G i arg minvFk E D(G )|G i = G i , G i +1 = v
q
4: RETURN G
5. Finally,7we will
8 analyze the run time of Algorithm 6. Argue that Step 2 can be implemented
7
8
in poly n, q k time. Conclude Algorithm 6 can be implemented in time poly n, q k .
Hint: It might be useful to maintain a data structure that keeps track of one number for
every non-zero m Fkq throughout the run of Algorithm 6.
Exercise 4.8. In this problem we will derive the GV bound using a graph-theoretic proof, which
is actually equivalent to the greedy proof we saw in Section 4.2.1. Let 1 d n and q 1 be
integers. Now consider the graph G d ,n = (V, E ), where the vertex set is the set of all vectors in
[q]n . Given two vertices u ,= v [q]n , we have the edge (u, v) E if and only if (u, v) < d . An
independent set of a graph G = (V, E ) is a subset I V such that for every u ,= v I , we have that
(u, v) is not an edge. We now consider the following sub-problems:
1. Argue that any independent set C of G n,d is a q-ary code of distance d .
2. The degree of a vertex in a graph G is the number of edges incident on that vertex. Let
be the maximum degree of any vertex in G = (V, E ).Then argue that G has an independent
|V |
set of size at least +1
.
3. Using parts 1 and 2 argue the GV bound.
Exercise 4.9. Use part 2 from Exercise 1.7 to prove the Singleton bound.
Exercise 4.10. Let C be an (n, k, d )q code. Then prove that fixing any n d +1 positions uniquely
determines the corresponding codeword.
Exercise 4.11. Let C be a binary code of block length n and distance n/2. Then |C | 2n. (Note
that this is a factor 2 better than part 1 in Theorem 4.4.1.)
Exercise 4.12. Prove that the bound in Exercise 4.11 is tight i.e. there exists binary codes C with
block length n and distance n/2 such that |C | = 2n.
Exercise 4.13. Prove that part 1 of Lemma 4.4.3 is tight.
Exercise 4.14. In this exercise we will prove the Plotkin bound (at least part 2 of Theorem 4.4.1)
via a purely combinatorial proof.
89
%
&
Given an (n, k, d )q code C with d > 1 q1 n define
S=
(c1 , c2 ).
c1 ,=c2 C
For the rest of the problem think of C has an |C | n matrix where each row corresponds to a
codeword in C . Now consider the following:
1. Looking at the contribution of each column in the matrix above, argue that
,
1
S 1
n|C |2 .
q
2. Look at the contribution of the rows in the matrix above, argue that
S |C | (|C | 1) d .
3. Conclude part 2 of Theorem 4.4.1.
Exercise 4.15. In this exercise, we will prove the so called Griesmer Bound. For any [n, k, d ]q ,
prove that
H I
k1
# d
n
.
i
i =0 q
Hint: Recall Exercise 2.16.
Exercise 4.16. Use Exercise 4.15 to prove part 2 of Theorem 4.4.1 for linear codes.
Exercise 4.17. Use Exercise 4.15 to prove Theorem 4.3.1 for linear code.
The lower bound of 49 comes about as AG codes are only defined for q being a square (i.e. q = (q + )2 ) and it
turns out that q + = 7 is the smallest value where AG bound beats the GV bound.
90
Foreword
This chapter is based on lecture notes from coding theory courses taught by Venkatesan Guruswami at University at Washington and CMU; by Atri Rudra at University at Buffalo, SUNY
and by Madhu Sudan at MIT.
This version is dated March 29, 2013. For the latest version, please go to
http://www.cse.buffalo.edu/ atri/courses/coding-theory/book/
The material in this chapter is supported in part by the National Science Foundation under
CAREER grant CCF-0844796. Any opinions, findings and conclusions or recomendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the
National Science Foundation (NSF).
Chapter 5
The Greatest Code of Them All:
Reed-Solomon Codes
In this chapter, we will study a code invented by Irving Reed and Gus Solomon [46]. Not surprisingly, these codes are called the Reed-Solomon codes. Reed-Solomon codes have been studied
a lot in coding theory. These codes are optimal in the sense that they meet the Singleton bound
(Theorem 4.3.1). We would like to emphasize that these codes meet the Singleton bound not
just asymptotically in terms of rate and relative distance but also in terms of the dimension,
block length and distance. As if this were not enough, Reed-Solomon codes turn out to be more
versatile: they have many applications outside of coding theory. (We will see some applications
later in the book.)
These codes are defined in terms of univariate polynomials (i.e. polynomials in one unknown/variable) with coefficients from a finite field Fq . It turns out that polynomials over Fp ,
for prime p, also help us define finite fields Fp s , for s > 1. To kill two birds with one stone1 , we
first do a quick review of polynomials over finite fields. Then we will define and study some
properties of Reed-Solomon codes.
i =0 p i X
, pi
!
For our purposes, we will only consider the finite case; that is, P (X ) = di=0 p i X i for some
integer d > 0, with coefficients p i Fq , and p d #= 0. For example, 2X 3 +X 2 +5X +6 is a polynomial
over F7 .
Next, we define some useful notions related to polynomials. We begin with the notion of
degree of a polynomial.
1
77
!
Definition 5.1.2. For P (X ) = di=0 p i X i (p d #= 0), we call d the degree of P (X ). We denote the
degree of the polynomial P (X ) by deg(P ).
For example, 2X 3 + X 2 + 5X + 6 has degree 3.
Let Fq [X ] be the set of polynomials over Fq , that is, with coefficients from Fq . Let P (X ),Q(X )
Fq [X ] be polynomials. Then Fq [X ] has the following natural operations defined on it:
Addition:
P (X ) +Q(X ) =
max(deg(P
"),deg(Q))
i =0
(p i + q i )X i ,
where the addition on the coefficients is done over Fq . For example, over F2 , X + (1 + X ) =
X (1 + 1) + 1 (0 + 1)1 = 1 (recall that over F2 , 1 + 1 = 0).2
Multiplication:
P (X ) Q(X ) =
deg(P )+deg(Q)
min(i"
,deg(P ))
"
i =0
j =0
p j qi j X i ,
where all the operations over the coefficients are over Fq . For example, over F2 , X (1+ X ) =
X + X 2 ; (1+ X )2 = 1+2X + X 2 = 1+ X 2 , where the latter equality follows since 2 0 mod 2.
Next, we define the notion of a root of a polynomial.
Definition 5.1.3. Fq is a root of a polynomial P (X ) if P () = 0.
For instance, 1 is a root of 1 + X 2 over F2 .
We will also need the notion of a special class of polynomials, which are like prime numbers
for polynomials.
Definition 5.1.4. A polynomial P (X ) is irreducible if for every Q 1 (X ),Q 2 (X ) such that P (X ) =
Q 1 (X )Q 2 (X ), we have min(deg(Q 1 ), deg(Q 2 )) = 0
For example, 1 + X 2 is not irreducible over F2 , as (1 + X )(1 + X ) = 1 + X 2 . However, 1 + X + X 2
is irreducible, since its non-trivial factors have to be from the linear terms X or X + 1. However,
it is easy to check that neither is a factor of 1 + X + X 2 . (In fact, one can show that 1 + X + X 2 is
the only irreducible polynomial of degree 2 over F2 the proof is left as an exercise.) A word of
caution: if a polynomial E (X ) Fq [X ] does not have any root in Fq , it does not mean that E (X )
is irreducible. For example consider the polynomial (1 + X + X 2 )2 over F2 it does not have any
root in F2 but it obviously is not irreducible.
Just as the set of integers modulo a prime is a field, so is the set of polynomials modulo an
irreducible polynomial:
Theorem 5.1.1. Let E (X ) be an irreducible polynomial with degree 2 over Fp , p prime. Then
the set of polynomials in Fp [X ] modulo E (X ), denoted by Fp [X ]/E (X ), is a field.
2
This will be a good time to remember that operations over a field are much different from operations over
integers/reals. For example, over reals/integers X + (X + 1) = 2X + 1.
78
The proof of the theorem above is similar to the proof of Lemma 2.1.2, so we only sketch the
proof here. In particular, we will explicitly state the basic tenets of Fp [X ]/E (X ).
Elements are polynomials in Fp [X ] of degree at most s 1. Note that there are p s such
polynomials.
Addition: (P (X ) +Q(X )) mod E (X ) = P (X ) mod E (X ) +Q(X ) mod E (X ) = P (X ) +Q(X ).
(Since P (X ) and Q(X ) are of degree at most s1, addition modulo E (X ) is just plain simple
polynomial addition.)
Multiplication: (P (X ) Q(X )) mod E (X ) is the unique polynomial R(X ) with degree at
most s 1 such that for some A(X ), R(X ) + A(X )E (X ) = P (X ) Q(X )
The additive identity is the zero polynomial, and the additive inverse of any element P (X )
is P (X ).
The multiplicative identity is the constant polynomial 1. It can be shown that for every
element P (X ), there exists a unique multiplicative inverse (P (X ))1 .
For example, for p = 2 and E (X ) = 1+X +X 2 , F2 [X ]/(1+X +X 2 ) has as its elements {0, 1, X , 1+
X }. The additive inverse of any element in F2 [X ]/(1 + X + X 2 ) is the element itself while the
multiplicative inverses of 1, X and 1 + X are 1, 1 + X and X respectively.
A natural question to ask is if irreducible polynomials exist. Indeed, they do for every degree:
Theorem 5.1.2. For all s 2 and Fp , there exists an irreducible
polynomial of degree s over Fp . In
% s&
p 3
fact, the number of such irreducible polynomials is
.
s
Given any monic 4 polynomial E (X ) of degree s, it can be verified whether it is an irreducible
s
polynomial by checking if gcd(E (X ), X q X ) = E (X ). This is true as the product of all monic
s
irreducible polynomials in Fq [X ] of degree exactly s is known to be the polynomial X q X [49].
Since Euclids algorithm for computing the gcd(P (X ),Q(X )) can be implemented in time polynomial in the minimum of deg(P ) and deg(Q) and log q, this implies that checking whether a
given polynomial of degree s over Fq [X ] can be done in poly(s, log q).
This implies an efficient Las Vegas algorithm5 to generate an irreducible polynomial of degree s over Fq . Note that the algorithm is to keep on generating random polynomials until it
comes across an irreducible polynomial (Theorem 5.1.2 implies that the algorithm will check
O(s) polynomials in expectation). Algorithm 6 presents the formal algorithm.
The above discussion implies the following:
3
In fact, the result is true even for general finite fields Fq and not just prime fields but we stated the version over
prime fields as we will not really need the more general result in this book.
4
I.e. the coefficient of the highest degree term is 1. It is easy to check that if E (X ) = e s X s + e s1 X s1 + + 1 is
irreducible, then e s1 E (X ) is also an irreducible polynomial.
5
A Las Vegas algorithm is a randomized algorithm which always succeeds and we consider its time complexity
to be its expected worst-case run time.
79
2: WHILE b = 0 DO
!
i
P (X ) X s + is1
=0 p i X , where each p i is chosen uniformly at random from Fq .
s
4:
IF gcd(P (X ), X q X ) = P (X ) THEN
5:
b 1.
6: RETURN P (X )
3:
Corollary 5.1.3. There is a Las Vegas algorithm to generate an irreducible polynomial of degree s
over any Fq in expected time poly(s, log q).
It is a big open question to present a deterministic algorithm to compute an irreducible
polynomial of a given degree with the same time complexity as the result above.6
Now recall that Theorem 2.1.3 states that for every prime power p s , there a unique field Fp s .
This along with theorems 5.1.1 and 5.1.2 implies that:
Corollary 5.1.4. The field Fp s is Fp [X ]/E (X ), where E (X ) is an irreducible polynomial of degree
s.
k1
"
mi X i .
i =0
Such results are known in general if one is happy with polynomial dependence on q instead of log q.
80
(5.1)
We call this image Reed-Solomon code or RS code. A common special case is n = q 1 with the
def
For example, the first row below are all the codewords in the [3, 2]3 Reed-Solomon codes
where the evaluation points are F3 (and the codewords are ordered by the corresponding messages from F23 in lexicographic order where for clarity the second row shows the polynomial
f m (X ) for the corresponding m F23 ):
(0,0,0), (1,1,1), (2,2,2), (0,1,2), (1,2,0), (2,0,1), (0,2,1), (1,0,2), (2,1,0)
0,
1,
2,
X,
X+1,
X+2,
2X,
2X+1,
2X+2
Notice that by definition, the entries in {1 , ..., n } are distinct and thus, must have n q.
Still, Reed-Solomon codes are used widely in practice. For example, Reed-Solomon codes are
used in storage of information in CDs and DVDs. This is because they are robust against bursterrors that come in contiguous manner. In this scenario, a large alphabet is then a good thing
since bursty errors will tend to corrupt the entire symbol in Fq unlike partial errors, e.g. errors
over bits.
We now turn to some properties of Reed-Solomon codes.
Claim 5.2.1. RS codes are linear codes.
Proof. The proof follows from the fact that if a Fq and f (X ), g (X ) Fq [X ] are polynomials of
degree k 1, then a f (X ) and f (X )+ g (X ) are also polynomials of degree k 1. In particular,
let messages m1 and m2 be mapped to f m1 (X ) and f m2 (X ) where f m1 (X ), f m2 (X ) Fq [X ] are
polynomials of degree at most k 1 and because of the mapping defined in (5.1), it is easy to
verify that:
f m1 (X ) + f m2 (X ) = f m1 +m2 (X ),
and
a f m1 (X ) = f am1 (X ).
In other words,
aRS(m1 ) = RS(am1 ).
Proposition 5.2.3 (Degree Mantra"). A nonzero polynomial f (X ) of degree t over a field Fq has
at most t roots in Fq
Proof. We will prove the theorem by induction on t . If t = 0, we are done. Now, consider f (X )
of a degree t > 0. Let Fq be a root such that f () = 0. If no such root exists, we are done. If
there is a root , then we can write
f (X ) = (X )g (X )
where deg(g ) = deg( f ) 1 (i.e. X divides f (X )). Note that g (X ) is non-zero since f (X ) is
non-zero. This is because by the fundamental rule of division of polynomials:
f (X ) = (X )g (X ) + R(X )
where deg(R) 0 (as the degree cannot be negative this in turn implies that deg(R) = 0) and
since f () = 0,
f () = 0 + R(),
which implies that R() = 0. Since R(X ) has degree zero (i.e. it is a constant polynomial), this
implies that R(X ) 0.
Finally, as g (X ) is non-zero and has degree t 1, by induction, g (X ) has at most t 1 roots,
which implies that f (X ) has at most t roots.
We are now ready to prove Claim 5.2.2
Proof of Claim 5.2.2. We start by proving the claim on the distance. Fix arbitrary m1 #= m2
Fkq . Note that f m1 (X ), f m2 (X ) Fq [X ] are distinct polynomials of degree at most k 1 since
m1 #= m2 Fkq . Then f m1 (X ) f m2 (X ) #= 0 also has degree at most k 1. Note that w t (RS(m2 )
RS(m1 )) = (RS(m1 ), RS(m2 )). The weight of RS(m2 )RS(m1 ) is n minus the number of zeroes
in RS(m2 ) RS(m1 ), which is equal to n minus the number of roots that f m1 (X ) f m2 (X ) has
among {1 , ..., n }. That is,
(RS(m1 ), RS(m2 )) = n |{i | f m1 (i ) = f m2 (i )}|.
By Proposition 5.2.3, f m1 (X ) f m2 (X ) has at most k 1 roots. Thus, the weight of RS(m2 )
RS(m1 ) is at least n (k 1) = n k + 1. Therefore d n k + 1, and since the Singleton bound
(Theorem 4.3.1) implies that d nk+1, we have d = nk+1.7 The argument above also shows
that distinct polynomials f m1 (X ), f m2 (X ) Fq [X ] are mapped to distinct codewords. (This is
because the Hamming distance between any two codewords is at least n k + 1 1, where the
last inequality follows as k n.) Therefore, the code contains q k codewords and has dimension
k. The claim on linearity of the code follows from Claim 5.2.1.
!
Recall that the Plotkin bound (Corollary 4.4.2) implies that to achieve the Singleton bound,
the alphabet size cannot be a constant. Thus, some dependence of q on n in Reed-Solomon
codes is unavoidable.
7
Alternatively, to show that the distance is at most n k +1, consider the distance between the all zero codeword
)
and the codeword corresponding to the polynomial k1
i =1 (X i ).
82
Let us now find a generator matrix for RS codes (which exists by Claim 5.2.1). By Definition 5.2.1, any basis f m1 , ..., f mk of polynomial of degree at most k 1 gives rise to a basis
RS(m1 ), ..., RS(mk ) of the code. A particularly nice polynomial basis is the set of monomials
1, X , ..., X i , ..., X k1 . The corresponding generator matrix, whose i th row (numbering rows from
0 to k 1 ) is
(i1 , i2 , ..., ij , ..., in )
and this generator matrix is called the Vandermonde matrix with k n size
1
1
1
1
1
1
2 j
n
1
22 2j
2n
1
..
..
..
..
..
..
.
.
.
.
.
.
i
i
i
2 j
in
1
.
.
.
.
.
..
..
..
..
..
..
k1
k1
k1
k1
1
2
j
n
The class of codes that match the Singleton bound have their own name, which we define
and study next.
S, where |S| = k.
For notational simplicity, assume that S = [k]. We think of p i s as unknowns in the equations
that arise out of the relations P (i ) = v i . Thus, we need to show that there is a solution to the
following system of linear equations:
1
1
1
v1
v2
i
k
'
(
2
2
2
1
i
k =
v
3
p 0 p 1 p k1
..
..
..
.
.
.
.
.
k1
k1
k1
1
i
k
vk
The above constraint matrix is a Vandermonde matrix and is known to have full rank. Hence,
there always exists a unique solution for (p 0 , . . . , p k1 ). This completes the proof for ReedSolomon codes.
Next, we prove the property for the general case which is presented below
Proof of Proposition 5.3.1. Consider a |C | n matrix where each row represents a codeword
in C . Hence, there are |C | = ||k rows in the matrix. The number of columns is equal to the
block length n of the code. Since C is Maximum Distance Separable, its distance d = n k + 1.
Let S [n] be of size exactly k. It is easy to see that for any ci #= c j C , the corresponding
j
projections ciS and cS C S are not the same. As otherwise .(ci , c j ) d 1, which is not possible
as the minimum distance of the code C is d . Therefore, every codeword in C gets mapped to a
distinct codeword in C S . As a result, |C S | = |C | = ||k . As C S k , this implies that C S = k , as
desired.
!
84
Foreword
This chapter is based on lecture notes from coding theory courses taught by Venkatesan Guruswami at University at Washington and CMU; by Atri Rudra at University at Buffalo, SUNY
and by Madhu Sudan at MIT.
This version is dated April 28, 2013. For the latest version, please go to
http://www.cse.buffalo.edu/ atri/courses/coding-theory/book/
The material in this chapter is supported in part by the National Science Foundation under
CAREER grant CCF-0844796. Any opinions, findings and conclusions or recomendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the
National Science Foundation (NSF).
Chapter 6
What Happens When the Noise is Stochastic:
Shannons Theorem
Shannon was the first to present a rigorous mathematical framework for communication, which
(as we have already seen) is the problem of reproducing at one point (typically called the receiver" of the channel) a message selected at another point (called the sender" to the channel).
Unlike Hamming, Shannon modeled the noise stochastically, i.e. as well defined random process. He proved a result that pin-pointed the best possible rate of transmission of information
over a very wide range of stochastic channels. In fact, Shannon looked at the communication
problem at a higher level, where he allowed for compressing the data first (before applying any
error-correcting code), so as to minimize the amount of symbols transmitted over the channel.
In this chapter, we will study some stochastic noise models (most of) which were proposed
by Shannon. We then prove an optimal tradeoff between the rate and fraction of errors that are
correctable for a specific stochastic noise model called Binary Symmetric Channel.
That is, the ability to successfully sending the required information over a channel that can lose or corrupt
data.
85
Figure 6.1 presents a generic model of a communication system, which combines the two concepts we discussed above.
Source
Encoder
Channel
Encoder
Channel
Message
Source
(Decoded) Message
Channel
Decoder
Decoder
matrix with entries as cross over probability over all combination of the input and output alphabets. For any pair (x, y) X Y , let Pr(y|x) denote the probability that y is output by the
channel when x is input to the channel. Then the transition matrix is given by M(x, y) = Pr(y|x).
Specific structure of the matrix is shown below.
..
.
Pr(y|x)
M=
..
.
Binary Symmetric Channel (BSC). Let 0 p 1. The Binary Symmetric Channel with crossover
probability p or BSCp is defined as follows. X = Y = {0, 1}. The 2 2 transition matrix can naturally be represented as a bipartite graph where the left vertices correspond to the rows and
the right vertices correspond to the columns of the matrix, where M(x, y) is represented as the
weight of the corresponding (x, y) edge. For BSCp , the graph is illustrated in Figure 6.2.
0
1p
p
p
1
1p
Let 0 1. The Binary Erasure Channel with erasure probability (denoted by BEC )
is defined as follows. X = {0, 1} and Y = {0, 1, ?}, where ? denotes an erasure." The transition
matrix is as follows:
0
0
?
1
2. If k ,(1 H (p) + )n- then for every pair of encoding and decoding functions, E : {0, 1}k
{0, 1}n and D : {0, 1}n {0, 1}k , there exists m {0, 1}k such that
1
Pr [D(E (m) + e)) (= m] .
eBSCp
2
Note that Theorem 6.3.1 implies that the capacity of BSCp is 1H (p). It can also been shown
that the capacity of qSC p and B EC are 1 H q (p) and 1 respectively. (See exercises 6.5.2
and 6.5.3.)
Entropy function appears in Theorem 6.3.1 is due to the same technical reason that it appears in the GV bound: the entropy function allows us to use sufficiently tight bounds on the
volume of a Hamming ball (Proposition 3.3.1).
89
Dm
{0, 1}n
Figure 6.4: The sets D m partition the ambient space {0, 1}n .
Define D m to be the set of received words y that are decoded to m by D, that is,
.
/
D m = y|D(y) = m .
The main idea behind the proof is the following: first note that the sets D m partition the
entire space of received words {0, 1}n (see Figure 6.3.1 for an illustration). (This is because D is
a function.) Next we will argue that since the decoding error probability is at most a 1/2, then
D m for every m {0, 1}k is large." Then by a simple packing argument, it follows that we cannot
have too many distinct m, which we will show implies that k < (1 H (p) + )n: a contradiction.
Before we present the details, we outline how we will argue that D m is large. Let S m be the shell
of radius [(1 )pn, (1 + )pn] around E (m), that is,
S m = B (E (m), (1 + )pn) \ B (E (m), (1 )pn).
(We will set > 0 in terms of and p at the end of the proof.) See Figure 6.3.1 for an illustration. Then we argue that because the decoding error probability is bounded by 1/2, most of
the received words in the shell S m are decoded correctly, i.e. they fall in D m . To complete the
argument, we show that number of such received words is indeed large enough.
Fix an arbitrary message m {0, 1}k . Note that by our assumption, the following is true
(where from now on we omit the explicit dependence of the probability on the BSCp noise for
clarity):
Pr [E (m) + e ( D m ] 1/2.
(6.1)
90
(1 )pn
E (m)
(1 + )pn
Figure 6.5: The shell S m of inner radius (1 )pn and outer radius (1 + )pn.
Further, by the (multiplicative) Chernoff bound (Theorem 3.1.6),
2
Pr [E (m) + e ( S m ] 2(
n)
(6.2)
(6.1) and (6.2) along with the union bound (Proposition 3.1.3) imply the following:
Pr [E (m) + e ( D m S m ]
2
1
+ 2( n) .
2
2
1
1
2( n) ,
2
4
(6.3)
where the last inequality holds for large enough n. Next we upper bound the probability above
to obtain a lower bound on |D m S m |.
It is easy to see that
Pr [E (m) + e D m S m ] |D m S m | p max ,
where
0
1
p max = max Pr E (m) + e = y =
yS m
max
d [(1)pn,(1+)pn]
p d (1 p)nd .
In the above, the second equality follows from the fact that all error patterns with the same
Hamming weight appear with the same probability when chosen according to BSCp . Next, note
that p d (1 p)nd is decreasing in d for p 1/2. (Indeed p d (1 p)nd = (p/(1 p))d (1 p)n and
the bound p 1/2 implies that the first exponent is at most 1, which implies that the expression
is decreasing in d .) Thus, we have
p max = p
(1)pn
(1 p)
n(1)pn
1p
=
p
+pn
91
pn
(1 p)
(1p)n
1p
=
p
+pn
2nH (p) .
1p
Pr [E (m) + e D m S m ] |D m S m |
p
+pn
2nH (p) ,
(6.4)
m{0,1}k
m{0,1}k
(6.5)
|D m |
|D m S m |
*
+pn
2
1 1
2H (p)n
1
4 p
m{0,1}k
(6.6)
(6.7)
In the above, (6.5) follows from the fact that for m1 (= m2 , D m1 and D m2 are disjoint. (6.6) follows
3
4 . (Note that as 0 < p <
from (6.4). (6.7) follows for large enough n and if we pick =
1
2p log
p 1
1/2, = ().)
(6.7) implies that k < (1 H (p) + )n, which is a contradiction. The proof of part (2) of Theorem 6.3.1 is complete.
Remark 6.3.1. It can be verified that the proof above can also work if the decoding error probability is bounded by 1 2n (instead of the 1/2 in part (2) of Theorem 6.3.1) for small enough
= () > 0.
Next, we will prove part (1) of Theorem 6.3.1
(Step 2) We will show a similar result for all m. This involves dropping half of the code
words.
The proof method above has its own name random coding with expurgation."
Note that there are two sources of randomness in the proof:
1. Randomness in the choice of encoding function E and
2. Randomness in the noise.
We stress that the first kind of randomness is for the probabilistic method while the second
kind of randomness will contribute to the decoding error probability.
Proof by picture" of Step 1. Before proving part (1) of Theorem 6.3.1, we will provide a pictorial proof of Step 1. We begin by fixing m {0, 1}k . In Step 1, we need to estimate the following
quantity:
EE
Pr
eBSCp
6
[D (E (m) + e) (= m] .
By the multiplicative Chernoff bound (Theorem 3.1.6), with all but an exponentially
small
(
)
/
probability, the received word will be contained in a Hamming ball of radius p + n (for some
/ > 0 that we will choose appropriately). So one can assume that the received word y with high
probability satisfies (E (m), y) (p + / )n. Given this, pretty much the only thing to do is to
estimate the decoding error probability for such a y. Note that by the fact that D is MLD, an
error can happen only if there exists another message m/ such that (E (m/ ), y) (E (m), y).
The latter event implies that (E (m/ ), y) (p + / )n (see Figure 6.6). Thus, the decoding error
probability is upper bounded by
((
)
)
0 ( /)
( (
) )1 V ol 2 p + / n, n
2H (p )n
/
Pr E m B y, p + n =
,
eBSCp
2n
2n
where the last step follows from Proposition 3.3.1. Finally, by the union bound (Proposition 3.1.3),
k nH (p)
the existence of such a bad" m/ is upper bounded by 2 22n , which by our choice of k is
2(n) , as desired.
The Details. For notational convenience, we will use y and E (m) + e interchangeably:
y = E (m) + e.
That is, y is the received word when E (m) is transmitted and e is the error pattern.
We start the proof by restating the decoding error probability in part (1) of Shannons capacity theorem for the BSC (Theorem 6.3.1) by breaking up the quantity into two sums:
93
(p + / )n
E (m)
E (m/ )
(p + / )n
(
)
Figure 6.6: Hamming balls of radius p + / n and centers E (m) and E (m/ ) illustrates Step 1 in
the proof of part (1) of Shannons capacity theorem for the BSC.
Pr
eBSCp
[D (E (m) + e) (= m] =
yB (E (m),(p+/ )n)
0
1
Pr y|E (m) 1D(y)(=m
0
1
Pr y|E (m) 1D(y)(=m ,
where 1D(y)(=m is the indicator function for the event that D(y) (= m given that E (m) was the
transmitted codeword and we use y|E (m) as a shorthand for y is the received word given that
E (m) was the transmitted codeword." As 1D(y)(=m 1 (since it takes a value in {0, 1}) and by the
(additive) Chernoff bound (Theorem 3.1.6) we have
2
0
1
/ 2
Pr [D (E (m) + e) (= m]
Pr y|E (m) 1D(y)(=m + e ( ) n/2 .
eBSCp
yB (E (m),(p+/ )n)
In order to apply the probabilistic method (Section 3.2), we will analyze the expectation
(over the random choice of E ) of the decoding error probability, which by the upper bound
above satisfies
EE
Pr
eBSCp
6
/2
[D (E (m) + e) (= m] e n/2 +
yB (E (m),(p+/ )n )
Pr
eBSCp
7
8
y|E (m) EE 1D (y)(=m . (6.8)
1
In the above we used linearity of expectation (Proposition 3.1.2) and the fact that the distributions on e and E are independent.
Next, for a fixed received
word
0
1 y and the transmitted codeword E (m) such that (y, E (m))
/
(p + )n we estimate EE 1D(y)(=m . Since D is MLD, we have
2
0
1
0
1
0 ( ( ) )
(
)
1
EE 1D(y)(=m = Pr 1D(y)(=m |E (m)
Pr E m/ , y E (m) , y |E (m) ,
(6.9)
E
m/ (=m
where in the above |E (m)" is short for being conditioned on E (m) being transmitted" and the
inequality follows from the union bound (Proposition 3.1.3) and the fact that D is MLD.
94
9 ( (
) )9
2 9B y, p + / n 9
m/ (=m
(6.10)
2n
2 2H (p+ )n
2n
m/ (=m
/
(6.11)
/
2k 2n (1H (p+ ))
/
2n (1H (p+))n (1H (p+ ))
(6.12)
(6.13)
In the above (6.10) follows from the fact that the choice for E (m/ ) is independent of E (m).
(6.11) follows from the upper bound on the volume of a Hamming ball (Proposition 3.3.1) while
(6.12) follows from our choice of k.
Using (6.13) in (6.8), we get
5
6
2
0
1
/2
/
EE
Pr [D(E (m) + e) (= m] e n/2 + 2n (H (p+)H (p+ ))
Pr y|E (m)
eBSCp
yB (E (m),(p+/ )n)
/2
n/2
+ 2n (H (p+)H (p+ )) 2 n ,
/
yB (E (m),(p+/ )n)
and the last inequality follows for large enough n, say / = /2 and by picking / > 0 to be small
enough.
Thus, we have shown that for any arbitrary m the average (over the choices of E ) decoding
error probability is small. However, we still need to show that the decoding error probability is
exponentially small for all messages simultaneously. Towards this end, as the bound holds for
each m we have
5 5
66
/
Em EE
Pr [D (E (m) + e) (= m] 2 n .
eBSCp
The order of the summation in the expectation with respect to m and the summation in the
expectation with respect to the choice of E can be switched (as the probability distributions are
defined over different domains), resulting in the following expression:
5 5
66
/
EE Em
Pr [D (E (m) + e) (= m] 2 n .
eBSCp
Em
Pr
eBSCp
6
0 (
)
1
/
D E (m) + e (= m 2 n .
(6.14)
(6.14) implies that the average decoding error probability is exponentially small. However,
recall we need to show that the maximum decoding error probability is small. To achieve such
a result, we will throw away half of the messages, i.e. expurgate" the code. In particular, we will
order the messages in decreasing order of their decoding error probability and then drop the
top half. We claim that the maximum decoding error probability for the remaining messages is
/
2 2 n . Next, we present the details.
From Average to Worst-Case Decoding Error Probability. We begin with the following averaging" argument.
Claim 6.3.2. Let the messages be ordered as m1 , m2 , . . . , m2k and define
Pi =
Pr
eBSCp
[D(E (mi ) + e) (= mi ] .
/
2k
i =1
P i = Em Pr
eBSCp
[D(E (m) + e) (= m]
2 n ,
(6.15)
where (6.15) follows from (6.14). For the sake of contradiction assume that
/
P 2k1 > 2 2 n .
(6.16)
So,
2k
1 2
2k
i =1
Pi
>
1
2k
2k
2
Pi
i =2k1 +1
/ n
k1
22
2k
/ n
>2
,
(6.17)
(6.18)
(6.19)
where (6.17) follows by dropping half the summands from the sum. (6.18) follows from (6.16)
and the assumption on the sortedness of P i . The proof is now complete by noting that (6.19)
contradicts (6.15).
Thus, our final code will have m1 , . . . , m2k1 as its messages and hence, has dimension k / =
error) probability is at most 2n . Also if
k 1. Define (= / + n1 . In )the new code, maximum
(
/
we picked k 2 1 H (p + ) n3+1, then k 2 1 H (p + ) n3, as required. This completes the
proof of Theorem 6.3.1.
96
Remark 6.3.2. One can also show that for the q-SC p , the capacity is 1 H q (p) and for the B EC ,
the capacity is 1 .
We have shown that a random code can achieve capacity. However, we do not know of even
a succinct representation of general codes. A natural question to ask is if random linear codes
can achieve the capacity of BSCp . The answer is yes and the proof is left as an exercise.
For linear code, representation and encoding are efficient. But the proof does not give an
explicit construction. Intuitively, it is clear that since Shannons proof uses a random code it
does not present an explicit" construction. However, in this book, we will formally define what
we mean by an explicit construction.
Definition 6.3.1. A code C of block length n is called explicit if there exists a poly(n)-time algorithm that computes a succinct description of C given n. For linear codes, such a succinct
description would be a generator matrix.
We will also need the following stronger notion of an explicitness:
Definition 6.3.2. A linear [n, k] code C is called strongly explicit, if given any index pair (i , j )
[k] [n], there is a poly(log n) time algorithm that outputs G i , j , where G is a generator matrix of
C.
Further, Shannons proof uses MLD for which only exponential time implementations are
known. Thus, the biggest question left unsolved by Shannons work is the following.
Question 6.3.2. Can we come up with an explicit construction with R > 0 and p > 0?
Note that the question above is similar to Question 2.7.1 in Hammings world. Elias, answered
the above question in the affirmative [10]. His code construction uses a clever combination of
Hadamard codes. Unfortunately, we do not have the time to go through the construction.
H AMMING
Focus on codewords itself
Looked at explicit codes
Fundamental trade off: rate vs. distance
(easier to get a handle on this)
Worst case errors
S HANNON
Directly deals with encoding and decoding functions
Not explicit at all
Fundamental trade off: rate vs. error
Stochastic errors
Intuitively achieving positive results in the Hamming world is harder than achieving positive
results in Shannons world. The reason is that the adversary in Shannons world (e.g. BSCp ) is
much weaker than the worst-case adversary in Hammings world (say for bits). We make this
intuition (somewhat) precise as follows:
Proposition 6.4.1. Let 0 p < 21 and 0 < 21 p. If an algorithm A can handle p + fraction of
worst case errors, then it can be used for reliable communication over BSCp
2 n
Proof. By the additive Chernoff bound (Theorem 3.1.6), with probability 1e 2 , the fraction
of errors in BSCp is p + . Then by assumption on A, it can be used to recover the transmitted
message.
Note that the above result implies that one can have reliable transmission over BSCp with
any code of relative distance 2p + (for any > 0).
A much weaker converse of Proposition 6.4.1 is also true. More precisely, if the decoding
error probability is exponentially small for the BSC, then the corresponding code must have
constant relative distance (though this distance does not come even close to achieving say the
Gilbert-Varshamov bound). The proof of this claim is left as an exercise.
6.5 Exercises
Exercise 6.5.1. Argue that in the positive part of Theorem 6.3.1, one can pick = (2 ). That is,
for 0 p < 1/2 and small enough , there exist codes of rate 1 H (p) and block length n that
2
can be decoded with error probability at most 2( )n over BSCp .
Exercise 6.5.2. Prove that the capacity of the qSC p is 1 H q (p).
Exercise 6.5.3. The binary erasure channel with erasure probability has capacity 1 . In this
problem, you will prove this result (and its generalization to larger alphabets) via a sequence of
smaller results.
1. For positive integers k n, show that less than a fraction q kn of the k n matrices G
over Fq fail to generate a linear code of block length n and dimension k. (Or equivalently,
except with probability less than q kn , the rank of a random k n matrix G over Fq is k.)
(Hint: Try out the obvious greedy algorithm to construct a k n matrix of rank k. You will
see that you will have many choices every step: from this compute (a lower bound on) the
number of full rank matrices that can be generated by this algorithm.)
98
2. Consider the q-ary erasure channel with erasure probability (qEC , for some , 0
1): the input to this channel is a field element x Fq , and the output is x with probability
1 , and an erasure ? with probability . For a linear code C generated by an k n
matrix G over Fq , let D : (Fq {?})n C {fail} be the following decoder:
D(y) =
'
fail
For a set J {1, 2, . . . , n}, let P err (G|J ) be the probability (over the channel noise and choice
of a random message) that D outputs fail conditioned on the erasures being indexed by J .
Prove that the average value of P err (G|J ) taken over all G Fkn
is less than q kn+|J | .
q
3. Let P err (G) be the decoding error probability of the decoder D for communication using
the code generated by G on the qEC . Show that when k = Rn for R < 1 , the average
value of P err (G) over all k n matrices G over Fq is exponentially small in n.
4. Conclude that one can reliably communicate on the qEC at any rate less than 1 using
a linear code.
99
Foreword
This chapter is based on lecture notes from coding theory courses taught by Venkatesan Guruswami at University at Washington and CMU; by Atri Rudra at University at Buffalo, SUNY
and by Madhu Sudan at MIT.
This version is dated April 28, 2013. For the latest version, please go to
http://www.cse.buffalo.edu/ atri/courses/coding-theory/book/
The material in this chapter is supported in part by the National Science Foundation under
CAREER grant CCF-0844796. Any opinions, findings and conclusions or recomendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the
National Science Foundation (NSF).
Chapter 7
Bridging the Gap Between Shannon and
Hamming: List Decoding
In Section 6.4, we made a qualitative comparison between Hamming and Shannons world. We
start this chapter by doing a more quantitative comparison between the two threads of coding
theory. In Section 7.2 we introduce the notion of list decoding, which potentially allows us to
go beyond the (quantitative) results of Hamming and approach those of Shannons. Then in
Section 7.3, we show how list decoding allows us to go beyond half the distance bound for any
code. Section 7.4 proves the optimal trade-off between rate and fraction of correctable errors via
list decoding. Finally, in Section 7.5, we formalize why list decoding could be a useful primitive
in practical communication setups.
1R
.
2
The above can be achieved via efficient decoding algorithms for example for Reed-Solomon
codes (well see this later in the book).
Shannon theory: In qSCp , for 0 p < 1 1/q, we can have reliable communication with
R < 1 H q (p). It can be shown that
101
c4
y
c1
>
bad examples
z
c3
c2
bad examples
Figure 7.1: In this example vectors are embedded into Euclidean space such that the Euclidean
distance between two mapped points is the same as the Hamming distance between vectors.
c1 , c2 , c3 , c4 are codewords. The dotted lines contain the bad examples," that is, the received
words for which unique decoding is not possible.
1. 1 H q (p) 1 p (this is left as an exercise); and
2. 1 H q (p) 1 p , for large enough q in particular, q = 2(1/) (Proposition 3.3.2).
Thus, we can have reliable communication with p 1 R on qSCp for large enough q.
There is a gap between Shannon and Hamming world: one can correct twice as many errors
in Shannons world. One natural question to ask is whether we can somehow bridge" this gap.
Towards this end, we will now re-visit the the bad example for unique decoding (Figure 1.3) and
consider an extension of the bad example as shown in Figure 7.1.
Recall that y and the codewords c1 and c2 form the bad example for unique decoding that
we have already seen before. Recall that for this particular received word we can not do error
recovery by unique decoding since there are two codewords c1 and c2 having the same distance
2 from vector y. On the other hand, the received word z has an unique codeword c1 with distance p > 2 . However, unique decoding does not allow for error recovery from z. This is because
by definition of unique decoding, the decoder must be able to recover from every error pattern
(with a given Hamming weight bound). Thus, by Proposition 1.4.1, the decoded codeword cannot have relative Hamming distance larger than /2 from the received word. In this example,
because of the received word y, unique decoding gives up on the opportunity to decode z.
Let us consider the example in Figure 7.1 for the binary case. It can be shown that the
number of vectors in dotted lines is insignificant compared to volume of shaded area (for large
enough block length of the code). The volume of all Hamming balls of radius 2 around all the
102
2k 2nH ( 2 ) ,
which implies that the volume of the shaded area (without the dotted lines) is approximately
equal to:
2n 2k 2nH ( 2 ) .
In other words, the volume when expressed as a fraction of the volume of the ambient space is
roughly:
1 2n(1H ( 2 )R) ,
(7.1)
1. Declare a decoding error if list size > 1. Note that this generalizes unique decoding (as
when the number of errors is at most half the distance of the code then there is a unique
codeword and hence, the list size will be at most one). However, the gain over unique
decoding would be substantial only if for most error patterns (of weight significantly more
than half the distance of the code) the output list size is at most one. Fortunately, it can
be show that:
For random codes, with high probability, for most error patterns, the list size is at
most one. In other words, for most codes, we can hope to see a gain over unique
decoding. The proof of this fact follows from Shannons proof for the capacity for
qSC: the details are left as an exercise.
In Section 7.5, we show that the above behavior is in fact general: i.e. for any code
(over a large enough alphabet) it is true that with high probability, for most error
patterns, the list size is at most one.
Thus, using this option to deal with multiple answers, we still deal with worse case errors
but can correct more error patterns than unique decoding.
2. If the decoder has access to some side information, then it can use that to prune the list.
Informally, if the worst-case list size is L, then the amount of extra information one needs
is O(log L). This will effectively decrease1 the dimension of the code by O(log L), so if L
is small enough, this will have negligible effect on the rate of the code. There are also
application (especially in complexity theory) where one does not really care about the
rate being the best possible.
Recall that Proposition 1.4.1 implies that /2 is the maximum fraction of errors correctable
with unique decoding. Since list decoding is a relaxation of unique decoding, it is natural to
wonder
Question 7.2.1. Can we correct more than /2 fraction of errors using list decoding?
and if so
Question 7.2.2. What is the maximum fraction of errors correctable using list decoding?
In particular, note that the intuition from Figure 7.1 states that the answer to Question 7.2.1
should be yes.
1
Note that side information effectively means that not all possible vectors are valid messages.
104
i<j
(c(i , c(j ).
We will prove both an upper and a lower bound on S from which we will extract the required
upper bound on M . Then from (ii) we have
,
M
d
S
2
*
(7.2)
(T
Consider the n M matrix (c(T
1 , , cM ). Define m i as the number of 1s in the i -th row for
1 i n. Then the i -th row of the matrix contributes the value m i (M m i ) to S because this
is the number of 0-1 pairs in that row. (Note that each such pair contributes one to S.) This
implies that
n
.
S=
m i (M m i ).
(7.3)
i =1
105
Define
e =
Note that
n
.
i =1
mi =
. mi
i
M
.
j =1
w t (ci ) eM ,
m i2
.
(7.4)
n
n
i =1
Thus, from (7.3)
S=
n
.
i =1
m i (M m i ) = M 2 e
n
.
i =1
m i2 M 2 e
2
e2
(M e)
= M 2 (e ),
n
n
(7.5)
)
M (M 1)
e2
d,
e
n
2
dn
2d n
2d n
=
=
2
2
2
2
2
n(n 2d )
d n 2n e + 2e
2d n n + n 4n e + 4e
(n 2e)
2d n
,
2
(n 2e) n(n 2d )
(7.6)
where the last inequality follows from the fact that e e. Then from
+
2d
e 1
<
1 1
,
n 2
n
we get
n 2e >
In other words
4
n(n 2d ).
Thus, (n 2e)2 n(n 2d ) 1 because n, e are all integers and therefore, from (7.6), we have
M 2d n as desired.
106
Next, we prove the following property of the function J q (), which along with the Johnson
bound answers Question 7.2.1 in the affirmative.
Lemma 7.3.2. Let q 2 be an integer and let 0 x 1 q1 . Then the following inequalities hold:
,
x
J q (x) 1 1 x ,
2
where the second inequality is tight for x > 0.
Proof. We start with by proving the inequality
,
+
)*
(
,
1
xq
1 1 x.
1 1
1
q
q 1
Indeed, both the LHS and RHS of the inequality are zero at x = 0. Further, it is easy to check
that the derivatives of the LHS and RHS are 5 1 xq and , 1 respectively. The former is always
1 q1
1x
larger than the latter quantity. This implies that the LHS increases more rapidly than the RHS,
which in turn proves the required inequality.
The second inequality follows from the subsequent relations. As x 0,
1x +
x2
1 x,
4
x '2
1 x,
2
which in turn implies the required
, inequality. (Note that the two inequalities above are strict
for x > 0, which implies that 1 1 x > x/2 for every x > 0, as desired.)
&
Theorem 7.3.1 and Lemma 7.3.2 imply that for any code, list decoding can potentially correct strictly more errors than unique decoding in polynomial time, as long as q is at most some
polynomial in n (which will be true of all the codes that we discuss in this book). This answers
Question 7.2.1 in the affirmative. See Figure 7.2 for an illustration of the gap between the Johnson bound and the unique decoding bound.
Theorem 7.3.1 and Lemma 7.3.2 also implies the following alphabet-free" version of the
Johnson bound.
,
Theorem 7.3.3 (Alphabet-Free Johnson Bound). If e n n(n d ), then any code with distance d is (e/n, qnd )-list decodable for all the q.
A natural question to ask is the following:
107
Singleton bound
Johnson bound
Unique decoding bound
0.8
0.6
0.4
0.2
0
0
0.2
0.4
0.6
0.8
,
Figure 7.2: The trade-off between rate R and the fraction of errors that can be corrected. 1 R
is the trade-off implied by the Johnson bound. The bound for unique decoding is (1R)/2 while
1 R is the Singleton bound (and the list decoding capacity for codes over large alphabets).
Question 7.3.1. Is the Johnson bound tight?
The answer is yes in the sense that there exist linear codes with relative distance such
that we can find Hamming ball of radius larger than J q () with super-polynomially many codewords. On the other hand, in the next section, we will show that, in some sense, it is not tight.
Thus, the List-decoding capacity 2 is 1 H q (p) (where p is the fraction of errors). Further,
this fully answers Question 7.2.2. Finally, note that this exactly matches capacity for qSCp and
hence, list decoding can be seen as a bridge between Shannons world and Hammings world.
The remarkable aspect of this result is that we bridge the gap between these worlds by allowing
the decoder to output at most O(1/) many codewords.
Note that if a bad event occurs, then the code is not a (, L)-list decodable code. The probability
of the occurrence of any bad event will then be calculated by an application of the union bound.
8 9
Next, we restate Theorem 7.4.1 and prove a stronger version of part (i). (Note that L = 1 in
Theorem 7.4.2 implies Theorem 7.4.1.)
Theorem 7.4.2 (List-Decoding Capacity). Let q 2 be an integer, and 0 < < 1 q1 be a real
number.
6
7
(i) Let L 1 be an integer, then there exists an , L -list decodable code with rate
R 1 H q ()
1
L
6
7
(ii) For every , L code of rate 1 H q () + , it is necessary that L 2(n) .
Proof. We start with the proof of (i). Pick a code C at random where
(
)
1
k
|C | = q , where k 1 H q ()
n.
L
That is, as in Shannons proof, for every message m, pick C (m) uniformly and independently at
random from [q]n .
2
Actually the phrase should be something like capacity of worst case noise model under list decoding" as the
capacity is a property of the channel. However, in the interest of brevity we will only use the term list-decoding
capacity.
109
Given y [q]n , and m0 , , mL [q]k , the tuple (y, m0 , , mL ) defines a bad event if
C (mi ) B (y, n), 0 i L.
Note that a code is (, L)-list decodable if and only if there does not exist any bad event.
Fix y [q]n and m0 , , mL [q]k .
Note that for fixed i , by the choice of C , we have:
Pr[C (mi ) B (y, n)] =
V ol q (n, n)
qn
q n(1Hq ()) ,
(7.7)
where the inequality follows from the upper bound on the volume of a Hamming ball (Proposition 3.3.1). Now the probability of a bad event given (y, m0 , , mL ) is
<
:
L
L
=
;
C (mi ) B (y, n) = Pr[C (mi ) B (y, n)] q n(L+1)(1Hq ()) ,
(7.8)
Pr
i =0
where the equality follows from the fact that the random choices of codewords for distinct messages are independent and the inequality follows from (7.7). Then,
,
*
k
q
Pr[ There is a bad event] q n
q n(L+1)(1Hq ())
(7.9)
L +1
q n q Rn(L+1) q n(L+1)(1Hq ())
= q
(7.10)
1
n(L+1)[1H q () L+1
R]
1
(7.11)
nL
< 1
In the above, (7.9) follows by the union bound (Lemma 3.1.3) with (7.8) and by counting the
6 qk 7
number of ys (which is q n ), and the number of L + 1 tuples (which is L+1
). (7.10) follows from
6a 7
b
the fact that b a and k = Rn. (7.11) follows by assumption R 1 H q () L1 . The rest of the
steps follow from rearranging and canceling the terms. Therefore, by the probabilistic method,
there exists C such that it is (, L)-list decodable.
Now we turn to the proof of part (ii). For this part, we need to show the existence of a y [q]n
such that |C B (y, n)| is exponentially large for every C of rate R 1 H q () + . We will again
use the probabilistic method to prove this result.
Pick y [q]n uniformly at random. Fix c C . Then
Pr[c B (y, n)] = Pr[y B (c, n)]
V ol q (n, n)
=
qn
q n(1Hq ())o(n) ,
110
(7.12)
(7.13)
where (7.12) follows from the fact that y is chosen uniformly at random from [q]n and (7.13)
follows by the lower bound on the volume of the Hamming ball (Proposition 3.3.1).
We have
.
E [|C B (y, n)|] =
E [1cB (y,n) ]
(7.14)
cC
cC
q n(1Hq ()+o(n))
(7.15)
cC
n[R1+H q ()o(1)]
= q
q (n)
(7.16)
In the above, (7.14) follows by the linearity of expectation (Proposition 3.1.2), (7.15) follows
from (7.13), and (7.16) follows by choice of R. Hence, by the probabilistic method, there exists y
such that |B (y, n) C | is q (n) , as desired.
The above proof can be modified to work for random linear codes. In particular, one can
show that with high probability, a random linear code is (, L)-list decodable code as long as
R 1 H q ()
1
.
.logq (L + 1)/
(7.17)
Question 7.4.1. Do there exist explicit codes that achieve list decoding capacity?
Also the only list decoding algorithm that we have seen so far is the brute force algorithm that
checks every codeword to see if they need to be output. This also leads to the follow-up question
111
Question 7.4.2. Can we achieve list decoding capacity with efficient list decoding algorithms?
A more modest goal related to the above would be the following:
Question 7.4.3. Can we design an efficient list decoding algorithm that can achieve
, the Johnson bound? In particular, can we efficiently list decode a code of rate R from 1 R fraction
of errors?
(7.18)
eS
Figure 7.3: Illustration of the kind of error patterns we are trying to count.
least p + allows for reliable communication over qSCp . (Contrast the 2p + distance that was
needed for a similar result that was implied by Proposition 6.4.1.)
Finally, we present a lemma (the proof is left as an exercise) that will be crucial to the proof
of Theorem 7.5.1.
Lemma 7.5.2. Let be C be an (n, k, d )q code. If we fix the values in n d + 1 out of the n positions
in a possible codeword, then at most one codeword in C can agree with the fixed values.
Proof of Theorem 7.5.1. For the rest of the proof, fix a c C . For notational convenience define
E S to be the set of all error patterns e such that eS = 0 and w t (e) = n. Note that as every error
position has (q 1) non-zero choices and there are n such positions in [n] \ S, we have
|E s | = (q 1)n .
(7.19)
Call an error pattern e E s as bad if there exists another codeword c( '= c such that
0(c( , c + e) n.
Now, we need to show that the number of bad error patterns is at most
q (n) |E s |.
We will prove this by a somewhat careful counting argument.
We begin with a definition.
Definition 7.5.1. Every error pattern e is associated with a codeword c(e), which is the closest
codeword which lies within Hamming distance n from it.
For a bad error pattern we insist on having c(e) '= c note that for a bad error pattern such a
codeword always exists. Let A be the set of positions where c(e) agrees with c + e.
The rest of the argument will proceed as follows. For each possible A, we count how many
bad patterns e are associated with it (i.e. c + e and c(e) agree exactly in the positions in A). To
bound this count non-trivially, we will use Lemma 7.5.2.
Define a real number such that |A| = n. Note that since c(e) and c + e agree in at least
1 positions,
1 1 + .
(7.20)
113
For now let us fix A with |A| = n and to expedite the counting of the number of bad error
patterns, let us define two more sets:
A 1 = A S,
and
A2 = A \ A1.
See Figure 7.4 for an illustration of the notation that we have fixed so far.
S
e
A2
c+e
A1
c(e)
A
Figure 7.4: Illustration of notation used in the proof of Theorem 7.5.1. Positions in two different
vectors that agree have the same color.
.
Define such that
|A 1 | = n.
(7.21)
|A 2 | = ( )n.
(7.22)
To recap, we have argued that every bad error pattern e corresponds to a codeword c(e) '= c
and is associated with a pair of subsets (A 1 , A 2 ). So, we fix (A 1 , A 2 ) and then count the number
of bad e s that map to (A 1 , A 2 ). (Later on we will aggregate this count over all possible choices
of (A 1 , A 2 ).)
Towards this end, first we overestimate the number of error patterns e that map to (A 1 , A 2 )
by allowing such e to have arbitrary values in [n] \ (S A 2 ). Note that all such values have to be
non-zero (because of (7.18). This implies that the number of possible distinct e[n]\(SA 2 ) is at
most
(q 1)n|S||A 2 | = q n(1)n()n ,
(7.23)
114
where the equality follows from the given size of S and (7.22). Next fix a non-zero x and let us
only consider error patterns e such that
e[n]\(SA 2 ) = x.
Note that at this stage we have an error pattern e as depicted in Figure 7.5.
S
??
0
A1
A2
Figure 7.5: Illustration of the kind of error patterns we are trying to count now. The ? denote
values that have not been fixed yet.
Now note that if we fix c(e) A 2 , then we would also fix e A 2 (as (c + e) A 2 = (c(e)) A 2 ). Recall that
c is already fixed and hence, this would fix e as well. Further, note that
c(e) A 1 = (c + e) A 1 = c A 1 .
This implies that c(e) A 1 is already fixed and hence, by Lemma 7.5.2 we would fix c(e) if we fix (say
the first) (1)n+1|A 1 | positions in c(e) A 2 . Or in other words, by fixing the first (1)n+1|A 1 |
positions in e A 2 , e would be completely determined. Thus, the number of choices for e that have
the pattern in Figure 7.5 is upper bounded by
q (1)n+1|A 1 | = (q 1)(1)n+1n ,
(7.24)
2n (q 1)n+1 |E S | q log2 q
1
n
2 +2
|E A | q n/4 |E S |,
,
where the first inequality follows from q 1 q (which in turn is true for q 3) while the
last inequality follows from the fact that for q (1/) and large enough n, n+1/2
< n
. This
log2 q
4
completes the proof.
!
o(1/)
It can be shown that Theorem 7.5.1 is not true for q = 2
. The proof is left as an exercise.
115
116
Foreword
This chapter is based on lecture notes from coding theory courses taught by Venkatesan Guruswami at University at Washington and CMU; by Atri Rudra at University at Buffalo, SUNY
and by Madhu Sudan at MIT.
This version is dated April 28, 2013. For the latest version, please go to
http://www.cse.buffalo.edu/ atri/courses/coding-theory/book/
The material in this chapter is supported in part by the National Science Foundation under
CAREER grant CCF-0844796. Any opinions, findings and conclusions or recomendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the
National Science Foundation (NSF).
Chapter 8
What Cannot be Done-II
In this brief interlude of a chapter, we revisit the trade-offs between rate and relative distance
for codes. Recall that the best (and only) lower bound on R that we have seen is the GV bound
and the best upper bound on R that we have have seen so far is a combination of the Plotkin
and Hamming bounds (see Figure 4.5). In this chapter, we will prove the final upper bound on
R in this book due to Elias and Bassalygo. Then we will mention the best known upper bound
on rate (but without stating or proving it). Finally, we will conclude by summarizing what we
have seen so far and laying down the course for the rest of the book.
See Figure 8.1 for an illustration of the Elias-Bassalygo bound for binary codes. Note that
this bound is tighter than all the previous upper bounds on rate that we have seen so far.
The proof of Theorem 8.1.1 uses the following lemma:
Lemma 8.1.2. Given a q-ary code, C [q]n and 0 e n, there exists a Hamming ball of radius
e with at least
|C |V ol q (e,n)
qn
codewords in it.
Proof. We will prove the existence of the required Hamming ball by the probabilistic method.
Pick a received word y [q]n at random. It is easy to check that the expected value of |B (y, e)C |
is
|C |V ol q (e,n)
.
qn
(We have seen this argument earlier in the proof of part (ii) of Theorem 7.4.2.)
This by the probabilistic method implies the existence of a y [q]n such that
|B (y, e) C |
|C |V ol q (e, n)
as desired.
117
qn
Hamming bound
GV bound
Singleton bound
Plotkin bound
Elias-Bassalygo bound
0.8
0.6
0.4
0.2
0.2
0.4
0.6
0.8
Figure 8.1: Singleton, Hamming, Plotkin, GV and Elias-Bassalygo bounds on rate versus distance for binary codes.
Proof of Theorem 8.1.1. Let C [q]n be any code with relative distance . Define e = n J q ()
1. By Lemma 8.1.2, there exists a Hamming ball with B codewords such that the following
inequality is true:
B
|C |V ol q (e, n)
qn
qn
q n (1Hq ( J q ())+o(1)) ,
V ol q (e, n)
where the second inequality follows from our good old lower bound on the volume of a
Hamming ball (Proposition 3.3.1) and the fact that qd n qn 2 q o(n) for large enough n. This
implies that the rate R of C satisfies:
as desired.
!
"
R 1 H q J q () + o (1) ,
118
8.3 A Breather
Let us now recap the combinatorial results that we have seen so far. Table 8.1 summarizes what
we have seen so far for binary codes in Shannons world and Hammings world (under both
unique and list decoding settings).
Shannon
Hamming
BSCp
! "
1-H p is capacity
Unique
R 1 H ()
R M RRW
Explicit Asymptotically good codes?
Efficient decoding algorithms?
List
! "
1 H p is list decoding capacity
Explicit codes at capacity?
Efficient decoding algorithms?
119
distance. Further, we do not know of an explicit construction of a binary code that lies on the
GV bound. These lead to the following questions that are still wide open:
Question 8.3.3. If one can answer Question 8.3.2, then can we decode such codes efficiently
from a non-zero fraction of errors?
For list decoding, we have seen that the list decoding capacity is 1 H q (p). The natural
open questions are whether we can achieve the capacity with explicit codes (Question 7.4.1)
along with efficient list decoding algorithms (Question 7.4.2).
In the remainder of the book, we will focus on the questions mentioned above (and summarized in the last two rows of Table 8.1).
120
Foreword
This chapter is based on lecture notes from coding theory courses taught by Venkatesan Guruswami at University at Washington and CMU; by Atri Rudra at University at Buffalo, SUNY
and by Madhu Sudan at MIT.
This version is dated April 28, 2013. For the latest version, please go to
http://www.cse.buffalo.edu/ atri/courses/coding-theory/book/
The material in this chapter is supported in part by the National Science Foundation under
CAREER grant CCF-0844796. Any opinions, findings and conclusions or recomendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the
National Science Foundation (NSF).
Chapter 9
From Large to Small Alphabets: Code
Concatenation
Recall Question 8.3.2 that we had asked before: Is there an explicit asymptotically good binary
code (that is, rate R > 0 and relative distance > 0)? In this chapter, we will consider this question when we think of explicit code in the sense of Definition 6.3.1 as well as the stronger notion
of a strongly explicit code (Definition 6.3.2).
Let us recall all the (strongly) explicit codes that we have seen so far. (See Table 9.1 for an
overview.)
Code
Hamming
Hadamard
Reed-Solomon
R!
"
log n
1O n
"
!
log n
O n
1
2
#1$
n
1
!2 "
O log1 n
Table 9.1: Strongly explicit binary codes that we have seen so far.
Hamming code (Section 2.4), which has rate R = 1 O(log n/n) and relative distance =
O(1/n) and the Hadamard code (Section 2.7), which has rate R = O(log n/n) and relative distance 1/2. Both of these codes have extremely good R or at the expense of the other parameter. Next, we consider the Reed-Solomon code (of say R = 1/2) as a binary code, which does
much better = log1 n , as we discuss next.
%
&
Consider the Reed-Solomon over F2s for some large enough s. It is possible to get an n, n2 , n2 + 1 2s
Reed-Solomon code (i.e. R = 1/2). We now consider a Reed-Solomon codeword, where every
symbol in F2s is represented by an s-bit vector. Now,
code created by view% the obvious
& binary
n
1
ing symbols from F2s as bit vectors as above is an ns, ns
,
+
1
code
.
Note
that the distance
2 2
2
"
!
of this code is only logNN , where N = ns is the block length of the final binary code. (Recall
that n = 2s and so N = n log n.)
1
123
The reason for the (relatively) poor distance is that the bit vectors corresponding to two
different symbols in F2s may only differ by one bit. Thus, d positions which have different F2s
symbols might result in a distance of only d as bit vectors.
To fix this problem, we can consider applying a function to the bit-vectors to increase the
distance between those bit-vectors that differ in smaller numbers of bits. Note that such a function is simply a code! We define this recursive construction more formally next. This recursive
construction is called concatenated codes and will help us construct (strongly) explicit asymptotically good codes.
m2
mK
C out
C out (m)1
C in
C out (m)2
C out (m)N
C in
C in
C in (C out (m)N )
Proof. The first claim immediately implies the second claim on the rate and relative distance of
C out C in . The claims on the block length, dimension and alphabet of C out C in follow from the
definition.2 Next we show that the distance is at least d D. Consider arbitrary m1 &= m2 [Q]K .
Then by the fact that C out has distance D, we have
(C out (m1 ) ,C out (m2 )) D.
(9.1)
Thus for each position 1 i N that contributes to the distance above, we have
#
$$
#
$
#
C in C out (m1 )i ,C in C out (m2 )i d ,
(9.2)
as C in has distance d . Since there are at least D such positions (from (9.1)), (9.2) implies
(C out C in (m1 ) ,C out C in (m2 )) d D.
The proof is complete as the choices of m1 and m2 were arbitrary.
If C in and C out are linear codes, then so is C out C in , which can be proved for example, by
defining a generator matrix for C out C in in terms of the generator matrices of C in and C out . The
proof is left as an exercise.
H q1 (1 r )
Technically, we need to argue that the q kK messages map to distinct codewords to get the dimension of kK .
However, this follows from the fact, which we will prove soon, that C out C in has distance d D 1, where the inequality follows for d , D 1.
125
GV bound
Zyablov bound
0.8
0.6
0.4
0.2
0
0
0.2
0.4
0.6
0.8
Figure 9.2: The Zyablov bound for binary codes. For comparison, the GV bound is also plotted.
Then optimizing over the choice of r , we get that the rate of the concatenated code satisfies
R
max
'
r 1
H q1 (1 r )
where the bound of r < 1 H q ( + ) is necessary to ensure that R > 0. This lower bound on the
rate is called the Zyablov bound. See Figure 9.2 for a plot of this bound for binary codes.
To get a feel for how the bound behaves, consider the case when = 12 . We claim that
the Zybalov bound states that R (3 ). (Recall that the GV bound for the same has a rate of
(2 ).) The proof of this claim is left as an exercise.
Note that the Zyablov bound implies that for every > 0, there exists a (concatenated) code
with rate R > 0. However, we already knew about the existence of an asymptotically good code
by the GV bound (Theorem 4.2.1). Thus, a natural question to ask is the following:
Perform an exhaustive search among all generator matrices for one satisfying the required
property for C in . One can do this because the Varshamov bound (Theorem 4.2.1) states
that there exists a linear code which lies on the GV bound. This will take q O(kn) time.
2
Using k = r n (or n = O(k)), we get q O(kn) = q O(k ) = N O(log N ) , which is upper bounded by
(nN )O(log(nN )) , a quasi-polynomial time bound.
The second option is to construct C in in q O(n) time and thus use (nN )O(1) time overall. See
Exercise 9.4.1 for one way to construct codes on the GV bound in time q O(n) .
Thus,
Theorem 9.2.1. We can construct a code that achieves the Zyablov bound in polynomial time.
In particular, we can construct explicit asymptotically good code in polynomial time, which
answers Question 9.2.1 in the affirmative.
A somewhat unsatisfactory aspect of this construction (in the proof of Theorem 9.2.1) is that
one needs a brute force search for a suitable inner code (which led to the polynomial construction time). A natural followup question is
Question 9.2.2. Does there exist a strongly explicit asymptotically good code?
127
In fact, this ensemble is the following: for Fk , the inner code C in
: Fkq F2k
q is defined as
q
C in
(x) = (x, x). This ensemble is called the Wozencraft ensemble. We claim that C in
for every
R, 0 < R < 1. The outer code C out has relative distance out = 1 R and block length of N =
def
1
2
N
C out (C in
,C in
, . . . ,C in
)
#1
R
2.
The
Proof. Consider m1 &= m2 (Fq k )K . By the distance of the outer code |S| (1 R)N , where
)
*
S = i |C out (m1 )i &= C out (m2 )i .
#
$
def
i
Call the i th inner code good if C in
has distance at least d = H q1 21 2k. Otherwise, the inner
code is considered bad. Note that by Theorem 9.3.1, there are at most N bad inner codes. Let
S g be the set of all good inner codes in S, while S b is the set of all bad inner codes in S. Since
S b N ,
|S g | = |S| |S b | (1 R )N .
(9.3)
For each good i S, by definition we have
!
# 1$ $ i #
# 2 $ $"
#
i
C in C out m i ,C in C out m i d .
(9.4)
Finally, from (9.3) and (9.4), we obtain that the distance of C is at least
(1 R ) N d
= (1 R )H q1
,
1
N 2k,
2
as desired.
Since the Reed-Solomon codes as well as the Wozencraft ensemble are strongly explicit, the
above result implies the following:
Corollary 9.3.3. The concatenated code C from Proposition 9.3.2 is an asymptotically good code
and is strongly explicit.
Thus, we have now satisfactorily answered Question 9.2.2 modulo Theorem 9.3.1, which we
prove next.
128
are not possible. We claim that y C in for at most one Fk . The proof is by a simple case
2
distance < H q 2 ). Since y C in for at most one value of , the total number of bad codes
is at most
-.
+
,
/+
+
,
,
- y|w t (y) < H 1 1 2k - V ol q H 1 1 2k, 2k
q
q
2
2
1 1
( 2 ))2k
q Hq (Hq
=q
=
(9.5)
( 12 )2k
qk
q 2k
< (q k 1)
= N .
(9.6)
(9.7)
In the above, (9.5) follows from our good old upper bound on the volume of a Hamming ball
(Proposition 3.3.1) while (9.6) is true#for large
$ enough k. Thus for at least (1 )N values of ,
1 1
By concatenating an outer code of distance D and an inner code of distance d , we can obtain a code of distance at least Dd (Theorem 9.1.1). Dd is called the concatenated codes design distance. For asymptotically good codes, we have obtained polynomial time construction
of such codes (Theorem 9.2.1, as well as strongly explicit construction of such codes (Corollary 9.3.3). Further, since these codes were linear, we also get polynomial time encoding. However, the following natural question about decoding still remains unanswered.
Question 9.3.1. Can we decode concatenated codes up to half their design distance in polynomial time?
129
9.4 Exercises
Exercise 9.4.1. In Section 4.2.1, we saw that the Gilbert construction can compute an (n, k)q
code in time q O(n) . Now the Varshamov construction (Section 4.2.2) is a randomized construction and it is natural to ask how quickly can we compute an [n, k]q code that meets the GV
bound. In this exercise, we will see that this can also be done in q O(n) deterministic time, though
the deterministic algorithm is not that straight-forward anymore.
1. (A warmup) Argue that Varshamovs proof gives a q O(kn) time algorithm that constructs
an [n, k]q code on the GV bound. (Thus, the goal of this exercise is to shave" off a factor
of k from the exponent.)
,n
2. A k n Toeplitz Matrix A = {A i , j }ki =1,
satisfies the property that A i , j = A i 1, j 1 . In other
j =1
words, any diagonal has the same value. For example, the following is a 4 6 Toeplitz
matrix:
1 2 3 4 5 6
7 1 2 3 4 5
8 7 1 2 3 4
9 8 7 1 2 3
Prove the following claim: For any non-zero m Fkq , the vector m T is uniformly dis%
&
tributed over Fnq , that is for every y Fnq , Pr m T = y = q n .
(Hint: Write down the expression for the value at each of the n positions in the vector mT
in terms of the values in the first row and column of T . Think of the values in the first row
and column as variables. Then divide these variables into two sets (this division" will
depend on m) say S and S. Then argue the following: for every fixed y Fnq and for every
3. Briefly argue why the claim in part (b) implies that a random code defined by picking its
generator matrix as a random Toeplitz matrix with high probability lies on the GV bound.
4. Conclude that an [n, k]q code on the GV bound can be constructed in time 2O(k+n) .
130
Foreword
This chapter is based on lecture notes from coding theory courses taught by Venkatesan Guruswami at University at Washington and CMU; by Atri Rudra at University at Buffalo, SUNY
and by Madhu Sudan at MIT.
This version is dated April 30, 2013. For the latest version, please go to
http://www.cse.buffalo.edu/ atri/courses/coding-theory/book/
The material in this chapter is supported in part by the National Science Foundation under
CAREER grant CCF-0844796. Any opinions, findings and conclusions or recomendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the
National Science Foundation (NSF).
Chapter 10
Codes from Graphs: Expander Codes
In this chapter, we will again consider Question 9.2.2. Recall that we answered the question
in the affirmative in Corollary 9.3.3 using Justesen codes. However, for the Justesen code we
needed two families of codes to construct our final code. Aesthetically, it would be nice to be
able to construct a strongly explicit asymptotically good code in one shot." In this chapter, we
will consider the following question
Question 10.0.1. Can we construct strongly explicit asymptotically good binary codes without code concatenation?
In addition to the aesthetic appeal of the question above, it makes sense to answer the above
question because we will need a new technique to construct such a code. In this chapter we will
see a new family of codes called expander codes, which are very different from concatenated
codes. Indeed, to date the only ways we know to answer Question 9.2.2 for binary codes are
through code concatenation and expander codes. Further, as we will see later expander codes
have linear time decoding algorithms, which make them especially attractive for potential practical applications.
To define expander codes, we will need some notions from graph theory, which we define
next.
!1
r1
!2
!3
r2
!4
!5
r3
!6
!7
0 0 0 1 1 1 1
0 1 1 0 0 1 1 .
1 0 1 0 1 0 1
Recall that the above is the parity check matrix of the [7, 4, 3]2 Hamming code (see Section 2.3).
This connection between the Hamming code and a bipartite graph is not a co-incidence:
we can assign a bipartite graph to any linear code. We do this next.
In this chapter, we will consider codes whose factor graphs are so called expander graphs."
r1
!3
r2
!4
r3
!5
r4
!6
r5
!7
Definition 10.2.1 (Left Regularity). A bipartite graph G = (L, R, E ) is said to be D-left regular if
every vertex in L has degree exactly D.
For example, the graph in Figure 10.2 is 2-left regular.
Definition 10.2.2 (Neighbor Set). For any left vertex set S L, a vertex u R is called a neighbor
of S if it is adjacent to some vertex in S. We denote by N (S) the set of neighbors of S.
For example, in the graph in Figure 10.2, if S = {!5 , !6 } (set of gray left vertices), then N (S) =
{r 2 , r 4 , r 5 } (the set of orange right vertices).
133
Definition 10.2.3 (Unique Neighbor Set). For any left vertex set S L, a vertex u R is called
a unique neighbor of S if it is adjacent to exactly one vertex in S. We denote by U (S) the set of
unique neighbors of S.
For example, in the graph in Figure 10.2, if S = {!5 , !6 } (set of gray left vertices), then U (S) =
{r 2 , r 5 } (the set of light orange right vertices).
We are finally ready to define expander graphs.
Definition 10.2.4 (Bipartite Expander Graphs). An (n, m, D, , ) bipartite expander is a D-left
regular bipartite graph G = (L, R, E ) where |L| = n and |R| = m such that for every S L with
|S| n, we have
|N (S)| |S|.
%
&
For example, the graph in Figure 10.2 is a 7, 5, 2, 27 , 32 bipartite expander.
In the above definition, gives a measure of how small" the expanding set can be and
gives a measure of the expansion and is called the expansion factor. Note that we always have
D. Next, we collect some known results about the existence of bipartite expanders.
Existence of Bipartite Expander graphs. The following result shows that there exists expanders
with an expansion factor that can get arbitrarily close to the upper bound of D:
Theorem 10.2.1.
For(every > 0, m n, there exists an (n, m, D, , D(1 )) bipartite expander
'
% m &
log(n/m)
where D =
and
Dn .
The above can be proven with the probabilistic method and the proof is left as an exercise.
We present few remarks on the above result:
Note that we have m n (and this is needed for the connection to constructing codes),
so we want expansion from the larger side to the smaller side. This is the harder direction
since there is less room to expand to. (For example, if we could have m = Dn, then note
that we have a trivial (n, m, D, 1, D) bipartite expander.)
The expansion factor can be brought arbitrarily close to the maximum value of D at the
cost of increasing the value of D.
By definition, nD(1) is a trivial lower bound on m since sets of size up to (and including) n expand by a factor of D(1 ). The above result achieves a value of m that is 1/
times larger than this trivial bound.
Theorem 10.2.1 is nice but to answer Question 10.0.1 in the affirmative we will need a strongly
explicit construction of bipartite expanders with > D/2. It turns out that such a construction
is known.
Theorem 10.2.2. For every constant > 0 and every desired ratio 0 < < 1, there exist strongly
explicit (n, m, D, , D(1)) bipartite expanders for any large enough n (and m = n) with D and
> 0 being constants (that only depend on and ).
We will use Theorem 10.2.2 later to construct strongly explicit asymptotically good codes.
134
A Property of Bipartite Expanders. We now state a property of D-left regular bipartite graphs
with expansion factor > D/2, which will be crucial in our answer to Question 10.0.1.
Lemma 10.2.3. Let G = (L, R, E ) be an (n, m, D, , D(1)) bipartite expander graph with < 1/2.
Then for any S L with |S| n, we have
|U (S)| D(1 2)|S|.
Proof. The total umber of edges going out of S is exactly D|S| by virtue of G being D-left regular.
By the expansion property, |N (S)| D(1 )|S|. Hence, out of the D|S| edges emanating out of
S, at least D(1)|S| go to distinct vertices, which leaves at most D|S| edges. Therefore at most
D|S| vertices out of the at least D(1 )|S| vertices in N (S) can have more than one incident
edge. Thus, we have
|U (S)| D(1 )|S| D|S| = (1 2)D|S|,
as desired.
Proof. The proof follows from the definition of C (G), a parity check matrix and the fact that c j
for every j ' S, does not participate in any of the parity checks.
We record our first result on expander codes.
Theorem 10.3.2. Let G be an (n, n k, D, , D(1 )) bipartite expander with < 1/2. Then C (G)
is an [n, k, n + 1]2 code.
Proof. The claim on the block length and the linearity of C (G) follows from the definition of
expander codes. The claim on the dimension would follow once we argue the distance of C (G)
(since then as the distance is at least one, every 2k possible codewords are distinct).
For the sake of contradiction, let us assume that C (G) has distance at most n. Then by
Proposition 2.3.4, there exists a non-zero codeword c C (G) such w t (c) n. Let S be the set
of non-zero coordinates of c. Since G is an expander, by Lemma 10.2.3,
|U (S)| D(1 2)|S| > 0,
135
where the inequality follows from the fact that < 1 and |S| 1 (since c is non-zero). This
implies there exists an r U (S). Now the parity check in (10.1) corresponding to r is just c ! for
some ! S, which in turn implies that (10.1) is not satisfied (as c ! '= 0). Thus, Lemma 10.3.1
implies that c ' C (G), which leads to a contradiction, as desired.
Note that Theorem 10.3.2 along with Theorem 10.2.2 answers Question 10.0.1 in the affirmative.
A Better Bound on Distance. It turns out that C (G) has almost twice the distance as argued in
Theorem 10.3.2.
Theorem 10.3.3. Let G be an (n, n k, D, , D(1 )) bipartite expander with < 1/2. Then C (G)
has distance at least 2(1 )n.
Proof Sketch. As in the proof of Theorem 10.3.2, for the sake of contradiction, let us assume that
C (G) has distance < 2(1 )n. Then by Proposition 2.3.4, there exists a non-zero codeword
c C (G) such w t (c) < 2(1 )n. Let S be the set of non-zero coordinates of c. We will argue
that U (S) '= ( and the rest of the argument is the same as in the proof of Theorem 10.3.2.
If |S| n, then we can just use the proof of Theorem 10.3.2. So let us assume that there
exists a subset T S such that |T | = n. Then by Lemma 10.2.3, we have
|U (T )| D(1 2)n.
(10.2)
Now since the total number of edges emanating out of S \ T is at most D|S \ T |, we have
|N (S \ T )| D|S \ T | < D(1 2)n,
where the inequality follows from the facts that |S| < 2(1 )n and |T | = n.
Now, note that
|U (S)| |U (T )| |N (S \ T )| > 0,
where the inequality follows from (10.2) and (10.3).
136
(10.3)
Foreword
This chapter is based on lecture notes from coding theory courses taught by Venkatesan Guruswami at University at Washington and CMU; by Atri Rudra at University at Buffalo, SUNY
and by Madhu Sudan at MIT.
This version is dated May 1, 2013. For the latest version, please go to
http://www.cse.buffalo.edu/ atri/courses/coding-theory/book/
The material in this chapter is supported in part by the National Science Foundation under
CAREER grant CCF-0844796. Any opinions, findings and conclusions or recomendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the
National Science Foundation (NSF).
Chapter 11
Decoding Concatenated Codes
In this chapter we study Question 9.3.1. Recall that the concatenated code C out C in consists of
an outer [N , K , D]Q=q k code C out and an inner [n, k, d ]q code C in , where Q = O(N ). (Figure 11.1
illustrates the encoding function.) Then C out C in has design distance Dd and Question 9.3.1
asks if we can decode concatenated codes up to half the design distance (say for concatenated
codes that we saw in Section 9.2 that lie on the Zyablov bound). In this chapter, we begin with
a very natural unique decoding algorithm that can correct up to Dd /4 errors. Then we will
consider a more sophisticated algorithm that will allow us to answer Question 9.3.1 in the affirmative.
This leaves us with the task of coming up with a polynomial time decoding algorithm for the
inner code. Our task of coming up with such a decoder is made easier by the fact that the
running time needs to be polynomial in the final block length. This in turn implies that we
would be fine if we pick a decoding algorithm that runs in singly exponential time in the inner
block length as long as the inner block length is logarithmic in the outer code block length.
(Recall that we put this fact to good use in Section 9.2 when we constructed explicit codes on
the Zyablov bound.) Note that the latter is what we have assumed so far and thus, we can use
the Maximum Likelihood Decoder (or MLD) (e.g. its implementation in Algorithm 1, which we
will refer to as D C in ). Algorithm 7 formalizes this algorithm.
It is easy to check that each step of Algorithm 7 can be implemented in polynomial time. In
particular,
139
m1
m2
mK
C out
C out (m)1
C out (m)2
C in
C out (m)N
C in
C in
C in (C out (m)N )
Encoding of C out C in
m1
m2
mK
D C out
y#
y 1#
y 2#
D C in
y1
#
yN
D C in
D C in
y2
yN
Decoding of C out C in
Figure 11.1: Encoding and Decoding of the concatenated code C out C in . D C out is a unique
decoding algorithm for C out and D C in is a unique decoding algorithm for the inner code (e.g.
MLD).
$ !
#
qk
1: y# y 1# , , y N
# $
2: m# D C out y#
3: RETURN m#
"N
where
# $
# $
C in y i# = D C in y i 1 i N .
140
1. The time complexity of Step 1 is O(nq k ), which for our choice of k = O(log N ) (and constant rate) for the inner code, is (nN )O(1) time.
2. Step 2 needs polynomial time by our assumption that the unique decoding algorithm
D C out takes N O(1) time.
Next, we analyze the error-correction capabilities of Algorithm 7:
Proposition 11.1.1. Algorithm 7 can correct < Dd
4 many errors.
#
$
Proof. Let m be the (unique) message such that C out C in (m) , y < Dd
4 .
We begin the proof by defining a bad event as follows. We say a bad event has occurred (at
position 1 i N ) if y i '= C in (C out (m)i ). More precisely, define the set of all bad events to be
%
&
B = i |y i '= C in (C out (m)i ) .
Note that if |B| < D2 , then the decoder in Step 2 will output the message m. Thus, to complete the proof, we only need to show that |B| < D/2. To do this, we will define a superset
B # B and then #argue that |B # | < D/2,
$ d which would complete the proof.
Note that if y i ,C in (C out (m)i ) < 2 then i ' B (by the proof of Proposition 1.4.1) though
the other direction does not hold. We define B # to be the set of indices where i B # if and only
if
#
$ d
y i ,C in (C out (m)i ) .
2
#
Note that B B .
Now by definition, note that the total number of errors is at least |B # | d2 . Thus, if |B # | D2 ,
D
#
then the total number of errors is at least D2 d2 = Dd
4 , which is a contradiction. Thus, |B | < 2 ,
which completes the proof.
Note that Algorithm 7 (as well the proof of Proposition 11.1.1) can be easily adapted to work
for the case where the inner codes are different, e.g. Justesen codes (Section 9.3).
Thus, Proposition 11.1.1 and Theorem 11.3.3 imply that
Theorem 11.1.2. There exist an explicit linear code on the Zyablov bound that can be decoded
up to a fourth of the Zyablov bound in polynomial time.
This of course is predicated on the fact that we need a polynomial time unique decoder for
the outer code. Note that Theorem 11.1.2 implies the existence of an explicit asymptotically
good code that can be decoded from a constant fraction of errors.
We now state two obvious open questions. The first is to get rid of the assumption on the
existence of D C out :
Question 11.1.1. Does there exist a polynomial time unique decoding algorithm for outer
codes, e.g. for Reed-Solomon codes?
141
Next, note that Proposition 11.1.1 does not quite answer Question 9.3.1. We move to answering this latter question next.
Proof. Given a received word y (Fq {?})N with s erasures and e errors, let y# be the sub-vector
with no erasures. This implies that y# FqN s is a valid received word for an [N s, K ]q ReedSolomon code. (Note that this new Reed-Solomon code has evaluation points that corresponding to evaluation points of the original code, in the positions where an erasure did not occur.)
Now run the error decoder algorithm from Theorem 11.2.1 on y# . It can correct y# as long as
e<
(N s) K + 1
.
2
This condition is implied by (11.1). Thus, we have proved one can correct e errors under (11.1).
Now we have to prove that one can correct the s erasures under (11.1). Let z# be the output after
correcting e errors. Now we extend z# to z (Fq {?})N in the natural way. Finally, run the erasure
decoding algorithm from Theorem 11.2.1 on z. This works as long as s < (N K + 1), which in
turn is true by (11.1).
The time complexity of the above algorithm is O(N 3 ) as both the algorithms from Theorem 11.2.1 can be implemented in cubic time.
Next, we will use the above errors and erasure decoding algorithm to design decoding algorithms for certain concatenated codes that can be decoded up to half their design distance (i.e.
up to Dd /2).
142
y i# D C in (y i ).
'
(
w i min (y i# , y i ), d2 .
2:
3:
With probability
4:
2w i
d , set
##
##
5: m# D C out (y## ), where y = (y 1## , . . . , y N
).
6: RETURN m#
i =1
Dd
.
2
ei <
(11.2)
and
!
" 2)
e i < D,
E 2e # + s #
d i
144
and
! "
E X ie = Pr[X ie = 1] = 0.
d
(y i# , y i ),
(y i# , y i ) = (c i , y i ) = e i .
! " 2w i
E X i? =
.
d
Now in this case, if an erasure is not declared at position i , then X ie = 1. Thus, we have
! "
2w i
.
E X ie = Pr[X ie = 1] = 1
d
Next, we claim that as c i '= y i# ,
ei + wi d ,
which implies
(11.4)
!
"
2w i 2e i
E 2X ie + X i? = 2
,
d
d
as desired.
To complete the proof, we show (11.4) via yet another case analysis.
Case 2.1: (w i = (y i# , y i ) < d /2) By definition of e i , we have
e i + w i = (y i , c i ) + (y i# , y i ) (c i , y i# ) d ,
where the first inequality follows from the triangle inequality and the second inequality follows
from the fact that C in has distance d .
Case 2.2: (w i = d2 (y i# , y i )) As y i# is obtained from MLD, we have
(y i# , y i ) (c i , y i ).
e i = (c i , y i ) (y i# , y i )
d
.
2
ei + wi d ,
!
145
4:
5:
y i# D C in (y i ).
'
(
w i min (y i# , y i ), d2 .
If <
2w i
, set
d
##
##
6: m# D C out (y ), where y## = (y 1## , . . . , y N
).
7: RETURN m#
We note that in the proof of Lemma 11.3.1, we only use the randomness to show that
!
" 2w i
Pr y i## =? =
.
d
y i##
,.
"
2w i
2w i
=
,
=? = Pr 0,
d
d
as before (the last equality follows from our choice of ). One can verify that the proof of
Lemma 11.3.1 can be used to show the following lemma:
Lemma 11.3.2. Let y be a received word such that there exists a codeword C out C in (m) = (c 1 , . . . , c N )
##
#
#
[q n ]N such that (C out C in (m), y) < Dd
2 . Further, if y has e errors and s erasures (when compared with C out C in (m)), then
!
"
E 2e # + s # < D.
Next, we will see that Algorithm 9 can be easily derandomized."
1
Define Q = {0, 1} { 2w
, , 2wd N }. Then because for each i , w i = min((y i# , y i ), d /2), we have
d
Q = {0, 1} {q 1 , , q m }
/ 0
for some m d2 . Notice that for every [q i , q i +1 ), just before Step
6, Algorithm 9 computes the same y## . (See Figure 11.2 for an illustration as to why this is the
case.)
Everything gets ?
q1
q2
q i 1
qi
q i +1
2w
1: Q { d 1 , , d N } {0, 1}.
2: FOR Q DO
3:
4:
5:
6:
1 i N DO
y i# D C in (y i ).
(
'
d
#
w i min (y i , y i ), 2 .
FOR
If <
2w i
d ,
##
m# D C out (y## ), where y## = (y 1## , . . . , y N
).
#
# $ $
8: RETURN m# for = arg minQ C out C in m# , y
7:
Note that Algorithm 10 is Algorithm 9 repeated |Q| times. Since |Q| is O(n), this implies that
Algorithm 10 runs in polynomial time. This along with Theorem 9.2.1 implies that
Theorem 11.3.3. For every constant rate, there exists an explicit linear binary code on the Zyablov
bound. Further, the code can be decoded up to half of the Zyablov bound in polynomial time.
Note that the above answers Question 9.3.1 in the affirmative.
Foreword
This chapter is based on lecture notes from coding theory courses taught by Venkatesan Guruswami at University at Washington and CMU; by Atri Rudra at University at Buffalo, SUNY
and by Madhu Sudan at MIT.
This version is dated May 1, 2013. For the latest version, please go to
http://www.cse.buffalo.edu/ atri/courses/coding-theory/book/
The material in this chapter is supported in part by the National Science Foundation under
CAREER grant CCF-0844796. Any opinions, findings and conclusions or recomendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the
National Science Foundation (NSF).
Chapter 12
Efficiently Achieving the Capacity of the
BSCp
Table 12.1 summarizes the main results we have seen so far for (binary codes).
Shannon
Capacity
Explicit Codes
Efficient Algorithms
Hamming
Unique Decoding
List Decoding
GV (Thm 4.2.1)
1 H (p) (Thm 7.4.1)
MRRW (Sec 8.2)
Zyablov bound (Thm 9.2.1)
?
1
?
2 Zyablov bound (Thm 11.3.3)
noise is memory-less can be exploited to pick the outer code that can correct from some small
but constant fraction of worst-case errors.
Before delving into the details, we present the main ideas. We will use an outer code C out that
has rate close to 1 and can correct from some fixed constant (say ) fraction of worst-case errors.
We pick an inner code C in that achieves the BSCp capacity with parameters as guaranteed by
Theorem 6.3.1. Since the outer code has rate almost 1, the concatenated code can be made
to have the required rate (since the final rate is the product of the rates of C out and C in ). For
decoding, we use the natural decoding algorithm for concatenated codes from Algorithm 7.
Assume that each of the inner decoders has a decoding error probability of (about) . Then the
intermediate received word y$ has an expected fraction of errors (with respect to the outer
codeword of the transmitted message), though we might not have control over where the errors
occur. However, we picked C out so that it can correct up to fraction of worst-case errors. This
shows that everything works in expectation. To make everything work with high probability (i.e.
achieve exponentially small overall decoding error probability), we make use of the fact that
since the noise in BSCp is independent, the decoding error probabilities of each of the inner
decodings is independent and thus, by the Chernoff bound (Theorem 3.1.6), with all but an
exponentially small probability y$ has () fraction of errors, which we correct with the worstcase error decoder for C out . See Figure 12.1 for an illustration of the main ideas. Next, we present
the details.
m1
m2
mK
y$
y 1$
y 2$
D in
y1
D out
$
yN
D in
D in
y2
yN
there is a decoding algorithm D in (which returns the transmitted codeword) that runs in
time Tin (k) and has decoding error probability no more than 2 over B SC p .
Table 12.2 summarizes the different parameters of C out and C in .
Dimension
C out
C in
k O(log N )
Block
length
N
Rate
Decoder
2k
1 2
D out
Decoding
time
Tout (N )
1 H (p) 2
D in
Tin (k)
Decoding
guarantee
fraction of
worst-case errors
2 decoding error
probability over BSCp
as desired.
For the rest of the chapter, we will assume that p is an absolute constant. Note that this
implies that k = (n) and thus, we will use k and n interchangeably in our asymptotic bounds.
Finally, we will use N = nN to denote the block length of C .
The decoding algorithm for C that we will use is Algorithm 7, which for concreteness we
reproduce as Algorithm 11.
Algorithm 11 Decoder for efficiently achieving BSCp capacity
$ % &N
#
I NPUT: Received word y = y 1 , , y N q n
% &K
O UTPUT: Message m$ q k
#
$ %
$
1: y$ y 1$ , , y N
qk
# $
2: m$ D out y$
&N
where
# $
# $
C in y i$ = D in y i 1 i N .
3: RETURN m$
Note that encoding the outer code takes O(N 2 ) operations over Fq k . The term O(N 2 k 2 ) then follows from the
fact that each operation over Fq k can be implemented with O(k 2 ) operations over Fq .
151
(12.1)
Next, we will show that decoding via Algorithm 11 leads to an exponentially small decoding
error probability over B SC p . Further, we will use constructions that we have already seen in this
book to instantiate C out and C in with the required properties.
By the properties of D in , for any fixed i , there is an error at y i$ with probability 2 . Each
such error is independent, since errors in B SC p itself are independent by definition. Because of
N
is at most e 6 . Since the decoder D out fails only when there are more than N errors, this is
also the final decoding error probability. Expressed in asymptotic terms, the error probability is
2(
N
n
existence of a linear code with decoding error probability at most 2 (which is what we need).
Thus, with the restriction on k from the outer code, we have the following restriction on k:
)
*
log( 1 )
#
$
O
log
N
.
2
Note, however, that since the proof of Theorem 6.3.1 uses MLD on the inner code and Algorithm 1 is the only known implementation of MLD, we have Tin = 2O(k) (which is what we
needed in (12.1). The construction time is even worse. There are 2O(kn) generator matrices; for
each of these, we must check the error rate for each of 2k possible transmitted codewords, and
for each codeword, computing the decoding error probability requires time 2O(n) .2 Thus, the
2
construction time for C in is 2O(n ) .
2
To see why the latter claim is true, note that there are 2n possible received words and given any one of these
received words, one can determine (i) if the MLD produces a decoding error in time 2O(k) and (ii) the probability
that the received word can be realized, given the transmitted codeword in polynomial time.
152
c1
c1
c3
c2
c4
c2
c3
c N 1
c4
cN
c N 1
cN
Figure 12.2: Error Correction cannot decrease during folding." The example has k = 2 and a
pink cell implies an error.
log N )
log( 1 )
2
12.4.2 Wrapping Up
We now recall the construction, encoding and decoding time complexity for our
"
! construction
2
log2
#1$
. The
of C . The construction time for C in is 2O(n ) , which substituting for n, is 2 4
construction !time for "C out , meanwhile, is only poly(N ). Thus, our overall, construction time is
log2
#1$
poly(N ) + 2 4
.
As we have seen in Section 12.1, the encoding
time
for this code is O(N 2 ), and the decoding
!
"
time is N
O(1)
O(n)
+ N 2
= poly(N )+N 2
N
n
1
2
# $
log 1
=2
(6 N )
Theorem 12.4.1. For every constant p and 0 < < 1 H (p), there exists a linear code C of block
length N and rate at least 1 H (p) , such that
(a) C can be constructed in time poly(N ) + 2O(
(c) There exists a poly(N ) + N 2O( ) time decoding algorithm that has an error probability
6
of at most 2( N ) over the B SC p .
*
*
*
*
*
*
*
Note that r = 1 H ( ) = 1 + log + (1 ) log(1 ). Noting that log(1 ) = (), we can
*
deduce that r = 1 O( log(1/)).
3
154
Thus, we have answered in the affirmative Question 6.3.1, which was the central open question from Shannons work. However, there is a still somewhat unsatisfactory aspect of the result
above. In particular, the exponential dependence on 1/ in the decoding time complexity is not
nice. This leads to the following question:
#1$
in the decoding
Clearly, in terms of time complexity, this is superior to the previous option in Section 12.4.1.
Such codes are called Expander
codes.
One can essentially do the same calculations as in
!
"
Section 12.4.1 with =
1
2
log (1/)
2
N 2poly( ) . Thus, even though we obtain an improvement in the time complexities as compared
to Theorem 12.4.1, this does not answer Question 12.4.1.
155
Foreword
This chapter is based on lecture notes from coding theory courses taught by Venkatesan Guruswami at University at Washington and CMU; by Atri Rudra at University at Buffalo, SUNY
and by Madhu Sudan at MIT.
This version is dated May 1, 2013. For the latest version, please go to
http://www.cse.buffalo.edu/ atri/courses/coding-theory/book/
The material in this chapter is supported in part by the National Science Foundation under
CAREER grant CCF-0844796. Any opinions, findings and conclusions or recomendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the
National Science Foundation (NSF).
Chapter 13
Efficient Decoding of Reed-Solomon Codes
So far in this book, we have shown how to efficiently decode explicit codes up to half of the
Zyablov bound (Theorem 11.3.3) and how to efficiently achieve the capacity of the BSCp (Theorem 12.4.1). The proofs of both of these results assumed that one can efficiently do unique
decoding for Reed-Solomon codes up to half its distance (Theorem 11.2.1). In this chapter, we
present such a unique decoding algorithm. Then we will generalize the algorithm to a list decoding algorithm that efficiently achieves the Johnson bound (Theorem 7.3.1).
yi
7
6
5
4
3
2
1
1
2
1
1
6
5
i
7
2
3
4
5
6
n = 14, k = 2, e = 6
i :y i $=P (i )
(X i ) .
See Figure 13.3 for an illustration of the E (X ) corresponding to the received word in Figure 13.1.
Now we claim that for every 1 i n,
y i E (i ) = P (i ) E (i ) .
(13.1)
To see why (13.1) is true, note that if y i $= P (i ), then both sides of (13.1) are 0 (as E (i ) = 0).
On the other hand, if y i = P (i ), then (13.1) is obviously true.
All the discussion above does not seem to have made any progress as both E (X ) and P (X )
are unknown. Indeed, the task of the decoding algorithm is to find P (X )! Further, if E (X ) is
known then one can easily compute P (X ) from y (the proof is left as an exercise). However,
note that we can now try and do reverse engineering. If we think of coefficients of P (X ) (of
which there are k) and the coefficients of E (X ) (of which there are e + 1) as variables, then we
have n equations from (13.1) in e + k + 1 variables. From our bound on e, this implies we have
more equations than variables. Thus, if we could solve for these unknowns, we would be done.
158
yi
P (X ) = X
7
6
5
4
3
2
1
1
2
1
1
6
5
i
7
2
3
4
5
6
7
n = 14, k = 2, e = 6
Figure 13.2: An illustration of the closest codeword P (X ) = X for the received word from Figure 13.1. Note that we are considering polynomials of degree 1, which are lines."
However, there is a catch these n equations are quadratic equations, which in general are NPhard to solve. However, note that for our choice of e, we have e + k 1 % n. Next, we will exploit
this with a trick that is sometimes referred to as linearization. The idea is to introduce new
variables so that we can convert the quadratic equations into linear equations. Care must be
taken so that the number of variables after this linearization step is still smaller than the (now
linear) n equations. Now we are in familiar territory as we know how to solve linear equations
over a field (e.g. by Gaussian elimination). (See section 13.4 for some more discussion on the
hardness of solving quadratic equations and the linearization technique.)
def
N (X )
.
E (X )
The main idea in the Welch-Berlekamp algorithm is to forget" what N (X ) and E (X ) are
meant to be (other than the fact that they are degree bounded polynomials).
yi
7
6
5
4
3
2
1
1
2
1
1
6
5
i
7
2
3
4
5
6
7
Figure 13.3: An illustration of the the error locator polynomial E (X ) = (X + 5)(X + 2)(X + 1)(X
2)(X 5)(X 6) for the received word from Figure 13.1. Note that E (X ) is the product of the
green lines.
N (X ) and y (such that y i $= 0 for 1 i n) one can find the error locations by checking positions
where N (i ) = 0. While each of the polynomials E (X ) , N (X ) is hard to find individually, the
main insight in the Welch-Berlekamp algorithm is that computing them together is easier.
Next we analyze the correctness and run time of Algorithm 12.
Correctness of Algorithm 12. Note that if Algorithm 12 does not output fail, then the algorithm produces a correct output. Thus, to prove the correctness of Algorithm 12, we just need
the following result.
Theorem 13.1.1. If (P (i ))ni=1 is transmitted (where P (X ) is a polynomial of degree at most k 1)
and at most e < nk+1
errors occur (i.e. (y, (P (i ))ni=1 ) e), then the Welch-Berlekamp algo2
rithm outputs P (X ).
The proof of the theorem above follows from the subsequent claims.
Claim 13.1.2. There exist a pair of polynomials E (X ) and N (X ) that satisfy Step 1 such that
N (X )
E (X ) = P (X ).
N2 (X )
1 (X )
Note that now it suffices to argue that N
E 1 (X ) = E 2 (X ) for any pair of solutions ((N1 (X ), E 1 (X ))
and (N2 (X ), E 2 (X )) that satisfy Step 1, since Claim 13.1.2 above can then be used to see that ratio
must be P (X ). Indeed, we will show this to be the case:
160
y i E (i ) = N (i ) 1 i n.
(13.2)
RETURN
fail
N (X )
4: P (X ) E (X ) .
5: IF (y, (P (i ))n
) > e THEN
i =1
6:
RETURN
fail
7: ELSE
8:
RETURN
P (X )
E (X ) = X e y,(P (i ))i =1
"
1i n|y i $=P (i )
(X i ).
(13.3)
y i $= P (i ).
(13.4)
(13.5)
< n,
Where the last inequality follows from the upper bound on e. Since deg(R(X )) < n, by the degree
mantra (Proposition 5.2.3) we have R(X ) 0. This implies that N1 (X )E 2 (X ) N2 (X )E 1 (X ). Note
N2 (X )
1 (X )
that as E 1 (X ) $= 0 and E 2 (X ) $= 0, this implies that N
E 1 (X ) = E 2 (X ) , as desired.
Implementation of Algorithm 12. In Step 1, N (X ) has e + k unknowns and E (X ) has e + 1
unknowns. For each 1 i n, the constraint in (13.2) is a linear equation in these unknowns.
Thus, we have a system of n linear equations in 2e + k + 1 < n + 2 unknowns. By claim 13.1.2,
this system of equations have a solution. The only extra requirement is that the degree of the
polynomial E (X ) should be exactly e. We have already shown E (X ) in equation (13.3) to satisfy
this requirement. So we add a constraint that the coefficient of X e in E (X ) is 1. Therefore, we
have n + 1 linear equation in at most n + 1 variables, which we can solve in time O(n 3 ), e.g. by
Gaussian elimination.
Finally, note that Step 4 can be implemented in time O(n 3 ) by long division. Thus, we have
proved
Theorem 13.1.4. For any [n, k]q Reed-Solomon code, unique decoding can be done in O(n 3 ) time
nk
up to d 1
2 = 2 number of errors.
Recall that the above is a restatement of the error decoding part of Theorem 11.2.1. Thus,
this fills in the final missing piece from the proofs of Theorem 11.3.3 (decoding certain concatenated codes up to half of their design distance) and Theorem 12.4.1 (efficiently achieving the
BSCp capacity).
Before we talk about the algorithms, we restate the (list) decoding problem for Reed-Solomon
codes. Consider any [n, k]q Reed-Solomon code that has the evaluation set {1 , . . . , m }. Below
is a formal definition of the decoding problem for Reed-Solomon codes:
Input: Received word y = (y 1 , . . . , y n ), y i Fq and error parameter e = n t .
Output: All polynomials P (X ) Fq [X ] of degree at most k 1 such that P (i ) = y i for
at least t values of i .
Our main goal of course is to make t as small as possible.
n +k
. We looked at the Welch2
Berlekamp algorithm in Algorithm 12, which we restate below in a slightly different form (that
will be useful in developing the subsequent list decoding algorithms).
We begin with the unique decoding regime, where t >
N (X )
, which is exactly
E (X )
Step 1 requires solving for the co-efficients of Q(X , Y ). This can be done as long as the
number of coefficients is greater than the the number of constraints. (The proof of this
fact is left as an exercise.) Also note that this argument is a departure from the corresponding argument for the Welch-Berlekamp algorithm (where the number of coefficients is
upper bounded by the number of constraints).
In Step 2, to ensure that for every polynomial P (X ) that needs to be output Y P (X ) divides Q(X , Y ), we will add restrictions on Q(X , Y ). For example, for the Welch-Berlekamp
algorithm, the constraint is that Q(X , Y ) has to be of the form Y E (X ) N (X ), where E (X )
and N (X ) are non-zero polynomials of degree e and at most e + k 1 respectively.
Next, we present the first instantiation of the algorithm structure above, which leads us to
our first list decoding algorithm for Reed-Solomon codes.
13.2.2 Algorithm 1
The main insight in the list decoding algorithm that we will see is that if we carefully control the
degree of the polynomial Q(X , Y ), then we can satisfy the required conditions that will allow
us to make sure Step 1 succeeds. Then we will see that the degree restrictions, along with the
degree mantra (Proposition 5.2.3) will allow us to show Step 2 succeeds too. The catch is in
defining the correct notion of degree of a polynomial. We do that next.
First, we recall the definition of maximum degree of a variable.
Definition 13.2.1. deg X (Q) is the maximum degree of X in Q(X , Y ). Similarly, degY (Q) is the
maximum degree of Y in Q(X , Y )
For example, for Q(X , Y ) = X 2 Y 3 + X 4 Y 2 deg X (Q) = 4 and degY (Q) = 3. Given deg X (Q) = a
and degY (Q) = b, we can write
$
Q(X , Y ) =
ci j X i Y j ,
0i a,
0 j b
where the coefficients c i j Fq . Note that the number of coefficients is equal to (a + 1)(b + 1).
The main idea in the first list decoding algorithm for Reed-Solomon code is to place bounds
on deg X (Q) and degY (Q) for Step 1. The bounds are chosen so that there are enough variables
to guarantee the existence of a Q(X , Y ) with the required properties. We will then use these
bound along with the degree mantra (Proposition 5.2.3) to argue that Step 2 works. Algorithm 13
presents the details. Note that the algorithm generalizes the Welch-Berlekamp algorithm (and
follows the two step skeleton outlined above).
Correctness of Algorithm 13. To ensure the correctness of Step 1, we will need to ensure that
the number of coefficients for Q(X , Y ) (which is (" + 1)(n/" + 1)) is larger than the number of
constraints in (13.6 (which is n). Indeed,
%n
&
n
+ 1 > " = n.
(" + 1)
"
"
164
n
such that
"
Q(i , y i ) = 0, 1 i n.
(13.6)
2: +
IF
To argue that the final in Step 6 contains all the polynomials P (X ) that need to be output.
In other words, we need to show that if P (X ) of degree k1 agrees with Y in at least t positions,
then Y P (X ) divides Q(X , Y ). Towards this end, we define
def
(13.7)
(13.8)
Q(i , y i ) = Q(i , P (i )) = 0.
Thus, i is a root of R(X ). In other words R has at least t roots. Note that the degree mantra
(Proposition 5.2.3) this will lead to a contradiction if t > deg(R), which will be true if
t > "+
If we pick " =
n(k 1)
.
"
*
*
n(k 1), we will have t > 2 n(k 1). Thus, we have shown
*
Theorem 13.2.1. Algorithm 13 can list decode Reed-Solomon codes of rate R from 1 2 R fraction of errors. Further, the algorithm can be implemented in polynomial time.
The claim on the efficient run time follows as Step 1 can be implemented by Gaussian elimination and for Step 3, all the factors of Q(X , Y ) (and in particular all linear factors of the form
Y P (X )) can be computed
using e.g. the algorithm from [35].
*
The bound 1 2 R is better than the unique decoding bound of 1R
2 for R < 0.07. This is
*
still far from the 1 R fraction of errors guaranteed by the Johnson bound. See Figure 13.2.2
for an illustration.
165
0.8
0.6
0.4
0.2
0.2
0.4
0.6
0.8
Figure 13.4: The tradeoff between rate R and the fraction of errors that can be corrected by
Algorithm 13.
13.2.3 Algorithm 2
To motivate the next algorithm, recall that in Algorithm 13, in order to prove that the root
def
finding step (Steps 3-6 in Algorithm 13) works, we defined a polynomial R(X ) = Q(X , P (X )).
In particular, this implied that deg(R) deg X (Q) + (k 1) degY (Q) (and we had to select t >
deg X (Q) + (k 1) degY (Q)). One shortcoming of this approach is that the maximum degree of
X and Y might not occur in the same term. For example, in the polynomial X 2 Y 3 + X 4 Y 2 , the
maximum X and Y degrees do not occur in the same monomial. The main insight in the new
algorithm is to use a more balanced" notion of degree of Q(X , Y ):
Definition 13.2.2. The (1, w) weighted degree of the monomial X i Y j is i + w j . Further, the
(1, w)-weighted degree of Q(X , Y ) (or just its (1, w) degree) is the maximum (1, w) weighted
degree of its monomials.
For example, the (1, 2)-degree of the polynomial X Y 3 + X 4 Y is max(1+32, 4+21) = 7. Also
note that the (1, 1)-degree of a bivariate polynomial Q(X , Y ) is its total degree (or the usual"
definition of degree of a bivariate polynomial). Finally, we will use the following simple lemma
(whose proof we leave as an exercise):
Lemma 13.2.2. Let Q(X , Y ) be a bivariate polynomial of (1, w) degree D. Let P (X ) be a polynomial such that deg(P ) w. Then we have
deg (Q(X , P (X ))) D.
166
Note that a bivariate polynomial Q(X , Y ) of (1, w) degree at most D can be represented as
follows:
$
def
Q(X , Y ) =
ci , j X i Y j ,
i +w j D
i , j 0
where c i , j Fq .
The new algorithm is basically the same as Algorithm 13, except that in the interpolation
step, we compute a bivariate polynomial of bounded (1, k 1) degree. Before we state the precise algorithm, we will present the algorithm via an example. Consider the received word in
Figure 13.5.
yi
4
3
2
6
1
1
1
1
2
3
2
3
4
n = 14, k = 2, e = 9
Figure 13.5: An illustration of a received word for the [14, 2] Reed-Solomon code from Figure 13.1 (where again we have implicitly embedded the field Fq in the set {7, . . . , 7}). Here we
have considered e = 9 errors which is more than what Algorithm 12 can handle. In this case, we
are looking for lines that pass through at least 5 points.
Now we want to interpolate a bivariate polynomial Q(X , Y ) with a (1, 1) degree of 4 that
passes" through all the 2-D points corresponding to the received word from Figure 13.5. Figure 13.6 shows such an example.
Finally, we want to factorize all the linear factors Y P (X ) of the Q(X , Y ) from Figure 13.6.
Figure 13.7 shows the two polynomials X and X such that Y X and Y + X are factors of
Q(X , Y ) from Figure 13.6.
We now precisely state the new list decoding algorithm in Algorithm 14.
Proof of Correctness of Algorithm 14. As in the case of Algorithm 13, to prove the correctness
of Algorithm 14, we need to do the following:
167
yi
L 2 (X , Y ) = Y X
4
3
2
6
1
1
2
1
1
6
5
i
E (X , Y ) = Y 2 /16 + X 2 /49 1
2
3
4
L 1 (X , Y ) = Y + X
Q(X , Y ) = L 1 (X , Y ) L 2 (X , Y ) E (X , Y )
n = 14, k = 2, e = 9
Figure 13.6: An interpolating polynomial Q(X , Y ) for the received word in Figure 13.5.
yi
L 2 (X , Y ) = Y X
4
3
2
6
1
1
2
1
1
i
E (X , Y ) = Y 2 /16 + X 2 /49 1
2
3
4
L 1 (X , Y ) = Y + X
Q(X , Y ) = L 1 (X , Y ) L 2 (X , Y ) E (X , Y )
n = 14, k = 2, e = 9
Figure 13.7: The two polynomials that need to be output are shown in blue.
(Interpolation Step) Ensure that the number of coefficients of Q(X , Y ) is strictly greater
than n.
def
(Root Finding Step) Let R(X ) = Q(X , P (X )). We want to show that if P (i ) y i for at least
t values of i , then R(X ) 0.
To begin with, we argue why we can prove the correctness of the root finding step. Note that
since Q(X , Y ) has (1, k 1) degree at most D, Lemma 13.2.2 implies that
deg(R) D.
Then using the same argument as we used for the correctness of the root finding step of Algorithm 13, we can ensure R(X ) 0 if we pick
t > D.
168
Q(i , y i ) = 0, 1 i n.
(13.9)
2: +
IF
Thus, we would like to pick D to be as small as possible. On the other hand, Step 1 will need D
to be large enough (so that the number of variables is more than the number of constraints in
(13.9). Towards that end, let the number of coefficients of Q(X , Y ) be
'(
)'
N = ' (i , j )|i + (k 1) j D, i , j Z+ '
* D +
To bound N , we first note that in the definition above, j k1
. (For notational convenience,
* D +
.) Consider the following sequence of relationships
define " = k1
N =
=
=
" D(k1)
$
$ j
j =1
"
$
i =0
(D (k 1) j + 1)
j =0
"
$
(D + 1) (k 1)
j =0
= (D + 1)(" + 1)
"
$
j =0
(k 1)"(" + 1)
2
"+1
(2D + 2 (k 1)")
, 2 "+1
(D + 2)
2
D(D + 2)
.
2(k 1)
(13.10)
(13.11)
D
and (13.11) follows from the fact that
In the above, (13.10) follows from the fact that " k1
D
k1 1 ".
169
Thus, the interpolation step succeeds (i.e. there exists a non-zero Q(X , Y ) with the required
properties) if
D(D + 2)
> n.
2(k 1)
The choice
./
0
D=
2(k 1)n
D(D + 2)
D2
2(k 1)n
>
= n.
2(k 1)
2(k 1)
2(k 1)
1*
2
Thus for the root finding step to work, we need t >
2(k 1)n , which implies the following
result:
*
Theorem 13.2.3. Algorithm 2 can list decode Reed-Solomon codes of rate R from up to 1 2R
fraction of errors. Further, the algorithm runs in polynomial time.
Algorithm 2 runs in polynomial time as Step 1 can be implemented using Gaussian elimination (and the fact that the number of coefficients is O(n)) while the root finding step can be
implemented*by any polynomial time algorithm to factorize bivariate polynomials. Further, we
note that 1 2R beats the unique decoding bound of (1 R)/2 for R < 1/3. See Figure 13.2.3
for an illustration.
1
0.8
0.6
0.4
0.2
0.2
0.4
0.6
0.8
Figure 13.8: The tradeoff between rate R and the fraction of errors that can be corrected by
Algorithm 13 and Algorithm 14.
170
13.2.4 Algorithm 3
Finally,
we present the list decoding algorithm for Reed-Solomon codes, which can correct 1
*
R fraction of errors. The main idea is to add more restrictions on Q(X , Y ) (in addition to its
(1, k 1)-degree being at most D). This change will have the following implications:
The number of constraints will increase but the number of coefficients will remain the
same. This seems to be bad as this results in an increase in D (which in turn would result
in an increase in t ).
However, this change will also increases the number of roots of R(X ) and this gain in the
number of roots more than compensates for the increase in D.
In particular, the constraint is as follows. For some integer parameter r 1, we will insist on
Q(X , Y ) having r roots at (i , y i ), 1 i n.
To motivate the definition of multiplicity of a root of a bivariate polynomial, let us consider
the following simplified examples. In Figure 13.9 the curve Q(X , Y ) = Y X passes through the
Y
Y X
(0, 0)
Y
Y +X
Y X
(0, 0)
Y +X
Y X
(0, 0)
Definition 13.2.4. Q(X , Y ) has r roots at (, ) if Q , (X , Y ) = Q(x +, y +) has r roots at (0, 0).
Before we state the precise algorithm, we will present the algorithm with an example. Consider the received word in Figure 13.12.
Now we want to interpolate a bivariate polynomial Q(X , Y ) with (1, 1) degree 5 that passes
twice" through all the 2-D points corresponding to the received word from Figure 13.12. Figure 13.13 shows such an example.
Finally, we want to factorize all the linear factors Y P (X ) of the Q(X , Y ) from Figure 13.13.
Figure 13.14 shows the five polynomials of degree one are factors of Q(X , Y ) from Figure 13.13.
172
yi
11
i
n = 10, k = 2, e = 6
Figure 13.12: An illustration of a received word for the [10, 2] Reed-Solomon code (where we
have implicitly embedded the field Fq in the set {9, . . . , 11}). Here we have considered e = 6
errors which is more than what Algorithm 14 can decode. In this case, we are looking for lines
that pass through at least 4 points.
yi
11
i
n = 10, k = 2, e = 6
Figure 13.13: An interpolating polynomial Q(X , Y ) for the received word in Figure 13.12.
(In fact, Q(X , Y ) exactly decomposes into the five lines.)
Algorithm 15 formally states the algorithm.
Correctness of Algorithm 15. To prove the correctness of Algorithm 15, we will need the following two lemmas (we defer the proofs of the lemmas above to Section 13.2.4):
! "
Lemma 13.2.4. The constraints in (13.12) imply r +1
2 constraints for each i on the coefficients of
Q(X , Y ).
173
yi
11
i
n = 10, k = 2, e = 6
Figure 13.14: The five polynomials that need to be output are shown in blue.
Algorithm 15 The Third List Decoding Algorithm for Reed-Solomon Codes
I NPUT: n k 1, D 1, r 1, e = n t and n pairs {(i , y i )}ni=1
O UTPUT: (Possibly empty) list of polynomials P (X ) of degree at most k 1
1: Find a non-zero Q(X , Y ) with (1, k 1) degree at most D, such that
(13.12)
2: +
IF
def
Lemma 13.2.5. R(X ) = Q(X , P (X )) has r roots for every i such that P (i ) = y i . In other words,
(X i )r divides R(X ).
Using arguments similar to those used for proving the correctness of Algorithm 14, to argue
the correctness of the interpolations step we will need
4
3
D(D + 2)
r +1
,
>n
2
2(k 1)
where the LHS is an upper bound on the number of coefficients of Q(X , Y ) as before from
(13.11) and the RHS follows from Lemma 13.2.4. We note that the choice
./
0
D=
(k 1)nr (r 1)
174
D
,
r
56
1
(k 1)n 1
r
-7
7
./
0
1
>
(k 1)n
(k 1)n ,
2
where the last inequality follows because of the fact that t is an integer. Thus, we have shown
*
Theorem 13.2.6. Algorithm 15 can list decode Reed-Solomon codes of rate R from up to 1 R
fraction of errors. Further, the algorithm runs in polynomial time.
The claim on the run time follows from the same argument that was used to argue the polynomial running time of Algorithm 14. Thus, Theorem 13.2.6 shows that Reed-Solomon codes
can be efficiently decoded up to the Johnson bound. For an illustration of fraction of errors
correctable by the three list decoding algorithms we have seen, see Figure 13.2.3.
A natural question to ask is if Reed-Solomon codes of rate R can be list decoded beyond
*
1 R fraction of errors. The answer is still not known:
Open Question
* 13.2.1. Given a Reed-Solomon code of rate R, can it be efficiently list decoded
beyond 1 R fraction of errors?
Recall that to complete the proof of Theorem 13.2.6, we still need to prove Lemmas 13.2.4
and 13.2.5, which we do next.
Proof of key lemmas
Proof of Lemma 13.2.4. Let
Q(X , Y ) =
i,j
i +(k1) j D
175
ci , j X i Y
and
Q , (X , Y ) = Q(X + , Y + ) =
We will show that
$
i,j
ci , j X i Y j .
!r +1"
2
constraints on
Note that (i) and (ii) prove the lemma. To prove (i), note that by the definition:
Q , (X , Y ) =
=
$
i,j
c i , , j , (X + )i (Y + ) j
ci , j X i Y
(13.13)
,
i ,, j ,
,
i +(k1) j , D
(13.14)
j ,> j
which proves (i). To prove (ii), recall that by definition Q , (X , Y ) has no monomial of degree
,
Proof. Define
def
P i ,y i (X ) = P (X + i ) y i ,
(13.15)
and
def
R i ,y i (X ) = R(X + i )
(13.16)
= Q(X + i , P (X + i ))
(13.17)
= Q i ,y i (X , P i ,y i (X )),
(13.19)
= Q(X + i , P i ,y i (X ) + y i )
(13.18)
where (13.17), (13.18) and (13.19) follow from the definitions of R(X ), P i ,y i (X ) and Q i ,y i (X , Y )
respectively.
By (13.16) if R i ,y i (0) = 0, then R(i ) = 0. So, if X divides R i ,y i (X ), then X i divides R(X ).
(This follows from a similar argument that we used to prove Proposition 5.2.3.) Similarly, if X r
divides R i ,y i (X ), then (X i )r divides R(X ). Thus, to prove the lemma, we will show that X r
divides R i ,y i (X ). Since P (i ) = y i when i agrees with y i , we have P i ,y i (0) = 0. Therefore, X is
a root of P i ,y i (X ), that is, P i ,y i (X ) = X g (X ) for some polynomial g (X ) of degree at most k 1.
We can rewrite
R i ,y i (X ) =
i ,, j ,
,y
c i , ,i j , i X i (P i ,y i (X )) j =
i ,, j ,
,y
c i , ,i j , i X i (X g (X )) j .
,y
degree < r . Thus X r divides R i ,y i (X ), since R i ,y i (x) has no non-zero monomial X " for any
" <r.
13.3 Extensions
We now make some observations about Algorithm 15. In particular, the list decoding algorithm
is general enough to solve more general problems than just list decoding. In this section, we
present an overview of these extensions.
177
Recall that the constraint (13.12) states that Q(X , Y ) has r 0 roots at (i , y i ), 1 i n.
However, our analysis did not explicitly use the fact that the multiplicity is same for every i . In
particular, given non-zero integer multiplicities w i 0, 1 i n, Algorithm 15 can be generalized to output all polynomials P (X ) of degree at most k 1, such that
9
4
3
:
n w +1
:
$
$
i
w i > ;(k 1)n
.
2
i :P (i )=y i
i =0
(We leave the proof as an exercise.) Note that till now we have seen the special case w i = r ,
1 i n.
Further, we claim that the i s need not be distinct for the all of the previous arguments to
go through. In particular, one can generalize Algorithm 15 even further to prove the following
(the proof is left as an exercise):
Theorem 13.3.1. Given integer weights w i , for every 1 i n and F, in polynomial time
one can output all P (X ) of degree at most k 1 such that
9
4
3
:
n $ w
:
$
$
+
1
i
,
w i ,P (i ) > ;(k 1)n
.
2
i
i =0 F
This will be useful to solve the following generalization of list decoding called soft decoding.
Definition 13.3.1. Under soft decoding problem, the decoder is given as input a set of nonnegative weights w i ,d (1 i n, Fq ) and a threshold W 0. The soft decoder needs to output
all codewords (c 1 , c 2 , . . . , c n ) in q-ary code of block length n that satisfy:
n
$
i =1
w i ,ci W.
Note that Theorem 13.3.1 solve the soft decoding problem with
9
4
3
:
n $ w
:
$
+
1
i
,
W = ;(k 1)n
.
2
i =0 F
Consider the following special case of soft decoding where w i ,y i = 1 and w i , = 0 for F \
{y i } (1 i n). Note that this is exactly the list decoding problem with the received word
(y 1 , . . . , y n ). Thus, list decoding is indeed a special case of soft decoding. Soft decoding has
practical applications in settings where the channel is analog. In such a situation, the quantizer might not be able to pinpoint a received symbol y i with 100% accuracy. Instead, it can
use the weight w i , to denote its confidence level that i th received symbol was .
Finally, we consider a special case of soft called list recovery, which has applications in designing list decoding algorithms for concatenated codes.
Definition 13.3.2 (List Recovery). Given S i Fq , 1 i n where |S i | ", output all [n, k]q
codewords (c 1 , . . . , c n ) such that c i S i for at least t values of i .
178
We leave the proof that list decoding is a special case of soft decoding as an exercise. Finally,
we claim that Theorem 13.3.1 implies the following result for list recovery (the proof is left as an
exercise):
*
Theorem 13.3.2. Given t > (k 1)"n, the list recovery problem with agreement parameter t for
[n, k]q Reed-Solomon codes can be solved in polynomial time.
179
Foreword
This chapter is based on lecture notes from coding theory courses taught by Venkatesan Guruswami at University at Washington and CMU; by Atri Rudra at University at Buffalo, SUNY
and by Madhu Sudan at MIT.
This version is dated May 1, 2013. For the latest version, please go to
http://www.cse.buffalo.edu/ atri/courses/coding-theory/book/
The material in this chapter is supported in part by the National Science Foundation under
CAREER grant CCF-0844796. Any opinions, findings and conclusions or recomendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the
National Science Foundation (NSF).
Chapter 14
Efficiently Achieving List Decoding Capacity
In the previous chapters, we have seen these results related to list decoding:
"
Reed-Solomon codes of rate R > 0 can be list-decoded in polynomial time from 1 R
errors (Theorem 13.2.6). This is the best algorithmic list decoding result we have seen so
far.
!
! ""
1
There exist codes of rate R > 0 that are 1 R ,O 1 -list decodable for q 2( ) (and
in particular for q = poly(n)) (Theorem 7.4.1 and Proposition 3.3.2). This of course is the
best possible combinatorial result.
Note that there is a gap between the algorithmic result and the best possible combinatorial
result. This leads to the following natural question:
Question 14.0.1. Are there explicit codes of rate R > 0 that can be list-decoded in polynomial
time from 1 R fraction of errors for q pol y(n)?
In this chapter, we will answer Question 14.0.1 in the affirmative.
Solomon codes that are derived from Reed-Solomon codes with evaluation {1, , 2 , 3 , . . . , n1 },
where is the generator of Fq and n q 1. Note that in the Reed-Solomon code, a message is
encoded as in Figure 14.1.
181
f (1)
f (2 )
f ()
f (3 )
f (n2 )
f (n1 )
f (2 )
f ()
f (3 )
f (1)
f (2 )
f ()
f (3 )
f (n2 )
f (n1 )
f (n2 )
f (n1 )
f ()
f (2 )
f (3 )
f (1)
f (m )
f (2m )
f ()
f (m+1 )
f (2m+1 )
..
.
..
.
..
.
f (m1 )
f (2m1 )
f (3m1 )
f (n2 )
f (n1 )
f (nm )
f (nm+1 )
..
.
f (n1 )
2: RETURN A (y( )
The reason why Algorithm 16 works is simple. Let m Fkq be a message. Let RS(m) and
FRS(m) be the corresponding Reed-Solomon and folded Reed-Solomon codewords. Now for
every i [n/m], if FRS(m)i += (y i ,1 , . . . , y i ,n/m ) then in the worst-case for every j [n/m], RS(m)(i 1)n/m+ j +=
y i , j : i.e. one symbol disagreement over Fq m can lead to at most m disagreements over Fq . See
Figure 14.4 for an illustration.
f (1)
f ()
f (1)
f (2 )
f ()
f (3 )
f (2 )
f (n2 )
f (3 )
f (n1 )
f (n2 )
f (n1 )
Figure 14.4: Error pattern after unfolding. A pink cell means an error: for the Reed-Solomon
code it is for RS(m) with y( and for folded Reed-Solomon code it is for FRS(m) with y
n
n
, then (y( , RS(m)) m m
= n,
This implies that for any m Fkq if (y, FRS(m)) m
which by the properties of algorithm A implies that Step 2 will output m, as desired.
The intuition for a strict improvement by using Folded Reed-Solomon codes is that if the
fraction of errors due to folding increases beyond what it can list-decode from, that error pattern does not need to be handled and can be ignored. For example, suppose a Reed-Solomon
183
f (1)
f (2 )
f ()
f (3 )
f (1)
f (2 )
f ()
f (3 )
f (n2 )
f (n1 )
f (n2 )
f (n1 )
Figure 14.5: An error pattern after folding. The pink cells denotes the location of errors
code that can be list-decoded from up to 21 fraction of errors is folded into a Folded ReedSolomon code with m = 2. Now consider the error pattern in Figure 14.5.
The error pattern for Reed-Solomon code has 12 fraction of errors, so any list decoding algorithm must be able to list-decode from this error pattern. However, for the Folded ReedSolomon code the error pattern has 1 fraction of errors which is too high for the code to listdecode from. Thus, this folded" error pattern case can be discarded from the ones that a list
decoding algorithm for folded Reed-Solomon code needs to consider. This is of course one
example however, it turns out that this folding operation actually rules out a lot of error patterns that a list decoding "
algorithm for folded Reed-Solomon code needs to handle (even beyond the current best 1 R bound for Reed-Solomon codes). Put another way, an algorithm
for folded Reed-Solomon codes has to solve the list decoding problem for the Reed-Solomon
codes where the error patterns are bunched" together (technically theyre called bursty errors). Of course, converting this intuition into a theorem takes more work and is the subject
of this chapter.
Wait a second... The above argument has a potential hole what if we take the argument to
the extreme and "cheat" by setting m = n where any error pattern for the Reed-Solomon code
will result in an error pattern with 100% errors for the Folded Reed-Solomon code: thus, we
will only need to solve the problem of error detection for Reed-Solomon codes (which we can
easily solve for any linear code and in particular for Reed-Solomon codes)? It is a valid concern
but we will close the loophole" by only using a constant m as the folding parameter. This
will still keep q to be polynomially large in n and thus, we would still be on track to answer
Question 14.0.1. Further, if we insist on smaller list size (e.g. one independent of n), then we can
use code concatenation to achieve capacity achieving results for codes over smaller alphabets.
(See Section 14.4 for more.)
General Codes. We would like to point out that the folding argument used above is not specific
to Reed-Solomon codes. In particular, the argument for the reduction in the number of error
patterns holds for any code. In fact, one can prove that for general random codes, with high
probability, folding does strictly improve the list decoding capabilities of the original code. (The
proof is left as an exercise.)
184
y=
y0
..
.
ym
..
.
y m1
y 2m1
y nm
..
mN
,
Fq
.
y n1
N=
n
m
!
"
f mi
..
.
!
"
f m(i +1)1
y mi
..
.
y m(i +1)1
(14.1)
The algorithm that we will study is a generalization of the Welch-Berlekamp algorithm (Algorithm 12). However unlike the previous list decoding algorithms for Reed-Solomon codes
(Algorithms 13, 14 and 15), this new algorithm has more similarities with the Welch-Berlekamp
algorithm. In particular, for m = 1, the new algorithm is exactly the Welch-Berlekamp algorithm. Here are the new ideas in the algorithm for the two-step framework that we have seen in
the previous chapter:
Step 1: We interpolate using (m +1)-variate polynomial, Q(X , Y1 , . . . , Ym ), where degree of
each variable Yi is exactly one. In particular, for m = 1, this interpolation polynomial is
exactly the one used in the Welch-Berlekamp algorithm.
Step 2: As we have done so far, in this step, we output all "roots" of Q. Two remarks are in
order. First, unlike Algorithms 13, 14 and 15, the roots f (X ) are no longer simpler linear
factors Y f (X ), so one cannot use a factorization algorithm to factorize Q(X , Y1 , . . . , Ym ).
Second, the new insight in this algorithm, is to show that all the roots form an (affine)
subspace,1 which we can use to compute the roots.
Algorithm 17 has the details.
1
An affine subspace of Fkq is a set {v + u|u S}, where S Fkq is a linear subspace and v Fkq .
185
Algorithm 17 The First List Decoding Algorithm for Folded Reed-Solomon Codes
I NPUT: An agreement parameter 0 t N , parameter D 1 and the received word:
y=
y0
..
.
ym
..
.
y m1
y 2m1
y nm
..
mN
,
Fq
.
y n1
N=
n
m
O UTPUT: All polynomials f (X ) Fq [X ] of degree at most k 1 such that for at least t values of
0i <N
!
"
f mi
y mi
..
..
(14.2)
.
! m(i. +1)1 "
y m(i +1)1
f
1: Compute a non-zero Q(X , Y1 , . . . , Ym ) where
(14.3)
2: 0
4:
5:
IF
6: RETURN
Correctness of Algorithm 17. In this section, we will only concentrate on the correctness of
the algorithm and analyze its error correction capabilities. We will defer the analysis of the
algorithm (and in particular, proving a bound on the number of polynomials that are output by
Step 6) till the next section.
We first begin with the claim that there always exists a non-zero choice for Q in Step 1 using
the same arguments that we have used to prove the correctness of Algorithms 14 and 15:
Claim 14.2.1. If (m + 1) (D + 1) + k 1 > N , then there exists a non-zero Q (X , Y1 , ...Ym ) that satisfies the required properties of Step 1.
Proof. As in the proof of correctness of Algorithms 13, 14 and 15, we will think of the constraints
in (14.3) as linear equations. The variables are the coefficients of A i (X ) for 0 i m. With the
stipulated degree constraints on the A i (X )s, note that the number of variables participating in
(14.3) is
D + k + m(D + 1) = (m + 1) (D + 1) + k 1.
186
The number of equations is N . Thus, the condition in the claim implies that we have strictly
more variables then equations and thus, there exists a non-zero Q with the required properties.
Next, we argue that the root finding step works (again using an argument very similar to
those that we have seen for Algorithms 13, 14 and 15):
Claim 14.2.2. If t > D +k 1, then all polynomial f (X ) Fq [X ] of degree at most k 1 that agree
with the received word in at least t positions is returned by Step 6.
Proof. Define the univariate polynomial
!
! "
!
""
R (X ) = Q X , f (X ) , f X , ..... f m1 X .
where the first equality follows from (14.1), while the second equality follows from (14.3). Thus
R(X ) has at least t roots. Thus, the condition in the claim implies that R(X ) has more roots then
its degree and thus, by the degree mantra (Proposition 5.2.3) R(X ) 0, as desired.
Note that Claims 14.2.1 and 14.2.2 prove the correctness of the algorithm. Next we analyze
the fraction of errors the algorithm can correct. Note that the condition in Claim 14.2.1 is satisfied if we pick
+
,
N k +1
D=
.
m +1
This in turn implies that the condition in Claim 14.2.2 is satisfied if
t>
N k +1
N + m(k 1)
+k 1 =
.
m +1
m +1
m=1
m=2
m=2
m=4
Johnson bound
0.8
0.6
0.4
0.2
0.2
0.4
0.6
0.8
Figure 14.6: The tradeoff between rate R and the fraction of errors that can be corrected by
Algorithm 17 for folding parameter m = 1, 2, 3 and 4. The Johnson bound is also plotted for
comparison. Also note that the bound for m = 1 is the Unique decoding bound achieved by
Algorithm 12.
See Figure 14.2 for an illustration of the tradeoff for m = 1, 2, 3, 4.
Note that if we can replace the mR factor in the bound from Theorem 14.2.3 by just R then
we can approach the list decoding capacity bound of 1 R. (In particular, we would be able
to correct 1 R fraction of errors if we pick m = O(1/).) Further, we need to analyze the
number of polynomials output by the root finding step of the algorithm (and then analyze the
runtime of the algorithm). In the next section, we show how we can knock-off" the extra factor
m (and we will also bound the list size).
f (3i )
f (3i +1 )
f (3i +2 )
y 3i
y 3i +1
y 3i +2
f (3i +1 )
f (3i +1 )
f (3i +2 )
y 3i
y 3i +1
y 3i +1
y 3i +2
On the other hand, the number of constraints in (14.5), i.e. the number of equations when
all coefficients of all polynomials A i are considered variables) will be N (m s + 1).
Note that if we have more variables than equations, then there exists a non-zero Q that
satisfies the required properties of Step 1. Thus, we would be done if we have:
N (m s + 1) k + 1
1.
s +1
The choice of D in the statement of the claim satisfies the condition above, which complete the
proof.
D>
189
Algorithm 18 The Second List Decoding Algorithm for Folded Reed-Solomon Codes
I NPUT: An agreement parameter 0 t N , parameter D 1 and the received word:
y=
y0
..
.
ym
..
.
y m1
y 2m1
y nm
..
mN
,
Fq
.
y n1
N=
n
m
O UTPUT: All polynomials f (X ) Fq [X ] of degree at most k 1 such that for at least t values of
0i <N
!
"
f mi
y mi
..
..
(14.4)
.
! m(i. +1)1 "
y m(i +1)1
f
1: Compute non-zero polynomial Q(X , Y1 , .., Y s ) as follows:
!
! " !
"
!
""
Q X , f (X ), f X , f 2 X , . . . , f s1 X 0
DO
4:
5:
IF
(14.6)
6: RETURN
(14.7)
Let f(X) be one of the polynomials of degree at most k 1 that needs to be output, and f (X )
agrees with the received word at column i for some 0 i < N , that is:
190
!
"
f! mi "
f mi +1
!
"
f m(i +1)1
y mi
y mi +1
y m(i +1)1
)
*
)
)
* )
*
)
**
R mi + j = Q mi + j , f mi + j , f mi +1+ j , ..., f mi +s1+ j
)
*
= Q mi + j , y mi + j , y mi +1+ j , ..., y mi +s1+ j = 0.
In the above, the first equality follows as f (X ) agrees with y in column i while the second equality follows from (14.5). Thus, the number of roots of R(X ) is at least
t (m s + 1) > D + k 1 deg(R),
where the first inequality follows from the assumption in the claim and the second inequality
follows from (14.7). Hence, by the degree mantra R(X ) 0, which shows that f (X ) satisfies
(14.6), as desired.
This along with the constraint in Lemma 14.3.2, implies that the algorithm works as long as
+
,
D +k 1
t>
.
m s +1
The above is satisfied if we choose
t>
N (ms+1)k+1
s+1
+k 1
m s +1
N (m s + 1) k + 1 + (k 1)(s + 1) N (m s + 1) + s(k 1)
=
.
(m s + 1)(s + 1)
(s + 1)(m s + 1)
) s *)
* .
N
s
k
1
m
t>
+
=N
+
R ,
s +1 s +1 m s +1
s +1
s +1 m s +1
where the equality follows from the fact that k = mR N . This implies the following result:
191
Theorem 14.3.3. Algorithm 18 can list decode folded Reed-Solomon code with folding parameter
s
(1 mR/(m s + 1)) fraction of errors.
m 1 and rate R up to s+1
See Figure 14.3.1 for an illustration of the bound above.
1
m=6,s=6
m=9, s=6
m=12, s=6
m=15, s=6
Johnson bound
0.8
0.6
0.4
0.2
0.2
0.4
0.6
0.8
Figure 14.9: The tradeoff between rate R and the fraction of errors that can be corrected by
Algorithm 18 for s = 6 and folding parameter m = 6, 9, 12 and 15. The Johnson bound is also
plotted for comparison.
B (k1 )
B (k2 )
f0
f1
B (3 )
B (2 )
B ()
B (1)
a 0,k1
a 0,k2
=
f k4
f k3
f k2
f k1
a 0,3
a 0,2
a 0,1
a 0,0
Figure 14.10: The system of linear equations with the variables f 0 , . . . , f k1 forming the coeffi1
i
cients of the polynomial f (X ) = k1
i =0 f i X that we want to output. The constants a j ,0 are obtained from the interpolating polynomial from Step 1. B (X ) is a non-zero polynomial of degree
at most s 1.
diagonal are non-zero, which then implies the claim. See Figure 14.10 for an illustration of the
upper triangular system of linear equations.
Next, we present the argument above in full detail. (Note that the constraint on (14.8) is the
same as the one in (14.6) because of the constraint on the structure of Q imposed by Step 1.)
Lemma 14.3.4. There are at most q s1 solutions to f 0 , f 1 , .., f k1 (where f (X ) = f 0 + f 1 X + ... +
f k1 X k1 ) to the equations
! "
!
"
A 0 (X ) + A 1 (X ) f (X ) + A 2 (X ) f X + ... + A s (X ) f s1 X 0
(14.8)
Proof. First we assume that X does not divide all of the polynomials A 0 , A 1 , ..., A s . Then it implies that there exists i > 0 such that the constant term of the polynomial A i (X ) is not zero.
(Because otherwise, since X |A 1 (X ), ..., A s (X ), by (14.8), we have X divides A 0 (X ) and hence X
divide all the A i (X ) polynomials, which contradicts the assumption.)
To facilitate the proof, we define few auxiliary variables a i j such that
A i (X ) =
D+k1
2
j =0
a i j X j for every 0 i s,
(14.9)
Thus we can do the entire argument above by replacing A i (X ) with A (i (X ) since the above constraint implies that A (i (X )s also satisfy (14.8).
Next we prove Claim 14.3.5.
Proof of Claim 14.3.5. Recall that we can assume that X does not divide all of {A 0 (X ), . . . , A s (X )}.
!
"
Let C (X ) = A 0 (X )+ A 1 (X ) f (X )+ + A s f s1 X . Recall that we have C (X ) 0. If we expand
out each polynomial multiplication, we have:
C (X ) =a 0,0 + a 0,1 X + + a 0,D+k1 X D+k1
)
*)
*
+ a 1,0 + a 1,1 X + + a 1,D+k1 X D+k1 f 0 + f 1 X + f 2 X 2 + + f k1 X k1
)
*)
*
+ a 2,0 + a 2,1 X + + a 2,D+k1 X D+k1 f 0 + f 1 X + f 2 2 X 2 + + f k1 k1 X k1
..
.
)
*)
f 0 + f 1 s1 X + f 2 2(s1) X 2 + + f k1 (k1)(s1) X k1
(14.10)
Now if we collect terms of the same degree, we will have a polynomial of the form:
C (X ) = c 0 + c 1 X + c 2 X 2 + + c D+k1 X D+k1 .
2
Build a decision tree" with f 0 as the root and f j in the j th level: each edge is labeled by the assigned value to
the parent node variable. For any internal node in the j th level, if B ( j ) += 0, then the node has a single child with
the edge taking the unique value promised by Claim 14.3.5. Otherwise the node has q children with q different
labels from Fq . By Claim 14.3.5, the number of solutions to f (X ) is upper bounded by the number of nodes in the
kth level in the decision tree, which by the fact that B has at most s 1 roots is upper bounded by q s1 .
194
(14.11)
(14.12)
0 = a 0,0 + f 0 B (1).
(14.13)
In the above (14.11) follows from (14.10), (14.12) follows by simple manipulation while (14.13)
follows from the definition of B (X ) in (14.9).
Now, we have two possible cases:
Case 1: B (1) += 0. In this case, (14.13) implies that f 0 =
a 0,0
.
B (1)
In particular, f 0 is fixed.
Case 2: B (1) = 0. In this case f 0 has no constraint (and hence can take on any of the q
values in Fq ).
Now consider the equation for j = 1: c 1 = 0. Using the same argument as we did for j = 0,
we obtain the following sequence of equalities:
0 = a 0,1 + f 1 a 1,0 + f 0 a 1,1 + f 1 a 2,0 + f 0 a 2,1 + + f 1 a s,0 s1 + f 0 a s,1
3
4
s
2
!
"
s1
+ f0
0 = a 0,1 + f 1 a 1,0 + a 2,0 + + a s,0
a l ,1
0 = a 0,1 + f 1 B () +
where b 0(1) =
1s
l =1
l =1
f 0 b 0(1)
(14.14)
a 0,1 f 0 b 0(1)
B ()
Now consider the case of arbitrary j : c j = 0. Again using similar arguments as above, we get:
0 = a 0, j + f j (a 1,0 + a 2,0 j + a 3,0 2 j + + a s,0 j (s1) )
0 = a 0, j + f j B ( j ) +
j2
1
l =0
(j)
(14.15)
f l bl
1s
(j)
where b l = =1
a , j l l (1) are constants for 0 j k 1.
We have two possible cases:
195
(j)
f b
l =0 l l
B ( j )
a 0, j
1 j 1
(14.16)
f0
..
.
f k1
a 0,k1
..
=
,
.
a 0,0
(j)
some z Fkq . Indeed every x Fdq corresponds to an assignment to the d unconstrained variables
among f 0 , . . . , f j . The matrix M and the vector z are determined by the equations
in (14.16).
! "
Further, since C is upper triangular, both M and z can be computed with O k 2 operations over
Fq .
The discussion above implies the following:
5
6
Corollary 14.3.6. The set of solutions to (14.8) are contained in an affine subspace M x + z|x Fdq
for some 0 d s 1 and M Fkd
and z Fkq . Further, M and z can be computed from the polyq
nomials A 0 (X ), . . . , A s (X ) with O(s log sk 2 ) operations over Fq .
of one in the variables Y1 , . . . , Y s implies a much faster algorithm. In particular, one can perform
the interpolation in O(N m log2 (N m) log log(N m)) operations over Fq .
The root finding step involves computing all the roots" of Q. The proof of Lemma 14.3.4
actually suggests Algorithm 19.
Algorithm 19 The Root Finding Algorithm for Algorithm 18
I NPUT: A 0 (X ), . . . , A s (X )
O UTPUT: All polynomials f (X ) of degree at most k 1 that satisfy (14.8)
1: Compute $ such that X $ is the largest common power of X among A 0 (X ), . . . , A s (X ).
2: FOR every 0 i s DO
3:
A i (X )
A i (X )
.
X$
7:
8:
9:
10:
11:
12: RETURN
Next, we analyze the run time of the algorithm. Throughout, we will assume that all polynomials are represented in their standard coefficient form.
Step 1 just involves figuring out the smallest power of X in each A i (X ) that has a non-zero
coefficient from which one can compute the value of $. This can be done with O(D + k + s(D +
1)) = O(N m) operations over Fq . Further, given the value of $ one just needs to shift" all the
coefficients in each of the A i (X )s to the right by $, which again can be done with O(N m) operations over Fq .
Now we move to the root finding step. The run time actually depends on what it means to
solve" the linear system. If one is happy with a succinct description of a set of possible solution
that contains the actual output then one can halt !Algorithm
" 19 after
! Step 5 and
" Corollary 14.3.6
2
2
implies that this step can be implemented in O s log sk = O s log s(N m) operations over
Fq . However, if one wants the actual set of polynomials that need to be output, then the only
known option so far is to check all the q s1 potential solutions as in Steps 7-11. (However, well
see a twist in Section 14.4.) The latter would imply a total of O(s log s(N m)2 ) + O(q s1 (N m)2 )
operations over Fq .
Thus, we have the following result:
Lemma 14.3.7. With O(s log s(N m)2 ) operations over Fq , the algorithm above can return an
affine subspace of dimension s 1 that contains all the polynomials of degree at most k 1
197
that need to be output. Further, the exact set of solution can be computed in with additional
O(q s1 (N m)2 ) operations over Fq .
14.3.4 Wrapping Up
By Theorem 14.3.3, we know that we can list decode a folded Reed-Solomon code with folding
parameter m 1 up to
*
m
s )
1
R
(14.17)
s +1
m s +1
fraction of errors for any 1 s m.
To obtain our desired bound 1 R fraction of errors, we instantiate the parameter s and
m such that
s
m
1 and
1 + .
(14.18)
s +1
m s +1
Question 14.0.1 in the affirmative. Guruswami [19] reproved this result but with a much simpler proof. In this chapter, we studied the proof due to Guruswami. Guruswami in [19] credits Salil Vadhan for the the interpolation step. An algorithm presented in Branders thesis [2]
shows that for the special interpolation in Algorithm 18, one can perform the interpolation in
O(N m log2 (N m) log log(N m)) operations over Fq . The idea of using the sliding window" for list
decoding Folded Reed-Solomon codes is originally due to Guruswami and Rudra [23].
The bound of q s1 on the list size for folded Reed-Solomon codes was first proven in [23] by
roughly the following argument. One reduced the problem of finding roots to finding roots of a
univariate polynomial related to Q over Fq k . (Note that each polynomial in Fq [X ] of degree at
most k 1 has a one to one correspondence with elements of Fq k see e.g. Theorem 11.2.1.) The
list size bound follows from the fact that this new univariate polynomial had degree q s1 . Thus,
implementing the algorithm entails running a root finding algorithm over a big extension field,
which in practice has terrible performance.
Discussion. For constant , Theorem 14.3.8 answers Question 14.0.1 in the affirmative. However, from a practical point of view, there are three issues with the result: alphabet, list size and
run time. Below we tackle each of these issues.
Large Alphabet. Recall that one only needs an alphabet of size 2O(1/) to be able to list decode from 1 R fraction of errors, which is independent of N . It turns out that combining
Theorem 14.3.8 along with code concatenation and expanders allows us to construct codes over
4
alphabets of size roughly 2O(1/ ) [23]. (The idea of using expanders and code concatenation was
not new to [23]: the connection was exploited in earlier work by Guruswami and Indyk [22].)
The above however, does not answer the question of achieving list decoding capacity for
fixed q, say e.g. q = 2. We know that there exists binary code of rate R that are (H 1 (1 R
),O(1/))-list decodable codes (see Theorem 7.4.1). The best known explicit codes with efficient list decoding algorithms are those achieved by concatenating folded Reed-Solomon codes
with suitable inner codes achieve the so called Blokh-Zyablov bound [25]. However, the tradeoff
is far from the list decoding capacity. As one sample point, consider the case when we want to
list decode from 12 fraction of errors. Then the result of [25] gives codes of rate (3 ) while
the codes on list decoding capacity has rate (2 ). The following fundamental question is still
very much wide open:
Open Question 14.4.1. Do there exist explicit binary codes with rate R that can be list decoded from H 1 (1 R ) fraction of errors with polynomial list decoding algorithms?
The above question is open even if we drop the requirement on efficient list decoding algorithm or we only ask for a code that can list decode from 1/2 fraction of errors with rate
(a ) for some a < 3. It is known (combinatorially) that concatenated codes can achieve the list
decoding capacity but the result is via a souped up random coding argument and does not give
much information about an efficient decoding algorithm [26].
199
List Size. It is natural to wonder if the bound on the list size in Lemma 14.3.4 above can be
improved as that would show that folded Reed-Solomon codes can be list decoded up to the list
decoding capacity but with a smaller output list size than Theorem 14.3.8. Guruswami showed
that in its full generality the bound cannot be improved [19]. In particular, he exhibits explicit
polynomials A 0 (X ), . . . , A s (X ) such that there are at least q s2 solutions for f (X ) that satisfy
(14.8). However, these A i (X )s are not known to be the output for an actual interpolation instance. In other words, the following question is still open:
Open Question 14.4.2. Can folded Reed-Solomon codes of rate R be list decoded from 1
R fraction of errors with list size f (1/)N c for some increasing function f () and absolute
constant c?
o(1)
1
2
s1
Large Runtime. We finally address the question of the high run time of all the list decoding
algorithms so far. Dvir and Lovett [9], presented a construction of an explicit (q, k, , s, s O(s) )subspace evasive subset S . More interestingly, given any affine subspace T of dimension at
most s, it can compute S T in time proportional to the output size. Thus, this result along with
the discussion above implies the following result:
Theorem 14.4.1. There exist strongly explicit codes of rate R that for large enough block length
-) * .N
2
can be list decoded from 1R fraction of errors (for any small enough > 0) in time O N2
+
! "O(1/)
! "O(1/2 )
! 1 "O(1/)
. The worst-case list size is 1
and the alphabet size is N
.
The above answers Question 14.0.1 pretty satisfactorily. However, to obtain a completely
satisfactory answer one would have to solve the following open question:
!
"
Open Question 14.4.3. Are there explicit codes of rate R > 0 that are 1 R , (1/)O(1) -list
decodable that can be list-decoded in time poly(N , 1/) over alphabet of size q pol y(n)?
The above question, without the requirement of explicitness, has been answered by Guruswami and Xing [29].
201
Foreword
This chapter is based on lecture notes from coding theory courses taught by Venkatesan Guruswami at University at Washington and CMU; by Atri Rudra at University at Buffalo, SUNY
and by Madhu Sudan at MIT.
This version is dated March 30, 2012. For the latest version, please go to
http://www.cse.buffalo.edu/ atri/courses/coding-theory/book/
The material in this chapter is supported in part by the National Science Foundation under
CAREER grant CCF-0844796. Any opinions, findings and conclusions or recomendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the
National Science Foundation (NSF).
Chapter 13
Cutting Data Down to Size: Hashing
In this chapter, we will study hashing, which is a method to compute a small digest of data
that can be used as a surrogate to later perform quick checks on the data. We begin with brief
descriptions of three practical applications where hashing is useful. We then formally state
the definition of hash functions that are needed in these applications (the so called universal"
hash functions). Next, we will show how in some sense good hashing functions and good codes
are equivalent. Finally, we will see how hashing can solve a problem motivated by outsourced
storage in the cloud."
algorithms that we have seen in this book are too slow to implement in routers. Hence, Internet
protocols use a hash function on a domain D that encodes all the information that needs to go
into a packet. Thus, given an x D, the packet is the pair (x, h(x)). The sender sends the packet
(x, h(x)) and the receiver gets (x# , y). In order to check if any errors occurred during transmission, the receiver checks if h(x# ) = y. If the check fails, the receiver asks for a re-transmission
otherwise it assumes there were no errors during transmission. There are two requirements
from the hash function: (i) It should be super efficient to compute h(x) given x and (ii) h should
avoid collisions," i.e. if x $= x# , then h(x) $= h(x# ).1
Integrity Checks in Cloud Storage. Say, you (as a client) have data x D that you want to
outsource x to a cloud storage provider. Of course once you ship" off x to the cloud, you do not
want to store it locally. However, you do not quite trust the cloud either. If you do not audit the
cloud storage server in any way, then nothing stops the storage provider from throwing away
x and send you some other data x# when you ask for x. The problem of designing an auditing
protocol that can verify whether the server has the data x is called the data possession problem.
We consider two scenarios. In the first scenario, you access the data pretty frequently during
normal" operation. In such cases, here is a simple check you can perform. When you ship off
x to the cloud, compute z = h(x) and store it. Later when you access x and the storage provider
send you x# , you compute h(x# ) and check if it is the same as the stored h(x). This is exactly the
same solution as the one for packet verification mentioned above.
Now consider the scenario, where the cloud is used as an archival storage. In such a case,
one needs an auditing" process to ensure that the server is indeed storing x (or is storing some
massaged version from which it can compute x e.g. the storage provider can compress x). One
can always ask the storage provider to send back x and then use the scheme above. However,
if x is meant to be archived in the cloud, it would be better to resolve the following question:
In particular, we rule out solutions where the server sends x to the client.
We will see later how this problem can be solved using hashing.
Fast Table Lookup. One of the most common operations on databases is the following. Assume there is a table with entries from D. One would like to decide on a data structure to store
1
Note that in the above example, one could have x $= x# and h(x) $= h(x# ) but it is still possible that y = h(x# ) and
hence the corrupted packet (x# , y) would pass the check above. Our understanding is that such occurrences are
rare.
182
the table so that later on given an element x D, one would quickly like to decide whether x is
in the table or now.
Let us formalize the problem a bit: assume that the table needs to store N values a 1 , . . . , a N
D. Then later given x D one needs to decide if x = a i for some i . Here is one simple solution:
sort the n elements in an array T and given x D use binary search to check if x is in T or not.
This solution uses (N ) amounts of storage and searching for x takes (log N ) time. Further,
the pre-processing time (i.e. time taken to build the array T ) is (N log N ). The space usage of
this scheme is of course optimal but one would like the lookup to be faster: ideally we should
be able to perform the search in O(1) time. Also it would be nice to get the pre-processing time
closer to the optimal O(N ). Further, this scheme is very bad for dynamic data: inserting an item
to and deleting an item from T takes (N ) time in the worst-case.
Now consider the following solution: build a boolean array B with one entry for each z D
and set B [a i ] = 1 for every i [N ] (and every other entry is 0).2 Then searching for x is easy: just
lookup B [x] and check if B [x] $= 0. Further, this data structure can easily handle addition and
deletion of elements (by incrementing and decrementing the corresponding entry of B respectively). However, the amount of storage and pre-processing time are both (|D|), which can be
much much bigger than the optimal O(N ). This is definitely true for tables stored in real life
databases. This leads to the following question:
Question 13.1.2. Is there a data structure that supports searching, insertion and deletion in
O(1) time but only needs O(N ) space and O(N ) pre-processing time?
We will see later how to solve this problem with hashing.
If one wants to handle duplicates, one could store the number of occurrences of y in B [y].
This is a very informal definition. Typically, an adversary is modeled as a randomized polynomial time algorithm and there are different variants on whether the adversary is given h(x) or x (or both). Also there are variants
where one assumes a distribution on x. Finally, there are no unconditionally collision resistant hash function but
there exists provably collision resistant hash function under standard cryptographic assumptions: e.g. factoring is
hard.
3
183
The second workaround is to define a family of hash functions and then argue that the probability of collision is small for a hash function chosen randomly from the family. More formally,
we define a hash family:
Definition 13.2.1 (Hash Family). Given D, and an integer m 1, a hash family H is a set
{h 1 , . . . , h m } such that for each i [m],
h i : D .
Next we define the notion of (almost) universal hash function (family).
Definition 13.2.2 (Almost Universal Hash Family). A hash family H = {h 1 , . . . , h m } defined over
the domain D and range is said to be -almost universal hash function (family) for some 0 <
1 if for every x $= y D,
!
"
Pr h i (x) = h i (y) ,
i
We will show in the next section that -almost universal hash functions are equivalent to
codes with (large enough) distance. In the rest of the section, we outline how these hash families
provides satisfactory solutions to the problems considered in the previous section.
Integrity Checks. For the integrity check problem, one pick random i [m] and chooses h i
H , where H is an -almost universal hash function. Thus, for any x $= y, were guaranteed
with probability at least 1 (over the random choice of i ) that h i (x) $= h i (y). Thus, this gives a
randomized solution to the integrity checking problem in routers and cloud storage (where we
consider the first scenario in which the cloud is asked to return the original data in its entirety).
It is not clear whether such hash functions can present a protocol that answers Question 13.1.1.
There is a very natural protocol to consider though. When the client ships off data x to the cloud,
it picks a random hash function h i H , where again H is an -universal hash function, and
computes h i (x). Then it stores h i (x) and ships off x to the cloud. Later on, when the client wants
to audit, it asks the cloud to send h i (x) back to it. Then if the cloud returns with z, the client
checks if z = h i (x). If so, it assumes that the storage provider is indeed storing x and otherwise
it concludes that the cloud is not storing x.
Note that it is crucial that the hash function be chosen randomly: if the client picks a deterministic hash function h, then the cloud can store h(x) and throw away x because it knows
that the client is only going to ask for h(x). Intuitively, the above protocol might work since the
random index i [m] is not known to the cloud till the client asks for h i (x), it seems unlikely"
that the cloud can compute h i (x) without storing x. We will see later how the coding view of
almost universal hash functions can make this intuition rigorous.
Fast Table Lookup. We now return to Question 13.1.2. The basic idea is simple: we will modify the earlier solution that maintained an entry for each element in the domain D. The new
solution will be to keep an entry for all possible hash values (instead of all entries in D).
184
More formally, let H = {h 1 , . . . , h m } be an -almost hash family with domain D and range
. Next we build an array of link list with one entry in the array for each value v . We pick a
random hash function h i H . Then for each a j ( j [N ]) we add it to the link list corresponding
to h i (a j ). Now to determine whether x = a j for some j , we scan the link list corresponding to
h i (x) and check if x is in the list or not. Before we analyze the space and time complexity of
this data structure, we point out that insertion and deletion are fairly easy. For inserting an
element x, we compute h i (x) and add x to the link list corresponding to h i (x). For deletion, we
first perform the search algorithm and then remove x from the list corresponding to h i (x), if it
is present. It is easy to check that the algorithms are correct.
Next we analyze the space complexity. Note that for a table with N elements, we will use
up O(N ) space in the linked lists and the array is of size O(||). That is, the total space usage is
O(N + ||). Thus, if we can pick || = O(N ), then we would match the optimal O(N ) bound for
space.
Now we analyze the time complexity of the various operations. We first note that insertion is
O(1) time (assuming computing the hash value takes O(1) time). Note that this also implies that
the pre-processing time is O(N + ||), which matches the optimal O(N ) bound for || O(N ).
Second, for deletion, the time taken after performing the search algorithm is O(1), assuming
the lists as stored as doubly linked lists. (Recall that deleting an item from a doubly linked list if
one has a pointer to the entry can be done in O(1) time.)
Finally, we consider the search algorithm. Again assuming that computing a hash value
takes O(1) time, the time complexity of the algorithm to search for x is dominated by size of the
list corresponding to h i (x). In other words, the time complexity is determined by the number
of a j that collide with x, i.e., h i (x) = h i (a j ). We bound this size by the following simple observation.
Claim 13.2.3. Let H = {h 1 , . . . , h m } with domain D and range be an -almost universal hash
family. Then the following is true for any (distinct) x, a 1 , a 2 , . . . , a N D:
!
"
Ei |{a j |h i (x) = h i (a j )}| N ,
Proof. Fix a j [N ]. Then by definition of an -almost universal hash family, we have that
Pr[h i (x) = h i (a j )] .
i
#$
%
Note that we want to bound E N
1
. The probability bound above along with the
h
(a
)=h
(x)
i
j =1 i j
linearity of expectation (Proposition 3.1.4) and Lemma 3.1.3 completes the proof.
The above discussion then implies the following:
& '
Proposition 13.2.4. Given an O N1 -almost universal hash family with domain D and range
such that || = O(N ), there exists a randomized data structure that given N elements a 1 , . . . , a N
D, supports searching, insertion and deletion in expected O(1) time while using O(N ) space in the
worst-case.
185
Thus, Proposition 13.2.4 answers Question 13.1.2 in the affirmative if we can answer the
following question in the affirmative:
&1'
N -almost
We will answer the question above (spoiler alert!) in the affirmative in the next section.
h i (x) = C (x)i .
Next we show that an -almost universal hash family is equivalent to a code with good distance.
Proposition 13.3.2. Let H = {h 1 , . . . , h n } be an -almost universal hash function, then the code
C H has distance at least (1 )n. On the other hand if C is an (n, k, n)-code, then H C is a
(1 )-almost universal hash function.
Proof. We will only prove the first claim. The proof of the second claim is essentially identical
and is left as an exercise.
Let H = {h 1 , . . . , h n } be an -almost universal hash function. Now fix arbitrary x $= y D.
Then by definition of C H , we have
{i |h i (x) = h i (y)} = {i |C H (x)i = C H (y)i }.
186
where the second equality follows from the definition of the Hamming distance. By the definition of -almost universal hash family the above probability is upper bounded by , which
implies that
(C H (x),C H (y)) n(1 ).
Since the choice of x and y was arbitrary, this implies that C H has distance at least n(1 ) as
desired.
Algorithm 8 formally states the verification protocol. Note that if the server has stored x
(or is able to re-compute x from what it had stored), then it can pass the protocol by returning
a h j (x). Thus, for the remainder of the section, we will consider the case when the server
tries to cheat. We will show that if the server is able to pass the protocol in Algorithm 8 with
high enough probability, then the server indeed has stored x.
Before we formally prove the result, we state our assumptions on what the server can and
cannot do. We assume that the server follows the following general protocol. First, when the
187
RETURN
5: ELSE
6:
RETURN
server receives x, it does performs some computation (that terminates) on x to produce y and
then it stores y. (E.g., the server could store y = x or y could be a compressed version of x.)
Then when it receives the challenge (i , j ) for x, it uses another algorithm A and returns the
answers a A (y, j ). We assume that A always terminates on any input.4 Note that the server
is allowed to use arbitrary (but finite) amount of time to compute its answer. Next, we will prove
that under these assumptions, the server cannot cheat with too high a probability.
Theorem 13.4.1. Assume that the hash family H is an -almost universal hash family. Then if
the server passes the protocol in Algorithm 8 with probability > 12 + 2 , then the server has enough
information to recreate x.
Proof. To prove the claim, we present an algorithm that can compute x from y. (Note that we do
not need this algorithm to be efficient: it just needs to terminate with x.) In particular, consider
Algorithm 9.
Algorithm 9 Decompression Algorithm
I NPUT: A , y
O UTPUT: x#
&
'
1: z A (y, j ) j [m] .
2: Run the MLD algorithm (Algorithm 1) for C H on z and let C H (x# ) be its output.
3: RETURN x#
To complete the proof, we will show that x# = x. Towards this end we claim that (z,C H (x)) <
m
2 (1 ). Assuming this is true, we complete the proof. Note that Proposition 13.3.2 implies
that C H has distance at least m(1 ). Thus, Proposition 1.4.3 (in particular, its proof ) implies
that Algorithm 1 will return C H (x) and thus, x# = x, as desired.
Finally, we argue that (z,C H (x)) < m(1 )/2. To see this note that if the server passes the
def
protocol in Algorithm 8 (i.e. the client outputs 1), then it has to be the case that z j = A (y, j ) =
4
We have stated the algorithm to be independent of y and j but that need not be the case. However later in the
section, we will need the assumption that A is independent of y and j , so we will keep it that way.
188
h j (x). Recall that by definition of C H , h j (x) = C H (x) j and that the server passes the protocol with probability > 1/2 + /2. Since j is chosen uniformly from [m], this implies that for
> m(1/2 + /2) positions j , z j = C H (x) j , which then implies the claim.
Note that Theorem 13.4.1 states that a server that cannot recreate x can pass the test with probablity at most
1/2 + /2. In other words, the probability that such a server is caught is at most 1/2 /2 < 1/2.
189
Theorem 13.4.3. Assume that the hash family H is an -almost universal hash family. Then if
)
the server passes the protocol in Algorithm 8 with probability > , then the amount of information server has stored for x is at least K (x) O(log |x|).
We note that the above is not a strict generalization of Theorem 13.4.1, as even though
probability of catching a cheating server has gone up our guarantee is weaker. Unlike Theorem 13.4.1, where we can guarantee that the server can re-create x, here we can only guarantee
storage enforceability" i.e. we can only force a server to store close to K (x) amounts of memory.
Proof of Theorem 13.4.3. Here is the main idea of the proof. We first assume for the sake of
contradiction that |y| < K (x)O(log(|x|)). Then using we construct a decompression algorithm
D that on given input y and O(log(|x|)) extra information (or advice"), outputs x. Then we will
show this overall contradicts the definition of K (x) (as this gives an overall smaller description
of x).
Before we state the decompression algorithm, we recall some facts. First note that C H by
Proposition 13.3.2 is a q-ary code (with || = q) with distance m(1 ). Further, by the Johnson
)
bound (Theorem 7.3.1), C H is a (1 , L)-list decodable, where
L qm 2 .
(13.1)
Next, in Algorithm 10, we present a decompression algorithm that can compute x from y
and an advice string a [L]. (As before, we do not need this algorithm to be efficient: it just
needs to terminate with x.)
Algorithm 10 Decompression Algorithm Using List Decoding
I NPUT: A , y, a
O UTPUT: x
&
'
1: z A (y, j ) j [m] .
2: L *.
3: FOR x# D DO
)
(C H (x# ), z) (1 )m THEN
5:
Add x# to L
6: RETURN The ath element in L
4:
IF
To complete the proof, we claim that there exists a choice of a [L] such that Algorithm 10
outputs x. Note that this implies that (y, a) along with Algorithm 10 gives a complete description
of x. Now note that Algorithm 10 can be described in O(1) bits. This implies that the size of this
description is |y| + log L + O(1), which by Definition 13.4.2 has to be at least K (x). This implies
that
|y| K (x) |a| O(1) = K (x) log L O(1) K (x) O(log |x|),
where the last inequality follows from (13.1).
190
Next, we argue the existence of an appropriate a [L]. Towards this end we claim that
)
(z,C H (x)) < m(1 ). Note that this implies that x L . Since |L | L, then we can just
)
assign a to be the index of x in L . Finally, we argue that (z,C H (x)) < m(1 ). To see this
note that if the server passes the protocol in Algorithm 8 (i.e. the client outputs 1), then it has to
def
be the case that z j = A (y, j ) = h j (x). Recall that by definition of C H , h j (x) = C H (x) j and that
)
the server passes the protocol with probability > . Since j is chosen uniformly from [m], this
)
implies that for > m positions j , z j = C H (x) j , which then implies the claim.
191
Foreword
This chapter is based on lecture notes from coding theory courses taught by Venkatesan Guruswami at University at Washington and CMU; by Atri Rudra at University at Buffalo, SUNY
and by Madhu Sudan at MIT.
This version is dated April 1, 2013. For the latest version, please go to
http://www.cse.buffalo.edu/ atri/courses/coding-theory/book/
The material in this chapter is supported in part by the National Science Foundation under
CAREER grant CCF-0844796. Any opinions, findings and conclusions or recomendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the
National Science Foundation (NSF).
Chapter 16
Securing Your Fingerprints: Fuzzy Vaults
String-based passwords are the dominant mode of authentication in todays information-reliant
world. Indeed, all of us use passwords on a regular basis to authenticate ourselves in almost any
online activity. Strings have become widespread due to several nice mathematical properties.
First, matching two strings (that is, checking if two strings are exactly the same) is computationally very fast (and easy). Second, and more importantly, there exist secure hash functions that
map a string x to another string h(x) such that, given h(x), determining x is hard. Furthermore,
since h(x) is itself a string, we can check if a claimed password y is the same as the original
string x by comparing h(y) and h(x), which (as we just observed) is easy to do. This implies
that the server performing the authentification only needs to store the hashes h(x) of the original passwords. Hence, even if the list of hashed passwords were compromised, the passwords
themselves would remain secure.
The above scheme is perfect as long as the passwords x are random enough," and this can
be achieved if the passwords were generated randomly by some automated process. However,
in real life passwords are generated by humans and are not really random. (One of the most
quoted facts is that the most commonly used password is the string password" itself.) Further,
we tend to forget passwords, which has lead to the near ubiquity of Forgot passwords" links in
places where we need to login.
One alternative that has been gaining traction in the last decade or so is to use a users fingerprint as their password. The big advantage is that it is hard to forget" ones fingerprint. In
this chapter, we will look at the issues in using fingerprints as passwords and see how ReedSolomon codes can help.
Naive Solution. Use any off-the-shelf hash function h for strings and then store h( f ) instead
of f .
To see the issues with the naive solution, we first need to know a little bit about how fingerprints are stored. The standard way to store a fingerprint is as a collection of triples, called
minutia. Each minutia point is located where one ridge splits into two, or where one ridge ends.
The i th minutia is the triple (x i , y i , i ), where x i and y i are the x and y coordinates of a point on
the finger, and i indicates the direction of the ridge that created the minutia point relative to
the plane.
The main issue with our naive solution is that two fingerprint readings will never be exactly
the same, even if the same finger is used. For any two fingerprint readings, the following issues
may produce errors:
1. Translation and rotation, even when using the same finger.
2. Varying pressure.
3. Each reading may not completely overlap with the ideal fingerprint region (i.e., the finger
may be slightly tilted).
4. The minutia are not ordered, so they form a set instead of a vector. Of course one can
sort the set to produce a string, but in conjunction with the earlier issue (especially those
involving rotation and translation) this implies that the values of (x i , y i , i ) by themselves
are not that important. Furthermore the fact that two readings might not have complete
overlap means that we are interested in matching readings that have significant overlap,
so it turns out that the set notation is deal to theoretically deal with the issues.
Figure 16.1: The minutia are unordered and form a set, not a vector.
216
We can now see that the naive solution is inadequate. Even if we could somehow correct
the first three issues, existing hash functions for strings require a vector, not a set, so our naive
solution will fail.
Remark 16.1.1. The four problems that came up in our naive solution will come up in any solution we propose. Technology has not yet developed to the point where we can securely eliminate these issues, which is why there are no prevalent secure commercial systems that safeguard
secrets using fingerprints. (The reason government agencies, such as the police or FBI, use fingerprinting is because there is an inherent trust that the government will keep your data secure,
even when it does not apply a good hash function to it.)
Thus, what we are looking for are secure hash functions designed to handle the additional
challenges posed by fingerprints. We would like to mention that for fingerprints to replace
strings as passwords, the hash function needs to satisfy both of these properties simultaneously: (i) we should be able to match hashes from the same" fingerprint and (ii) an adversary
should not be able to break" the hash function.
To be more precise we first perform the translation and rotation over the reals and then quantize and map to
the appropriate Fq value.
217
local error correction to a quantized value to mitigate the effect of varying pressure. We stress
that going over all possible shifts is not a practical solution, but theoretically this can still lead
to a polynomial-time solution.
We now formally
!F "define our problem, which primarily captures issues 3 and 4. (Below for
any integers t 1, tq denotes the set of all subsets of Fq of size exactly t .) The following are the
components of the problem:
Integers k 1, n t 1
Secret s Fkq
#
Fq
Fingerprint f
t
LOCK : Fkq
# $ # $
Fq
Fq
n
t
# $ # $
Fq
Fq
Fkq
UNLOCK :
n
t
The goal of the problem is to define the functions LOCK and UNLOCK such that they satisfy
these two properties (for some c < t ):
1. (c-completeness.) For any f , f %
!F q "
t
"
), f % = s.
2. (Soundness.) It should be hard" for an adversary to get s from LOCK(s, f ). (The notion of
hard" will be more formally defined later.)
Note that the completeness property corresponds to the matching property we need from
our hash function, while the soundness property corresponds to the security property of the
hash function.
Attempt 1. We begin with a scheme that focuses on the soundness property. A very simple
idea, which is what we will start off with, would be to just add n t random values to f to
get our vault. The intuition, which can be made precise, is that an adversary just looking at the
vault will just see random points and will not be able to recover f from the random set of points.
The catch of course that this scheme has terrible completeness. In particular, if we get a match
between a value in the second fingerprint f % and the vault, we have no way to know whether
the match is to one of the original values in f or if the match is with one of the random chaff"
points there were added earlier.
Attempt 2. Next, we specify a scheme that has good completeness (but has pretty bad soundness).
We begin with the LOCK function:
LOCK 2 (s, f
%
i
where P s (X ) = k1
i =0 s X and recall f = {1 , . . . , t }. (Note that we have n = t .)
The main intuition behind LOCK2 is the following. Given another fingerprint f % = {1 , . . . , t }
such that it is close enough to f , i.e. | f \ f % | c, for every value in f f % , we will know the
corresponding P s value and thus, we can use the fact that we can decode Reed-Solomon codes
from erasures to recover the secret s. We formally present UNLOCK2 as Algorithm 24.
Algorithm 24 UNLOCK2
I NPUT: Vault {(1 , y 1 ), . . . , (t , y t )} = LOCK(s, f ) and another fingerprint f % = {1 , . . . , t }
O UTPUT: s if | f \ f % | c
1: FOR i = 1, . . . , t DO
2:
3:
4:
5:
IF
ELSE
z j ?
6: z (z 1 , . . . , z t )
7: Run Algorithm from Theorem 11.2.1 to correct z from erasures for RS codes with evaluation
Unfortunately, (LOCK2 , UNLOCK2 ) pair has terrible soundness. This is because the vault {(1 , y 1 ), . . . , (t , y t )}
has f in the first component in each pair. This an adversary can just read off those values and
present f % = {1 , . . . , t }, which would imply that UNLOCK2 (LOCK2 (s, f ), f % ) = s, which means
that the vault would be broken."
i
2: P s (X ) k1
i =0 s i X
3: FOR i = 1, . . . , t DO
4:
5:
6:
7:
8:
9:
10:
T T {i }
FOR i = t + 1, . . . , n DO
i be a random element from Fq \ T
T T {i }
FOR every T DO
be a random element from Fq \ P s ()
R R {(, )}
To be more precise if z has e errors and s erasures w.r.t. the codeword corresponding to s, then 2e + s t k.
220
Algorithm 26 UNLOCK2
I NPUT: Vault {(1 , y 1 ), . . . , (n , y n )} = LOCK(s, f ) and another fingerprint f % = {1 , . . . , t }
O UTPUT: s if | f \ f % | c
1: FOR i = 1, . . . , t DO
2:
3:
4:
5:
IF
ELSE
z j ?
6: z (z 1 , . . . , z t )
7: Run Algorithm from Theorem 11.2.2 to correct z from errors and erasures for RS codes with
16.3.1 Soundness
To avoid getting into too much technical details, we will present a high level argument for why
the proposed fuzzy vault scheme has good soundness. Given a vault {(1 , y 1 ), . . . , (n , y n )} =
LOCK 3 (s, f ), we know that there are exactly t values (i.e. those j f ) such that the polynomial
P s (X ) agrees with the vault on exactly those t points. Thus, an intuitive way to argue the soundness of the vault would be to argue that there exists a lot other secrets s % Fkq such that P s % (X )
also agrees with the vault in exactly t positions. (One can formalize this intuition and argue that
the vault satisfies a more formal definition of soundness but we will skip those details.)
We will formalize the above argument by proving a slightly different result (and we will leave
the final proof as an exercise).
Lemma 16.3.2. Let V = {(x 1 , y 1 ), . . . , (x n , y n ) be n independent random points from Fq Fq . Then,
& 't
in expectation, there are at least 13 q k qnt polynomials P (X ) of degree at most k 1 such that
for exactly t values of j [n], we have P (x j ) = y j .
Proof. Consider a fixed polynomial P (X ) and a j [n]. Then for any x j Fq , the probability that
for a random y j F q , P (x j ) = y j is exactly 1/q. Further, these probabilities are all independent.
This implies that the probability that P (X ) agrees with V in exactly t positions is given by
# $ ( ) (
)
( )
1 t
1 nt 1 n t
n
.
q
q
3 qt
t
Since there are q k such polynomials, the claimed result follows.
We note that there are two aspects of the above lemma that are not satisfactory. (i) The result
above is for a vault V with completely random points whereas we would like to prove a similar
result but with V = LOCK3 (s, f ) and (ii) Instead of a bound in expectation, we would like to prove
a similar exponential lower bound but with high probability. We leave the proof that these can
be done as an exercise. (Hint: Use the Inverse Markov Inequality.")
221
222
Foreword
This chapter is based on lecture notes from coding theory courses taught by Venkatesan Guruswami at University at Washington and CMU; by Atri Rudra at University at Buffalo, SUNY
and by Madhu Sudan at MIT.
This version is dated August 15, 2014. For the latest version, please go to
http://www.cse.buffalo.edu/ atri/courses/coding-theory/book/
The material in this chapter is supported in part by the National Science Foundation under
CAREER grant CCF-0844796. Any opinions, findings and conclusions or recomendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the
National Science Foundation (NSF).
Chapter 20
Finding Defectives: Group Testing
Consider the following situation that arises very frequently in biological screens. Say there are N
individuals and the objective of the study is to identify the individuals with a certain biomarker"
that could e.g. indicate that the individual has some specific disease or is at risk for a certain
health condition. The naive way to do this would be to test each person individually, that is:
1. Draw sample (e.g. a blood or DNA sample) from a given individual,
2. Perform required tests, then
3. Determine presence or absence of the biomarker.
This method of one test per person will gives us a total of N tests for a total of N individuals.
Say we had more than 70 75% of the population infected. At such large numbers, the use of
the method of individual testing is reasonable. However, our goal is to achieve effective testing
in the more likely scenario where it doesnt make sense to test 100, 000 people to get just (say)
10 positives.
The feasibility of a more effective testing scheme hinges on the following property. We can
combine blood samples and test a combined sample together to check if at least one individual
has the biomarker.
The main question in group testing is the following: If we have a very large number of items
to test, and we know that only certain few will turn out positive, what is a nice and efficient way
of performing the tests?
250
20.2 Bounds on t a (d , N )
In this section, we will explore lower and upper bounds on t a (d , N ) with the ultimate objective
of answering Question 20.1.2.
We begin with a lower bound that follows from a simple counting argument.
Proposition 20.2.1. For every 1 d N ,
t a (d , N ) d log
N
.
d
Proof. Fix any valid adaptive group testing scheme with t tests. Observe that if x (= y {0, 1}N ,
with w t (x), w t (y) d then r(x) (= r(y), where r(x) denotes the result vector for running the tests
251
on x and similarly for r(y). The reason for this is because two valid inputs cannot give the same
result. If this were the case and the results of the tests gave r(x) = r(y) then it would not be
possible to distinguish between x and y.
The above observation implies that total number of distinct test results is the number distinct binary vectors with Hamming weight at most d , i.e. V ol 2 (d , N ). On the other hand, the
number of possible distinct t -bit vectors is at most 2t , which with the previous argument implies that
2t V ol 2 (d , N )
and hence, it implies that
t logV ol 2 (d , N ).
Recall that
% & ' (
N
N d
V ol 2 (d , N )
,
d
d
where the first inequality follows from (3.23) and the second inequality follows from Lemma B.1.1.
So t d log(N /d ), as desired.
)
) **
It turns out that t a (d , N ) is also O d log N
. (See Exercise 20.1.) This along with Propo)
)dN **
a
sition 20.2.1 implies that t (d , N ) = d log d , which answers Question 20.1.2. The upper
bound on t a (d , N ) follows from an adaptive group testing scheme and hence does not say
anything meaningful for Question 20.1.1. (Indeed, we will see later that t (d , N ) cannot be
O(d log(N /d )).) Next, we switch gears to talk about non-adaptive group testing.
20.3 Bounds on t (d , N )
We begin with the simplest case of d = 1. In this case it is instructive to recall our goal. We want
to define a matrix M such that given any x with w t (x) 1, we should be able to compute x from
M ' x. In particular, let us consider the case when x = ei for some i [N ]. Note that in this
case M ' x = M i , where M i is the i th column of M . Hence we should design M such that M i
uniquely defined i . We have already encountered a similar situation before in Section 2.6 when
trying to decode the Hamming code. It turns out that is suffices to pick M as the parity check
matrix of a Hamming code. In particular, we can prove the following result:
Proposition 20.3.1. t (1, N ) )log(N + 1)* + 1
Proof. We prove the upper bound by exhibiting a matrix that can handle non adaptive group
testing for d = 1. The group test matrix M is the parity check matrix for [2m 1, 2m m 1, 3]2 ,
i.e. Hm where the i -th column is the binary representation of i (recall Section 2.4). This works
because when performing Hm 'x = r, if w t (v) 1 then r will correspond to the binary representation of i . Further, note that if w t (x) = 0, then r = 0, which is exactly x. Hence, M ' x uniquely
identifies x when w t (x) 1, as desired.
If N (= 2m 1 for any m, the matrix Hm corresponding to the m such that 2m1 1 < N <
2m 1 can be used by adding 0s to the end of x. By doing this, decoding is "trivial" for both
252
cases since the binary representation is given for the location. So the number of tests is at most
)log(N + 1)* + 1, which completes the proof.
Note that Propositions 20.1.1 and 20.2.1 imply that t (d , N ) log N , which with the above
result implies that t (1, N ) = (log N ). This answers Question 20.1.1 for the case of d = 1. We will
see later that such a tight answer is not known for larger d . However, at the very least we should
try and extend Proposition 20.3.1 for larger values of d . In particular,
Question 20.3.1. Prove asymptotic upper bounds on t (d , N ) that hold for every 1 < d N .
We would like to point out something that was implicitly used in the proof of Proposition 20.3.1. In particular, we used the implicitly understanding that a non-adaptive group testing matrix M should have the property that given any x {0, 1}N such that w t (x) d , the result
vector M ' x should uniquely determine x. This notion is formally captured in the following
definition of non-adaptive group testing matrix:
Definition 20.3.1. A t N matrix M is d -separable if and only if for every S 1 (= S 2 [N ] such that
|S 1 |, |S 2 | d , we have
+
j S 1
M j (=
Mi .
i S 2
In the above we think of a columns M i {0, 1}t as a subset of [t ] and for the rest of this
chapter we will use both views of the columns of a group testing matrix. Finally, note that the
above definition is indeed equivalent to our earlier informal definition since for any x {0, 1}N
with w t (x) d , the vector M ' x when thought of as its equivalent subset of [t ] is exactly the set
i S M i , where S is the support of x, i.e. S = {i |x i = 1}.
Like in the coding setting, where we cared about the run time of the decoding algorithm,
we also care about the time complexity of the decoding problem (given M ' x compute x) for
group testing. We will now look at the obvious decoding algorithm for d -separable matrices:
just check all possible sets that could form the support of x. Algorithm 28 has the details.
The correctness of Algorithm 28 follows from Definition 20.3.1. Further, it is easy to check
that this algorithm will run in N (d ) time, which is not efficient for even moderately large d .
This naturally leads to the following question:
Question 20.3.2. Do there exists d -separable matrices that can be efficient decoded?
We would like to remark here that the matrices that we seek in the answer to Question 20.3.2
should have small number of tests (as otherwise the identity matrix answers the question in the
affirmative).
253
4:
5:
6:
S T i T M i
IF R = S T THEN
x (x 1 , . . . , x N ) {0, 1}N such that x i = 1 if and only i T .
RETURN x
7: RETURN
Fail
Mk.
kS
0 0 0 0 0 0 0 0 0 0 0 0 0 0
Figure 20.1: Pick a subset S (not necessarily contiguous). Then pick a column j that is not
present in S. There will always be i such that row i has a 1 in column j and all zeros in S.
Proof. For contradiction, assume M is d -disjunct but not d -separable. Since M is not d -separable,
then union of two subset S (= T [N ] of size at most d each are the same; i.e.
+
kS
Mk =
Mk.
kT
kT
Mk =
Mk,
kS
where the last equality follows from the previous equality. However, since by definition j ( S,
the above contradicts the fact that M is d -disjunct.
In fact, it turns out that disjunctness is also almost a necessary condition: see Exercise 20.2.
Next, we show the real gain of moving to the notion of disjunctness from the notion of separability.
Lemma 20.3.3. There exists a O(tN) time decoding algorithm for any t N matrix that is d disjunct.
Proof. The proof follows from the following two observations.
First, say we have a matrix M and a vector x and r = M ' x such that r i = 1. Then there exists
a column j in matrix that made it possible i.e. if r i = 1, then there exists a j such that M i j = 1
and x j = 1.
Second, let T be a subset and j be a column not in T where T = {" | x " = 1} and |T | d .
Consider the i th row such that T has all zeros in the i th row, then r i = 0. Conversely, if r i = 0,
then for every j [N ] such that M i j = 1, it has to be the case that x j = 0. This naturally leads to
the decoding algorithm in Algorithm 29.
The correctness of Algorithm 29 follows from the above observation and it can be checked
that the algorithm runs in time O(t N ) see Exercise 20.3.
Modulo the task of exhibiting the existence of d -disjunct matrices, Lemmas 20.3.3 and 20.3.2
answer Question 20.3.2 in the affirmative. Next, we will tackle the following question:
2: FOR every i [t ] DO
4:
IF r i = 0 THEN
FOR Every j
5:
IF
3:
6:
[N ] DO
M i j = 1 THEN
xj 0
7: IF M ' x = r THEN
8:
RETURN
9: ELSE
10:
RETURN
Fail
(ii) For
, i everyj ,i (= j [N ], the i and j th columns have at most a max ones in common, i.e.
,M M , a max
.
1
-disjunct.
for some integers a max w min t . Then M is a wamin
max
.
1
Proof. For notational convenience, define d = wamin
. Fix an arbitrary S [N ] such that |S|
max
d and a j ( S. Note we have to show that
M j ( i S M i ,
or equivalently
j
M ( i S M M
w min d a max
w min 1
a max
w min
a max
= 1.
256
(20.1)
(20.2)
(20.3)
(20.4)
In the above, (20.1) follows from the fact that size of the union of sets is at most the sum of
their sizes. (20.2) follows from the definitions of w min and a max . (20.3) follows from the fact that
|S| d while (20.4) follows from the definition of d . The proof is complete.
Next, we present a simple way to convert a code into a matrix. Let C [q]t be a code such
that C = {c1 , . . . , cN }. Then consider the matrix MC whose i th column is ci , i.e.
MC = c1 c2 cn .
.
1
Thus, by Lemma 20.4.1, to construct an wamin
-disjunct matrix, it is enough to design a
max
binary code C {0, 1}t such that (i) for every c C , w t (c) w min and (ii) for every c1 (= c2 C ,
we have |{i |c i1 = c i2 = 1}| a max . Next, we look at the construction of such a code.
Note that the above result answers Question 20.3.3. It turns out that one can do a bit better:
see Exercise 20.4.
Towards this end, we will now study a construction of C as in the previous section due to
Kautz and Singleton. As we have already seen in Chapter 10, concatenated codes are a way
to design binary codes. For our construction of C , we will also use code concatenation. In
particular, we will pick C = C out C in , where C out is a [q, k, q k + 1]q Reed-Solomon code (see
Chapter 5) while the inner code C in : Fq {0, 1}q is defined as follows. For any i Fq , define
C in (i ) = ei . Note that MC in is the identity matrix and that N = q k and t = q 2 .
Example 20.4.3. Let k = 1 and q = 3. Note that by our choice of [3, 1]3 Reed-Solomon codes, we
have C out = {(0, 0, 0), (1, 1, 1), (2, 2, 2)}. In other words,
0 1 2
MC out = 0 1 2 .
0 1 2
Then the construction of MC can be visualized as in Figure 20.4.3.
Next, we instantiate parameters in the Kautz-Singleton construction to prove Theorem 20.4.2.
Proof of Theorem 20.4.2. We first analyze the construction to determine the parameters w min
and a max . Then we pick the parameters q and k in terms of d to complete the proof.
Recall that N = q k and t = q 2 . It is easy to check that every column of MC has exactly q
ones in it. In other words, w min = q. Next, we estimate a max .
257
0
0
0
0 1 2
0 0 1
0 1 2 0 1 0
0
1
1 0 0
0 1 2
0
MC in
MC out
0
1
0 1
1 0
0 0
0 1
1 0
0 0
0 1
1 0
0 0
MC
Figure 20.2: Construction of the final matrix MC from MC out and MC in from Example 20.4.3.
The rows in MC that correspond to the same row in MC out have the same color.
Divide the rows into q sized chunks, and index the t = q 2 rows by pairs in [q] [q]. Recall
that each column in MC corresponds to a codeword in C . For notational convenience, we
will use M for MC . Note that for any row (i , j ) [q] [q] and a column index " [N ], we have
M (i , j )," = 1 if and only if c" ( j ) = j (where we use some fixed bijection between Fq and [q] and
c" is the "th codeword in C out ). In other words, the number of rows where the "1 th and "2 th
columns both have a one is exactly the number of positions where c"1 and c"2 agree, which is
exactly q (c"1 , c"2 ). Since C out is a [q, k, q k + 1]q code, the number of rows where any two
columns agree is at most k 1. In other words, a max = k 1.1
Lemma 20.4.1 implies that MC is d -disjunct if we pick
7
8
q 1
d=
.
k 1
Thus, we pick q and k such that the above is satisfied. Note that we have q = O(kd ). Further,
since we have N = q k , we have
k = logq N .
This implies that q = O(d logq N ), or q log q = O(d log N ). In other words we have
q = O(d logd N ).
Recalling that t = q 2 completes the proof.
An inspection of the proof of Theorem 20.4.2 shows that we only used the distance of the
Reed-Solomon code and in particular, any C out with large enough distance suffices. In particular, if we pick C out to be a random code over an appropriate sized alphabet then one can obtain
t = O(d 2 log N ). (See Exercise 20.5 for more on this.) Note that this bound is incomparable to
the bound in Theorem 20.4.2. It turns out that these two are the best known upper bounds on
t (d , N ). In particular,
1
The equality is obtained due to columns that corresponds to codewords that agree in exactly k 1 positions.
258
)
)
**
Open Question 20.4.1. Can we beat the upper bound of O d 2 min log(N /d ), log2d N on
t (d , N )?
It turns out that the quadratic dependence on d in the upper bounds is tight. In fact it is
known that t (d , N ) (d 2 logd N ). (See Exercises 20.7 and 20.8.)
Next, we present an application of group testing in the field of data stream algorithms, which
in turn will bring out another facet of the connection between coding theory and group testing.
Definition 20.5.3 (Hot Items Problem). Given N different items, for m input pairs of data (i " , u " )
for 1 " m, where i " [N ] indicates the item index and u " indicates corresponding count.
The problem requires updating
the count f " (1 " m) for each item, and to output all item
9
N
u
"=1 "
Note that there can be at most d hot items. In this chapter, we will mostly think of d as
O(log N ). Hot items problem is also called heavy hitters problems. We state the result below
without proof:
Theorem 20.5.1. Computing hot items exactly by a deterministic one pass algorithm needs (n)
space (even with exponential time).
This theorem means that we cannot solve the hot items problem in poly-log space as we
want. However, we could try to find solutions for problems around this. The first one is to
output an approximate solution, which will output a set that contains all hot items and some
non-hot items. For this solution, we want to make sure that the size of the output set is not too
large (e.g. outputting [N ] is not a sensible solution).
Another solution is to make some assumptions on the input. For example, we can assume
Zipf-like distribution of the input data, which means only a few items appear frequently. More
specifically, we can assume heavy-tail distribution on the input data, i.e.:
"
":not hot
f"
m
.
d
(20.5)
This is reasonable for many applications, such as hot stock finding, where only a few of them
have large frequency. Next, we will explore the connection between group testing and hot items
problem based on this assumption.
Algorithm 30 Initialization
O UTPUT: Initialize the counters
1: m 0
2: FOR every j [t ] DO
3:
Cj 0
Algorithm 31 Update
I NPUT: Input pair (i , u), i [N ] and u Z
O UTPUT: Update the Counters
1: m m + 1,
2: FOR every j [t ] DO
3:
4:
IF
M i j = 1 THEN
Cj Cj +u
Next, we reduce the problem of reporting hot items to the decoding problem of group testing. The reduction essentially follows from the following observations.
Observation 20.5.2. If j is a hot item and M i j = 1, then C i > m
d.
Proof. Let i [t ] be such that M i j = 1. Then note that at any point of time,
Ci =
"
k:M i k =1
f k f j .2
"
fk .
k:M i k =1
261
only if C i > m
, we will have r i = j :Mi j =1 x j . The latter claim follows from Observations 20.5.2
d
and 20.5.3 above. This means we have:
M ' x = r.
(20.6)
Note that by definition, w t (x) < d . Thus reporting the hot items is the same as decoding to
compute x given M and r, which successfully changes the hot items problem into group testing
problem. Algorithm 32 has the formal specification of this algorithm.
Algorithm 32 Report Heavy Items
I NPUT: Counters m and C 1 , . . . ,C t
O UTPUT: Output the heavy items
1: FOR every j [t ] DO
2:
3:
4:
5:
>m
d THEN
rj 1
IF C t
ELSE
rj 0
Next, we will design and analyze the algorithm above and check if the conditions in Definition 20.5.1 are met.
Analysis of the Algorithm
In this part, we will review the requirements on data stream algorithm one by one and check
if the algorithm for the hot items problem based on group testing satisfies them. In particular,
we will need to pick M and the decoding algorithm. We will pick M to be the d -disjunct matrix
from Theorem 20.4.2.
1. One-pass requirement
If we use non-adaptive group testing, the algorithm for the hot items problem above can
be implemented in one pass, which means each input is visited only once. (If adaptive
group testing is used, the algorithm is no longer one pass, therefore we choose nonadaptive group testing.) We note that by definition, our choice of M satisfies this condition.
2. Poly-log space requirement
In the algorithm, we have to maintain the counters C i and m. The maximum value for
them is mN , thus we can represent each counter in O(log N + log m) bits. This means
we need O((log N +log m)t )bits to maintain the counters. Theorem 20.4.2 implies that t =
O(d 2 log2d N ). Thus, the total space we need to maintain the counters is O(d 2 log2d N (log N +
log m)).
262
On the other hand, if we need to store the matrix M , we will need (t N ) space. Therefore,
poly-log space requirement can be achieved only if matrix M is not stored directly. (We
will tackle this issues in the next point.)
3. Poly-log update time
As mentioned in the previous part, we cannot store the matrix M directly in order to have
poly-log space. Since RS code is strongly explicit (see Exercise 6.4), we do not need to
explicitly store M (we just need to store the parameters of the code C out and C in , which can
be done in poly-log space). In the following, we will argue that the runtime of Algorithm 31
is O(t poly log t ). It is easy to check the claimed time bound is correct as long as we can
perform the check in Step 3 in poly log(t ) time. In particular, we would be done if given
j [N ], we can compute the column M j in O(t poly log t ) time. Next, we argue that the
latter claim is correct.
:
;
Recall that M = MC , with C = C out C in , where C out is a q, k, q k + 1 q RS code and
C in chosen such that MC in is the q q identity matrix. Recall that codewords of C are
columns of the matrix M , and we have n = q k , t = q 2 .
Since every column of M corresponds to a codeword of C , we can think of j equivalently as a message m Fq k . In particular, M j then corresponds to the codeword C out (m).
On the other hand, the column M j can be partitioned into q chunks, each chunk is of
length q. Notice that (C out (m))i 1 = i 2 if and only if the i 1 th chunk has 1 on its i 2 th position and 0 on other positions (recall the definition of C in ). Therefore, we can compute
M j by computing C out (m). Because C out is a linear code, C out (m) can be computed in
O(q 2 poly log q) time,3 implies that M j can be computed in O(q 2 poly log q) time. Since
we have t = q 2 , the update process can be finished with O(t poly log t ) time. (We do not
need C out to be strongly explicit: as long as C out is linear the arguments so far work just as
well.)
4. Reporting time
It is easy to check that the run time of Algorithm 32 is dominated by Step 6. So far, the only
decoding algorithm for M that we have seen is Algorithm 29, which runs in time (t N ),
which does not satisfy the required reporting time requirement. In Exercise 20.11, we
show that using the fact that C out is the Reed-Solomon code, one can solve the decoding
problem in poly(t ).
Thus, we have argued that
Theorem 20.5.4. There exists a data streaming algorithm that computes d hot items with one
pass, O(t log N ) space for t = O(d 2 log2d N ), O(t poly log t ) update time and poly(t ) reporting time.
3
This follows from Proposition 2.3.2 and the fact that C out is strongly explicit
263
20.6 Exercises
Exercise 20.1 (Upper bound on t a (d , N )). In this problem we will show that t a (d , N ) = O(d log(N /d )).
We begin by trying to prove a weaker bound of O(d log N ):
Show that one can identify at least one i such that x i = 1 (or report none exist) with
O(log N ) adaptive tests.
(Hint: Use binary search.)
Using the scheme above argue that one can compute x with O(w t (x)log N ) adaptive tests.
Conclude that t a (d , N ) O(d log N ).
Next we argue that we can tighten the bound to the optimal bound of O(d log(N /d )):
Argue that any scheme that computes x {0, 1}N with O(w t (x) log N ) adaptive tests can
be used to compute x with O(d log(N /d )) adaptive tests where w t (x) d .
Conclude that t a (d , N ) O(d log(N /d )).
Exercise 20.2. Show that every d -separable matrix is also (d 1)-disjunct.
Exercise 20.3. Prove that Algorithm 29 is correct and runs in time O(t N ).
Exercise 20.4. For every integer d 1 and large enough integer N d show that there exists a
d -disjunct matrix with O(d 2 log(N /d )) rows.
(Hint: Use the probabilistic method. It might help to pick each of t N bits in the matrix independently at random with the same probability.)
Exercise 20.5. We first begin by generalizing the argument of Theorem 20.4.2:
Let C out be an (n, k, D)q code. Let C in be defined such that MC in is the q q identity matrix.
Let MC out C in be a t N matrix that is d -disjunct. Derive the parameters d , t and N .
Next argue that it is enough to pick an outer random code to obtain a d -disjunct matrix with
the same parameters obtained in Exercise 20.4:
Pick q = (d ). Then using the previous part or otherwise show that if C out is a random
[n, k, D]q code, then the resulting t N matrix MC out C in is d -disjunct with t = O(d 2 log N )
for large enough N .
(Hint: Use Theorem 4.2.1 and Proposition 3.3.5.)
Exercise 20.6. For every integer d 1 and large enough N d , construct a d -disjunct matrix
with O(d 2 log N ) rows in (deterministic) time poly(N ).
Hint: Recall Exercise 4.7.
Exercise 20.7 (Lower
on t (d , N ) due to Bassalygo). In this problem we will show that
<) * Bound
=
d +2
t (d , N ) min
, N . In what follows let M be a t N matrix that is d -disjunct.
2
264
(a) Argue that if w t (M j ) < d then M j has a private row i.e. there exists a row i [t ] such that
M i j = 1 but M i j 7 = 0 for every j 7 (= j .
(b) Using part (a) or otherwise, argue that if all columns of M have Hamming weight at most
d 1, then t N .
(c) Let M j for j [N ] be the matrix M with M j as well as all rows i [t ] such that M i j = 1
removed. Then argue that M j is (d 1)-disjunct.
(d) Argue that t (1, N ) min {3, N }.
(e) Using induction with parts (b)-(d) or otherwise, argue that t min
<)
d +2*
2 ,N
=
.
Exercise 20.8 (Lower Bound on t (d , N ) due to Ruszink and Alon-Asodi). In this problem, we
will show that
)
>
?*
t (d , N ) min d 2 logd N , N .
(20.7)
In what follows let M be a t N matrix that is d -disjunct.
2
(a) Argue that any j [N ] such that w t (M j ) < 2t
d has a private subset of size )4t /d *, i.e. there
exists a subset S [N ] with |S| = )4t /d 2 * such that M j has ones in all i S but for every
7
j (= j 7 , M j has at least one row i 7 S such that M i 7 j 7 = 0.
266
Foreword
This chapter is based on lecture notes from the course CSE 545 Error-Correcting Codes: Combinatorics, Algorithms and Applications taught by Atri Rudra at University at Buffalo, SUNY.
This version is dated February 29, 2012. For the latest version, please go to
http://www.cse.buffalo.edu/ atri/courses/coding-theory/book/
The material in this chapter is supported in part by the National Science Foundation under
CAREER grant CCF-0844796. Any opinions, findings and conclusions or recomendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the
National Science Foundation (NSF).
Appendix A
Notation Table
R
E
log x
m
v
0
ei
vS
u, v
[a, b]
[x]
n
q
k
R
(u, v)
d
w t (v)
B (x, r )
(n, k, d )
(n, k, d )q
[n, k, d ]q
Fq
F
FmN
q
R(C )
(C )
U
183
Section 1.2
Definition 1.2.1
Definition 1.2.1
Definition 1.2.1
Definition 1.2.2
Definition 1.2.3
Definition 1.4.1
Definition 1.4.2
Definition 1.5.1
Definition 1.6.1
Definition 1.7.1
Definition 1.7.1
Definition 2.0.4
Section 2.1
Definition 2.5.1
Definition 2.5.1
Definition 3.1.1
E[V ]
1E
H q (x)
H q1 (y)
deg(P )
Fq [X ]
184
Definition 3.1.2
Section 3.1
Definition 3.3.1
Section 3.3.2
Definition 5.1.2
Section 5.1