Coding Theory
Coding Theory
Coding Theory
1.1 Overview
Communication is a fundamental need of our modern lives. In fact, communication is some-
thing 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 redun-
dancy, 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 Akash’s 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 cor-
rupted 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 com-
municate 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 Redun-
dant 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
someone’s 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 frame-
work, 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 cor-
rected 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
Definition 1.2.1 (Code). A code of block length n over an alphabet Σ is a subset of Σn . Typically,
we will use q to denote |Σ|.3
Remark 1.2.1. We note that the ambient space Σn , viewed as a set of sequences, vectors or func-
tions. In other words, we can think of a vector (v 1 , . . . , v n ) ∈ Σn as just the sequence v 1 , . . . , v n (in
order) or a vector tuple (v 1 , . . . , v n ) or as the function f : [n] → Σ such that f (i ) = v i . Sequences
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: we’ll 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). Func-
tions 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 1−R) 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 Ques-
tion 1.1.1, we need to formally define what it means to correct errors. We do so next.
23
c hannel
m C (m ) y = C (m ) + e m
e n c o d in g f u n c tio n d e c o d in g f u n c tio n
e
C ⊕ : q = 2, k = 4, n = 5, R = 4/5.
We will start with the repetition code. To study its error-correcting capabilities, we will con-
sider the following natural decoding function. Given a received word y ∈ {0, 1}12 , divide it up
into four consecutive blocks (y 1 , y 2 , y 3 , y 4 ) where every block consists of three bits. Then, for
every block y i (1 ≤ i ≤ 4), output the majority bit as the message bit. We claim this decoding
function can correct any error pattern with at most 1 error. (See Exercise 1.2.) For example, if a
block of 010 is received, since there are two 0’s we know the original message bit was 0. In other
words, we have argued that
However, it is not too hard to see that C 3,r ep cannot correct two errors. For example, if both
of the errors happen in the same block and a block in the received word is 010, then the original
block in the codeword could have been either 111 or 000. Therefore in this case, no decoder can
successfully recover the transmitted message.5
Thus, we have pin-pointed the error-correcting capabilities of the C 3,r ep code: it can cor-
rect one error, but not two or more. However, note that the argument assumed that the error
positions can be located arbitrarily. In other words, we are assuming that the channel noise
behaves arbitrarily (subject to a bound on the total number of errors). Obviously, we can model
the noise differently. We now briefly digress to look at this issue in slightly more detail.
Digression: Channel Noise. As was mentioned above, until now we have been assuming the
following noise model, which was first studied by Hamming:
5
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 er-
rors is bounded. Note that this means that the location as well as the nature6 of the
errors is arbitrary.
We will frequently refer to Hamming’s 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:
First note that, for the channel model above, no more than four errors can occur when a code-
word 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 suc-
cessfully 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 con-
crete 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: Hamming’s model assumes no knowledge about the channel (except that a bound
on the total number of errors is known7 while Shannon’s noise model assumes complete knowl-
edge 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.1 (Hamming distance). Given u, v ∈ Σn (i.e. two vectors of length n) the Ham-
ming distance between u and v, denoted by ∆(u, v), is defined to be the number of positions in
which u and v differ.
The Hamming distance is a distance in a very formal mathematical sense: see Exercise 1.5.
Note that the definition of Hamming distance just depends on the number of differences and
not the nature of the difference. For example, for the vectors u and v from the previous section,
∆(u, v) = 2, which is equal to the Hamming distance ∆(u, w), where w = 01010, even though the
vectors v and w are not equal.
Armed with the notion of Hamming distance, we now define another important parameter
of a code.
26
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 dis-
tance 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.
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:
The proof of Proposition 1.4.1 will need the following decoding function. Maximum like-
lihood 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 arbi-
trarily). 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).
c∈C
27
Algorithm 1 Naive Maximum Likelihood Decoder
I NPUT: Received word y ∈ Σn
O UTPUT: D M LD (y)
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:
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 contra-
diction.
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 ev-
ery 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 d −1
n −d +1 2 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. ■
Proposition 1.4.1 implies that Question 1.1.1 can be reframed as
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 ?
C H (x 1 , x 2 , x 3 , x 4 ) = (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 ).
C H : q = 2, k = 4, n = 7, R = 4/7.
We will show shortly that C H has a distance of 3. We would like to point out that we could
have picked the three parities differently. The reason we mention the three particular parities
above is due to historical reasons. We leave it as an exercise to define alternate set of parities
such that the resulting code still has a distance of 3: see Exercise 1.9.
Before we move on to determining the distance of C H , we will need another definition.
Definition 1.5.1 (Hamming Weight). Let q ≥ 2. Given any vector v ∈ {0, 1, 2, . . . , q − 1}n , its Ham-
ming weight, denoted by w t (v) is the number of non-zero symbols in v.
30
and
min w t (c) = min ∆(c1 , c2 ) (1.8)
c∈C H ,c)=0 c1 )=c2 ∈C H
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 code-
word.
Thus, we can conclude that min w t (c) ≥ 3. Further, note that w t (C H (1, 0, 0, 0)) = 3, which
c∈C 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 w t (C H (x)),
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). Combin-
ing (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 Exer-
cise 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 Ham-
ming 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 ?
32
Definition 1.6.1 (Hamming Ball). For any vector x ∈ [q]n ,
Next we prove an upper bound on the dimension of every code with distance 3.
Theorem 1.6.1 (Hamming bound for d = 3). Every binary code with block length n, dimension
k, distance d = 3 satisfies
k ≤ n − log2 (n + 1).
Proof. Given any two codewords, c1 )= c2 ∈ C , the following is true (as C has distance13 3):
See Figure 1.4 for an illustration. Note that for all x ∈ {0, 1}n (see Exercise 1.14),
{0, 1}n
1 1 1
c1 c2
1 1 1
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.
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)
' '
c∈C
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
As (1.9) holds for every pair of distinct codewords,
' '
'( ' )
' B (c, 1)' = |B (c, 1)|
' '
c∈C c∈C
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.
Definition 1.7.1. A code C ⊆ Σn with dimension k and distance d will be called a (n, k, d )Σ code.
We will also refer it to as a (n, k, d )|Σ| code.
Theorem 1.7.1 (Hamming Bound for any d ). For every (n, k, d )q code
* +
(d −1)
, -
2
) n
(q − 1)i .
k ≤ n − logq
i =0 i
34
Indeed
.n / any vector in B (x, e) must differ from x in exactly 0 ≤ i ≤ e positions. In the summation
i
is the number of ways of choosing the differing i positions and in each such position, a
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)
' '
c∈C
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
k ≤ n − logq (q − 1)i .
i =0 i
Definition 1.7.2. Codes that meet Hamming bound are called perfect codes.
Intuitively, a perfect
* code
+ leads to the following perfect “packing": if one constructs Ham-
ming balls of radius d −12
around all the codewords, then we would cover the entire ambient
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?
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.2. Prove Proposition 1.3.1.
Exercise 1.3. Show that for every integer n, there is no code with block length n that can handle
arbitrary number of errors.
Exercise 1.4. Prove Proposition 1.3.2.
Exercise 1.5. A distance function on Σn (i.e. d : Σn × Σn → R) is called a metric if the following
conditions are satisfied for every x, y, z ∈ Σn :
1. d (x, y) ≥ 0.
4. d (x, z) ≤ d (x, y) + d (y, z). (This property is called the triangle inequality.)
1. Let C be an (n, k, d )2 code with d odd. Then it can be converted into an (n + 1, k, d + 1)2
code.
Note: Other than the parameters of the code C , you should not assume anything else about the
code. Also your conversion should work for every n, k, d ≥ 1.
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.9. Define codes other than C H with k = 4, n = 7 and d = 3.
Hint: Refer to the proof of Proposition 1.5.1 to figure out the properties needed from the three
parities.
Exercise 1.10. Prove that for any u, v ∈ {0, 1}n , ∆(u, v) = w t (u + v).
Exercise 1.11. Argue that C ⊕ and C 3,r ep are binary linear codes.
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 don’t 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 12 .
Next we will see how one can really bump up the probability of success with some careful mod-
eling, 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
n+1
for any directed subgraph G of the n-dimensional hypercube.
(d) Show that if n = 2r − 1, then there exists a directed subgraph G of the n-dimensional hy-
n
percube with K (G)/2n = n+1 .
Hint: This is where the Hamming code comes in.
37
1.9 Bibliographic Notes
Coding theory owes its original to two remarkable papers: one by Shannon and the other by
Hamming [37] both of which were published within a couple of years of each other. Shannon’s
paper defined the BSCp channel (among others) and defined codes in terms of its encoding
function. Shannon’s paper also explicitly defined the decoding function. Hamming’s work de-
fined the notion of codes as in Definition 1.2.1 as well as the notion of Hamming distance. Both
the Hamming bound and the Hamming code are (not surprisingly) due to Hamming. The spe-
cific definition of Hamming code that we used in this book was the one proposed by Ham-
ming and is also mentioned in Shannon’s paper (even though Shannon’s paper pre-dates Ham-
ming’s).
The notion of erasures was defined by Elias.
One hybrid model to account for the fact that in real life the noise channel is somewhere
in between the extremes of the channels proposed by Hamming and Shannon is the Arbitrary
Varying Channel (the reader is referred to the survey by Lapidoth and Narayan [48]).
38
Chapter 2
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 code-
words) 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. Intu-
itively, 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 lin-
ear 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 sub-
space yet. We do that next.
Definition 2.1.1. A field F is given by a triple (S, +, ·), where S is the set of elements containing
special elements 0 and 1 and +, · are functions F × F → F with the following properties:
39
• Closure: For every a, b ∈ S, we have both a + b ∈ S and a · b ∈ S.
• Associativity: + and · are associative, that is, for every a, b, c ∈ S, a +(b +c) = (a +b)+c and
a · (b · c) = (a · b) · c.
• Inverses: For every a ∈ S, there exists its unique additive inverse −a such that a + (−a) =
0. Also for every a ∈ S \ {0}, there exists its unique multiplicative inverse a −1 such that
a · a −1 = 1.
With the usual semantics for + and ·, R (set of real number) is a field but Z (set of integers)
is not a field as division of two integers can give rise to a rational number (the set of rational
numbers itself is a field though– see Exercise 2.1). In this course, we will exclusively deal with
finite fields. As the name suggests these are fields with a finite size set of elements. (We will
overload notation and denote the size of a field |F| = |S|.) The following is a well known result.
Theorem 2.1.1 (Size of Finite Fields). The size of any finite field is p s for prime p and integer
s ≥ 1.
One example of finite fields that we have seen is the field of two elements {0, 1}, which we
will denote by F2 (we have seen this field in the context of binary linear codes). For F2 , addition
is the XOR operation, while multiplication is the AND operation. The additive inverse of an
element in F2 is the number itself while the multiplicative inverse of 1 is 1 itself.
Let p be a prime number. Then the integers modulo p form a field, denoted by Fp (and also
by Zp ), where the addition and multiplication are carried out mod p. For example, consider
F7 , where the elements are {0, 1, 2, 3, 4, 5, 6}. So we have 4 + 3 mod 7 = 0 and 4 · 4 mod 7 = 2.
Further, the additive inverse of 4 is 3 as 3 + 4 mod 7 = 0 and the multiplicative inverse of 4 is 2
as 4 · 2 mod 7 = 1.
More formally, we prove the following result.
Lemma 2.1.2. Let p be a prime. Then Fp = ({0, 1, . . . , p − 1}, +p , ·p ) is a field, where +p and ·p are
addition and multiplication mod p.
Proof. The properties of associativity, commutativity, distributivity and identities hold for in-
tegers and hence, they hold for Fp . The closure property follows since both the “addition" and
“multiplication" are done mod p, which implies that for any a, b ∈ {0, . . . , p − 1}, a +p b, a ·p b ∈
{0, . . . , p −1}. Thus, to complete the proof, we need to prove the existence of unique additive and
multiplicative inverses.
Fix an arbitrary a ∈ {0, . . . , p − 1}. Then we claim that its additive inverse is p − a mod p. It is
easy to check that a + p − a = 0 mod p. Next we argue that this is the unique additive inverse.
40
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 uni-
verse a −1 . Consider the set of numbers {a ·p b}b∈{1,...,p−1} . 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 ).
Definition 2.2.1 (Linear Subspace). S ⊆ Fq n is a linear subspace if the following properties hold:
1. For every x, y ∈ S, x + y ∈ S, where the addition is vector addition over Fq (that is, do addi-
tion component wise over Fq ).
S 1 = {(0, 0, 0), (1, 1, 1), (2, 2, 2), (3, 3, 3), (4, 4, 4)}. (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)
Note that (1, 0, 1) + (0, 2, 2) = (1, 2, 0) ∈ S 2 and 2 · (2, 0, 2) = (1, 0, 1) ∈ S 2 as required.
Remark 2.2.1. Note that the second property implies that 0 is contained in every linear sub-
space. 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 indepen-
dent if for every 1 ≤ i ≤ k and for every k − 1-tuple (a 1 , a 2 , . . . , a i −1 , a i +1 , . . . , a k ) ∈ Fk−1
q ,
vi '= a 1 v1 + . . . + a i −1 vi −1 + a i +1 vi +1 + . . . + a k vk .
For example the vectors (1, 0, 1), (1, 1, 1) ∈ S 2 are linearly independent.
One can define the row (column) rank of a matrix as the maximum number of linearly in-
dependent 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 Exer-
cise 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).
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 k×n 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.
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 indepen-
dent 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.
As examples, the linear subspace S 1 in (2.1) has as one of its generator matrices
, -
G1 = 1 1 1
Further, the linear subspace S 2 in (2.2) has G 2 as one of its generator matrices and has the fol-
lowing 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,
• 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 .
d = min w t (c).
c∈C ,
c'=0
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 num-
ber 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 corre-
sponding 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 t
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 t j
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 ).
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 .
r
In other words, the general [2r −1, 2r −r −1]2 Hamming code is the code {c ∈ {0, 1}2 −1
|Hr ·cT =
0}.
Next we argue that the above Hamming code has distance 3 (in Proposition 1.5.1 we argued
this for r = 3).
46
Proposition 2.4.1. The Hamming code [2r − 1, 2r − r − 1, 3]2 has distance 3.
j
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 trivial [n, 1, n]2 codes for odd n (which have 0n and 1n as the only codewords): see
Exercise 2.21.
47
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:
We’ll 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 con-
sider 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 consid-
ered 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 appro-
priate 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 ?
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
1: IF y ∈ C H ,r THEN
2: RETURN y
3: FOR i = 1 . . . n DO
4: y( ← y + ei # ei is the i th standard vector
5: IF y( ∈ C H ,r THEN
6: 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
1: FOR i = 0 . . . t DO
2: FOR S ⊆ [n] such that |S| = i DO
3: FOR z ∈ Fnq such that w t (zS ) = w t (z) = i DO
4: IF y − z ∈ C THEN
5: RETURN y − z
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 ,
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.
1: b ← Hr · yT .
2: Let i ∈ [n] be the number whose binary representation is b
3: IF y − ei ∈ C H THEN
4: RETURN y − ei
5: RETURN 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, de-
coding can be performed in time O(n log n).
50
Proposition 2.7.1. C Si m,r and C H ad ,r both have a distance of 2r −1 .
Proof. We first show the result for C H ad ,r . In fact, we will show something stronger: every non-
zero codeword in C H ad ,r has weight exactly equal to 2r −1 (the claimed distance follows from
Proposition 2.3.4). Consider a message x '= 0. Let its i th entry be x i = 1. x is encoded as
r
c = (x 1 , x 2 , . . . , x r )(Hr0 , Hr1 , . . . , Hr2 −1
),
j
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,
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 = .
i =0 x −1
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 equa-
tions 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):
1. (Warm-up) Convince yourself that the above problem can be stated as A · xT = bT , where
A is an m × n matrix over Fq , x ∈ Fnq and b ∈ Fm
q .
2. (Upper Triangular Matrix) Assume n = m and that A is upper triangular, i.e. all diagonal
elements (a i ,i ) are non-zero and all lower triangular elements (a i , j , i > j ) are 0. Then
present an O(n 2 ) time7 algorithm to compute the unknown vector x.
3. (Gaussian Elimination) Assume that A has full rank (or equivalently a rank of n.)
(a) Prove that the following algorithm due to Gauss converts A into an upper triangular
matrix. By permuting the columns if necessary make sure that a 1,1 '= 0. (Why can
a
one assume w.l.o.g. that this can be done?) Multiply all rows 1 < i ≤ n with a1,1 and
i ,1
then subtract a 1, j from the (i , j )th entry 1 ≤ j ≤ n. Recurse with the same algorithm
on the (n −1)×(n −1) matrix A ( obtained by removing the first row and column from
A. (Stop when n = 1.)
(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 n−m 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 n−m 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 k−1 .
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
1Pr x i = 0 − Pr x i = 1 1 ≤ ε.
1 i ∈I i ∈I
1
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
4, an [n,
- k], 2 code
- such
5 that all non-zero codewords have Hamming weight in the
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" proce-
dure.
(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 par-
ity 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 submatri-
ces: 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
2. Argue that C 1 7C 2 is an [2n, k 1 + k 2 , d = min(2d 1 , d 2 )]q code.
3. Assume there exists algorithms Ai for code C i for i ∈ [2] such that: (i) A1 can decode from
e errors and s erasures such that 2e +s < d 1 and (ii) A2 can decode from 8(d 2 −1)/29 errors.
Then argue that one can correct 8(d − 1)/29 errors for C 1 7C 2 .
Hint: Given a received word (y1 , y2 ) ∈ Fnq × Fnq , first apply A2 on y2 − y1 . Then create an
intermediate received word for A1 .
4. We will now consider a recursive construction of a binary linear code that uses the 7 op-
erator. For integers 0 ≤ r ≤ m, we define the code C (r, m) as follows:
• C (r, r ) = Fr2 and C (0, r ) is the code with only two codewords: the all ones and all
zeroes vector in Fr2 .
• For 1 < r < m, C (r, m) = C (r, m − 1) 7C (r − 1, m − 1).
In this problem we will derive the parameters of the code. Define the generalized Hamming
code C H ,r,q to be the linear code whose parity check matrix is H q,r . Argue that
q r −1
1. The block length of C H ,r,q is n = q−1 .
55
Exercise 2.20. Design the best 6-ary code (family) with distance 3 that you can.
Exercise 2.30. Given a code C a puncturing of C is another code C ( where the same set of po-
sitions 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 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
2.9 Bibliographic Notes
Finite fields are also called Galois fields (another common notation for Fq is GF (q)), named
after Évariste Galois, whose worked laid the foundations of their theory. (Galois led an extremely
short and interesting life, which ended in death from a duel.) For a more thorough treatment
refer to any standard text on algebra or the book on finite fields by Lidl and Niederreiter [51].
The answer to Question 1.7.1 was proved by van Lint [72] and Tietavainen [71].
57
Chapter 3
In the first half of this chapter, we will develop techniques that will allow us to answer questions
such as
We note that the answer to the above question is trivially yes: just pick the generator matrix
to be the 2 × 2 identity matrix. However, we will use the above as a simple example to illustrate
a powerful technique called the probabilistic method. The probabilistic method [1] was cham-
pioned by Erdős. Interestingly, Shannon was one of the very early adopters of probabilistic
method (and we will see one such use in Chapter 6).
As the name suggests, the method uses probability. Before we talk more about the proba-
bilistic method, we do a quick review of the basics of probability that we will need in this book.
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
U D (x) = for every x ∈ D.
|D|
49
G U (G) V00 V01 V10 V11 G U (G) V00 V01 V10 V11
" # " #
0 0 1 1 0 1
16
0 0 0 0 16
0 0 1 1
0 0 0 0
" # " #
0 0 1 1 0 1
16 0 1 0 1 16 0 1 1 2
0 1 0 1
" # " #
0 0 1 1 0 1
16 0 1 0 1 16 0 1 1 0
1 0 1 0
" # " #
0 0 1 1 0 1
16 0 2 0 2 16 0 2 1 1
1 1 1 1
" # " #
0 1 1 1 1 1
16 0 0 1 1 16 0 0 2 2
0 0 0 0
" # " #
0 1 1 1 1 1
16
0 1 1 0 16
0 1 2 1
0 1 0 1
" # " #
0 1 1 1 1 1
16 0 1 1 2 16 0 1 2 1
1 0 1 0
" # " #
0 1 1 1 1 1
16 0 2 1 1 16 0 2 2 0
1 1 1 1
Typically we will drop the subscript when the domain D is clear from the context.
For example, consider the domain D = F22×2 , i.e. the set of all 2 × 2 matrices over F2 . (Note
that each such matrix is a generator matrix of some [2, 2]2 code.) The first two columns of Ta-
ble 3.1 list the elements of this D along with the corresponding probabilities for the uniform
distribution.
Typically, we will be interested in a real-valued function defined on D and how it behaves
under a probability distribution defined over D. This is captured by the notion of a random
variable:
Definition 3.1.2 (Random Variable). Let D be a finite domain and I ⊂ R be a finite1 subset. Let
p be a probability distribution defined over D. A random variable is a function:
V : D → I.
50
In this book, we will mainly consider binary random variables, i.e., with I = {0, 1}. In partic-
ular, given a predicate or event E over D, we will define its indicator variable 1E to be 1 if E is
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 · = (3.1)
16 4
& ' 1 1
E 1V10 =0 = 4 · = (3.2)
16 4
& ' 1 1
E 1V11 =0 = 4 · = (3.3)
16 4
E [1E ] = Pr [E is true] .
Next, we state a simple yet useful property of expectation of a sum of random variables:
Proposition 3.1.2 (Linearity of Expectation). Given random variables V1 , . . . ,Vm defined over the
same domain D and with the same probability distribution p, we have
( )
m
! !m
E Vi = E [Vi ] .
i =1 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.
51
As an example, we have
& ' 3
E 1V01 =0 + 1V10 =0 + 1V11 =0 = (3.8)
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:
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 (m·G) =
0. Thus, the union bound implies (that under the uniform distribution over F2×2 2 )
& ' 3
Pr There exists an m ∈ {0, 1}2 \ {(0, 0)}, such that w t (mG) = 0 ≤ . (3.12)
4
Finally, we present two bounds on the probability of a random variable deviating signifi-
cantly 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,
E[V ]
Pr[V ≥ t ] ≤ .
t
In particular, for any a ≥ 1,
1
Pr[V ≥ a · E[V ]] ≤ .
a
52
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 ] (3.14)
i ≥t
!
≥t· Pr[V = i ] (3.15)
i ≥t
= t · Pr[V ≥ t ]. (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
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. (We’ll come to a related comment shortly.)
Another related concept that we will use is that of probability of an event happening condi-
tioned 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 and B ]
Pr[A|B ] = .
Pr[B ]
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 ].
53
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
2
E(X )/3
Pr [|X − E(X )| > εE(X )] < e −ε ,
and the additive Chernoff bound states that
2
m/2
Pr [|X − E(X )| > εm] < e −ε .
We omit the proof, which can be found in any standard textbook on randomized algorithms.
(See e.g. [7].)
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 (the proof is left as an exercise).
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 ran-
dom 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 k−1 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 k−1 times, which proves our claim.
54
3.2 The Probabilistic Method
The probabilistic method is a very powerful method in combinatorics which can be used to
show the existence of objects that satisfy certain properties. (For more, see the book by Alon
and Spencer [1].) In this course, we will use the probabilistic method to prove existence of a
code C with certain property P . Towards that end, we define a distribution D over all possible
codes and prove that when C is chosen according to D:
& ' & '
Pr C has property P > 0 or equivalently Pr C doesn’t have property P < 1.
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 F22×2 . Then by Proposition 2.3.4 and (3.12), we get that
3
Pr [There is no [2, 2, 1]2 code] ≤ < 1,
U F2×2 4
2
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 doesn’t have property P i = Pr P i < .
m
2
& '
Finally, by the union bound, the above will prove that Pr C doesn’t 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 doesn’t 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 (the argument is left as an exercise) 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.
55
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
0.9 q=4
0.8
0.7
0.6
Hq(x) --->
0.5
0.4
0.3
0.2
0.1
0
0 0.2 0.4 0.6 0.8 1
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 = 1−1/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 Shannon’s 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.
56
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:
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)n−i (3.17)
i =0 i
* + * +
pn n
! n i n−i
! n i
= p (1 − p) + p (1 − p)n−i
i =0 i i =pn+1 i
* +
pn
! n i
≥ p (1 − p)n−i (3.18)
i =0 i
* + " #
pn
! n i p i
= (q − 1) (1 − p)n−i
i =0 i q − 1
* + " #i
pn
! n i n p
= (q − 1) (1 − p)
i =0 i (q − 1)(1 − p)
* + " #pn
pn
! n i n p
≥ (q − 1) (1 − p) (3.19)
i =0 i (q − 1)(1 − p)
* + " #
pn
! n p pn
= (q − 1)i (1 − p)(1−p)n (3.20)
i =0 i q − 1
≥ V ol q (pn, n)q −Hq (p)n . (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 (q−1)(1−p) ≤ 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 = q−1 (1 − p)(1−p)n .
(3.21) implies that
1 ≥ V ol q (pn, n)q −Hq (p)n ,
which proves (i).
3 p p q−1 q−1
Indeed, note that (q−1)(1−p) ≤ 1 is true if 1−p ≤ 1 , which in turn is true if p ≤ q , where the last step follows
from the following fact: for positive a, b, c, d , we have ba ≤ dc if and only if a+b
a c
≤ c+d .
57
We now turn to the proof of part (ii). For this part, we will need Stirling’s approximation for
n!
/ 0 n 1n / 0 n 1n
2πn e λ1 (n) < n! < 2πn e λ2 (n) ,
e e
where
1 1
and λ2 (n) =
λ1 (n) = .
12n + 1 12n
By the Stirling’s approximation, we have the following inequality:
* +
n n!
=
pn (pn)!((1 − p)n)!
(n/e)n 1
> ·2 · e λ1 (n)−λ2 (pn)−λ2 ((1−p)n)
(pn/e)pn ((1 − p)n/e)(1−p)n 2πp(1 − p)n
1
= · $(n), (3.22)
p pn (1 − p)(1−p)n
λ1 (n)−λ2 (pn)−λ2 ((1−p)n)
where $(n) = e / .
2πp(1−p)n
Now consider the following sequence of relations that complete the proof:
* +
n
V ol q (pn, n) ≥ (q − 1)pn (3.23)
pn
(q − 1)pn
> · $(n) (3.24)
p pn (1 − p)(1−p)n
≥ q Hq (p)n−o(n) . (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 parame-
ters.
Proposition 3.3.2. For small enough ε, 1 − H q (ρ) ≥ 1 − ρ − ε for every 0 < ρ ≤ 1 − 1/q if and only
if q is 2Ω(1/ε) .
58
Now if q ≥ 21/ε , we get that
H q (ρ) ≤ ρ + ε.
as logq (q − 1) ≤ 1 and H (ρ) ≤ 1. Thus, we have argued that for q ≥ 21/ε , we have 1 − H q (ρ) ≥
1 − ρ − ε, as desired.
Next, we consider the case when q = 2o(1/ε) . We begin by claiming that for small enough ε,
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−1
m−1 1
q ≥ 1+ , (3.26)
q −1
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
log(q − 1) 1
H q (ρ) = ρ · + H (x) · .
log q log q
59
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)
ρ ρ
H (1 − 1/q)
≥ log(q − 1)m − log(q m − 1) + (m − 1) (3.27)
1 − 1/q
" #
m m q log q
= log(q − 1) − log(q − 1) + (m − 1) log +
q −1 q −1
" " # #
(q − 1)m q m−1 m−1
= log · · q q−1
qm − 1 q −1
* m−1 +
(q − 1) · q m−1 · q q−1
= log
qm − 1
≥0 (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
m−1
(q − 1) · q q−1 ≥ q.
Since (1+1/x)x ≤ e, we also have that (3.26) is also satisfied for m ≥ 1+ ln1q . Further, we note
that (3.26) is satisfied for every m ≥ 2 (for any q ≥ 2), which leads to the following:
Corollary 3.3.4. Let q ≥ 2 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.
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
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 ρ.
60
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
" " ## " # " #
1 εq 1 1 − (εq)/(q − 1)
= − logq 1− + + ε 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 " #"
2 1 εq ε q 1 εq
= 1 + o(ε ) − − − 2
− +ε −
ln q q − 1 2(q − 1) q q −1
2 2 2 2 #4
ε q ε q
− 2
− εq + (3.29)
2(q − 1) 2
ε2 q 2
3
2 1 εq
= 1 + o(ε ) − − −
ln q q − 1 2(q − 1)2
εq 2 ε2 q 3 (q − 2)
" #" #4
1
− +ε − +
q q −1 2(q − 1)2
ε2 q 2 ε2 q 2 ε2 q 2 (q − 2)
3 4
2 1
= 1 + o(ε ) − − + − (3.30)
ln q 2(q − 1)2 q − 1 2(q − 1)2
ε2 q 2
= 1− + o(ε2 )
2 ln q(q − 1)
ε2 q 2
≤ 1−
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 − . . . 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.
Proof. By definition
61
Further, by the fact that ln(1−x) = −x −x 2 /2−x 3 /3!+· · · for any 0 < x < 1, (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 ε
We will also work with the inverse of the q-ary entropy function. Note that H q (·) on the
domain [0, 1−1/q] is an bijective map into [0, 1]. Thus, we define H q−1 (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,
Proof. It is easy to check that H q−1 (y) is a strictly increasing convex function in the range y ∈
[0, 1]. This implies that the derivative of H q−1 (y) increases with y. In particular, (H q−1 )0 (1) ≥
(H q−1 )0 (y) for every 0 ≤ y ≤ 1. In other words, for every 0 < y ≤ 1, and (small enough) δ > 0,
H q−1 (y)−H q−1 (y−δ) H q−1 (1)−H q−1 (1−δ)
δ ≤ δ . Proposition 3.3.5 along with the facts that H q−1 (1) = 1 − 1/q
and H q−1 is increasing completes the proof if one picks c q0 = max(1, 1/c q ) and δ = ε2 /c q0 .
62
Chapter 4
In this chapter, we will try to tackle Question 2.5.1. We will approach this trade-off in the fol-
lowing 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).
65
1
Hamming bound
GV bound
0.9
0.8
0.7
0.6
0.5
R
0.4
0.3
0.2
0.1
0
0 0.2 0.4 0.6 0.8 1
δ
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.
Theorem 4.2.1 (Gilbert-Varshamov Bound). Let q ≥ 2. For every 0 ≤ δ < 1 − q1 , and 0 < ε ≤
1 − H q (δ), there exists a code with rate R ≥ 1 − H q (δ) − ε and relative distance δ.
The above result was proved for general codes by Edgar Gilbert ([15]) and for linear codes by
Rom Varshamov ([57]). Hence, the bound is called the Gilbert-Varshamov bound. The bound
is generally referred to as the GV bound. For a pictorial description of the GV bound for binary
codes, see Figure 4.1. We will present the two proofs in Sections 4.2.1 and 4.2.2 respectively.
66
Algorithm 5 Gilbert’s Greedy Code Construction
I NPUT: n, q, d
O UTPUT: A code C ⊆ [q]n of distance d
1: C ← &
2: WHILE there exists a v ∈ [q]n such that ∆(v, c) ≥ d for every c ∈ C DO
3: Add v to C
4: RETURN C
c3
c2
c5
c1
c4
d −1
[q]n
Figure 4.2: An illustration of Gilbert’s greedy algorithm (Algorithm 5) for the first five iterations.
distance of C fall below d . For the former claim, note that, if we cannot add v at some point, we
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, it’ll 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
)
B (c, d − 1) ⊇ [q]n .
c∈C
This is because if not, then there exists a vector v ∈ [q]n \C , such that ∆(v, c) ≥ d and hence v can
67
be added to C . However, this contradicts the fact that Algorithm 5 has terminated. Therefore,
)
| B (c, d − 1)| ≥ q n . (4.1)
c∈C
qn
|C | ≥
V ol q (d − 1, n)
qn
≥ (4.2)
q nHq (δ)
= q n(1−Hq (δ)) ,
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 Gilbert’s construction 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 Gilbert construc-
tion achieves?
Varshamov answered the question in the affirmative. Next, we will consider Varhsmov’s
construction.
68
4.2.2 Varshamov Construction
Now we turn to the result due to Varshamov who showed that a random linear code, with high
probability, lies on the GV bound. The Varshamov construction is a use of the probabilistic
method (Section 3.2).
By Proposition 2.3.4, we are done if we can show that there exists a k ×n matrix G of full rank
(for k = (1 − H q (δ) − ε)n) such that
We will prove the existence of such a G by the probabilistic method. Pick a random linear code
by picking a random k × n matrix G where each of kn entries is chosen uniformly and indepen-
dently at random from Fq . Fix m ∈ Fkq \ {0}. Recall that by Lemma 3.1.8, for a random G, mG is a
uniformly random vector from Fnq . Thus, we have
V ol q (d − 1, n)
P r [w t (mG) < d ] =
qn
q nHq (δ)
≤ (4.4)
qn
where (4.4) follows from (4.3). Thus, by the union bound (Lemma 3.1.3)
where the equality follows by choosing k = (1− H q (δ)−ε)n. Since q −εn + 1, by the probabilistic
method, there exists a linear code C with relative distance δ.
All that’s left is to argue that the code C has dimension at least k = (1 − H q (δ) − ε)n. To show
this we need to show that the chosen generator matrix G has full rank. Note that there is a non-
zero probability that a uniformly matrix G does not have full rank. There are two ways to deal
with this. First, we can show that with high probability a random G does have full rank, so that
|C | = q k . However, the proof above has already shown that, with high probability, the distance
is greater than zero, which implies that distinct messages will be mapped to distinct codewords
and thus |C | = q k . In other words, C does indeed have dimension k, as desired
Discussion. We now digress a bit to discuss some consequences of the proofs of the GV bound.
We first note that Varshamov’s proof shows something stronger than Theorem 4.2.1: most
linear codes (with appropriate parameters) meet the Gilbert-Varshamov bound.
Varshamov’s original proof actually picks a random linear code by picking a random (n −
k) × n parity check matrix. We leave it as exercise to work out the details.
Finally, we note that Theorem 4.2.1 requires δ < 1 − q1 . An inspection of Gilbert and Var-
shamov’s proofs shows that the only reason the proof required that δ ≤ 1 − q1 was because it is
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,
69
c1
c2
ci c,i
cj c,i
cM
n −d +1 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 ?
k ≤ n − d + 1.
Proof. Let c1 , c2 , . . . , cM be the codewords of an (n, k, d )q code C . Note that we need to show
M ≤ q n−d +1 . To this end, we define c,i to be the prefix of the codeword ci of length n − d + 1 for
every i ∈ [M ]. See Figure 4.3 for a pictorial description.
We now claim that for every i -= j , c,i -= c,j . For the sake of contradiction, assume that there
exits an i -= j such that c,i = c,j . Note that this implies that ci and c j agree in all the first n −
d + 1 positions, which in turn implies that ∆(ci , c j ) ≤ d − 1. This contradicts the fact that C has
distance d . Thus, M is the number of prefixes of codewords in C of length n − d + 1, which
implies that M ≤ q n−d +1 as desired.
70
1
Hamming bound
GV bound
Singleton bound
0.8
0.6
R
0.4
0.2
0
0 0.2 0.4 0.6 0.8 1
δ
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 Fig-
ure 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 Reed-
Solomon 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?
71
Theorem 4.4.1 (Plotkin bound). The following holds for any C ⊆ [q]n with distance d :
1. If d = (1 − q1 )n, |C | ≤ 2qn.
qd
2. If d > (1 − q1 )n, |C | ≤ qd −(q−1)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, which is tight. (The
proof is left as an exercise.) Second, it can be shown that this bound is tight– this again is left as
an exercise. (Hint: Consider the code obtained by adding the “complement" of each codeword
in the Hadamard code to the Hadamard code.) 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 − q−1 δ + o(1).
Define d = δn. For all x, C x has distance d as C has distance d .1 Additionally, it has block length
q
n , < ( q−1 )d and thus, d > (1 − q1 )n , . By Theorem 4.4.1, this implies that
qd
|C x | ≤ ≤ qd , (4.5)
qd − (q − 1)n ,
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 | = |C x |,
,
x∈[q]n−n
72
1
Hamming bound
GV bound
Singleton bound
Plotkin bound
0.8
0.6
R
0.4
0.2
0
0 0.2 0.4 0.6 0.8 1
δ
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 till date. For larger (but still constant) values of q, better upper
bounds than the GV bound are known. In particular, for any prime power q ≥ 49, there exist
linear codes, called algebraic geometric (or AG) codes that outperform the corresponding GV
bound2 . AG codes out of the scope of this book. One starting point could be the following [32].
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 defini-
n
, a vector v in R , that is, a tuple of n real numbers. This vector has (Euclidean)
tions. Consider
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.
73
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ε .3
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.
Lemma 4.4.4 (Mapping Lemma). Let C ⊆ [q]n . Then there exists a function f : C −→ Rnq such
that
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 ,
% ( % (
- . q ∆(ci , c j ) 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 .
(q−1)n - .
For part 1, if d = (1 − q1 )n = q , then for all i -= j , f (ci ), f (c j ) ≤ 0 and so by the first part
of Lemma 4.4.3, m!≤ 2nq, $ as desired.
q−1 q qd −(q−1)n
For part 2, d > q n and so for all i -= j , 〈 f (ci ), f (c j )〉 ≤ 1−( q−1 ) dn = −( (q−1)n ) and, since
def qd −(q−1)n (q−1)n
ε = ( (q−1)n ) > 0, we can apply the second part of Lemma 4.4.3. Thus, m ≤ 1 + qd −(q−1)n =
qd
qd −(q−1)n
, as desired !
Proof of Lemma 4.4.3. We begin with a proof of the first result. The proof is by induction on
n. Note that in the base case of n = 0, we have m = 0, which satisfies the claimed inequality
m ≤ 2n.
In the general case, we have m ≥ 1 non-zero vectors v1 , . . . , vm ∈ Rn such that for every i -= j ,
〈vi , v j 〉 ≤ 0. (4.6)
Since rotating, translating and scaling all the vectors by the same amount does not change
the sign of the inner product, w.l.o.g. we can assume that vm = 〈1, 0, . . . , 0〉. (The formal proof of
3
Note that since
v i and
v v j are both unit vectors, 〈
v i , v j 〉 is the cosine of the angle between them.
74
this claim is left as an exercise.) 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 〉 = 1 · αi + m
i =2 0 = αi . However, note that (4.6)
implies that 〈v1 , vi 〉 ≤ 0, which in turn implies that
αi ≤ 0. (4.7)
Next, we claim that at most one of y1 , . . . , ym−1 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 , . . . , vm−2 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 m −2 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:
/ 0
*m * m
.z.2 = .vi .2 + 2 〈vi , v j 〉 ≤ m + 2 · · (−ε) = m(1 − εm + ε).
i =1 i<j 2
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.
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
1 6
1 1 −(q − 1) 1
φ(i ) = , ,..., ,... .
q q q q
2 34 5
i th position
75
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.
Next, we record two properties of φ that follow immediately from its definition. For every
i ∈ [q],
(q − 1) (q − 1)2 (q − 1)
φ(i )2 = + = . (4.8)
q2 q2 q
Also for every i -= j ∈ [q],
(q − 2) 2(q − 1) 1
〈φ(i ), φ( j )〉 = 2
− 2
=− . (4.9)
q q q
We are now ready to define our final map f : C → Rnq . For every c = (c 1 , . . . , c n ) ∈ C , define
7
q 8 9
f (c) = · φ(c 1 ), φ(c 2 ), . . . , φ(c n ) .
n(q − 1)
,
q
(The multiplicative factor n(q−1) is to ensure that f (c) for any c ∈ C is a unit vector.)
To complete the proof, we will show that f satisfies the claimed properties. We begin with
condition 1. Note that
q *n
2
. f (c). = · .φ(i ).2 = 1,
(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
: ; % (
* - . * - . q
= φ(x % ), φ(y % ) + φ(x % ), φ(y % ) ·
%:x % -= y % %:x % =y % n(q − 1)
: % ( (; %
% (
* −1 * q −1 q
= + · (4.10)
%:x % -= y % q %:x % =y % q n(q − 1)
< % ( % (= % (
−1 q −1 q
= ∆(c1 , c2 ) + (n − ∆(c1 , c2 )) · (4.11)
q q n(q − 1)
% (< =
q 1 q −1
= 1 − ∆(c1 , c2 ) +
n(q − 1) q q
% (% (
q ∆(c1 , c2 )
= 1− ,
q −1 n
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. !
76
Chapter 5
In this chapter, we will study a code invented by Irving Reed and Gus Solomon [46]. Not surpris-
ingly, 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 un-
known/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.
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 ).
Addition:
max(deg(P
"),deg(Q))
P (X ) +Q(X ) = (p i + q i )X i ,
i =0
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: # $
deg(P )+deg(Q)
" min(i"
,deg(P ))
P (X ) · Q(X ) = p j · qi − j X i ,
i =0 j =0
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.
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.
• 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:
79
Algorithm 6 Generating Irreducible Polynomial
I NPUT: Prime power q and an integer s > 1
O UTPUT: A monic irreducible polynomial of degree s over Fq
1: b ← 0
2: WHILE b = 0 DO
!
3: P (X ) ← X s + is−1 i
=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 )
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).
Definition 5.2.1 (Reed-Solomon code). Let Fq be a finite field. Let α1 , α2 , ...αn be distinct el-
ements (also called evaluation points) from Fq and choose n and k such that k ≤ n ≤ q. We
define an encoding function for Reed-Solomon code as RS : Fkq → Fnq as follows. A message
m = (m 0 , m 1 , ..., m k−1 ) with m i ∈ Fq is mapped to a degree k − 1 polynomial.
m *→ f m (X ),
where
k−1
"
f m (X ) = mi X i . (5.1)
i =0
6
Such results are known in general if one is happy with polynomial dependence on q instead of log q.
80
Note that f m (X ) ∈ Fq [X ] is a polynomial of degree at most k − 1. The encoding of m is the
evaluation of f m (X ) at all the αi ’s :
' (
RS(m) = f m (α1 ), f m (α2 ), ..., f m (αn )
We call this image Reed-Solomon code or RS code. A common special case is n = q − 1 with the
def
set of evaluation points being F∗ = F \ {0}.
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 mes-
sages 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 burst-
errors 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.
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,
RS(m1 ) + RS(m2 ) = RS(m1 + m2 )
aRS(m1 ) = RS(am1 ).
Therefore RS is a [n, k]q linear code.
Claim 5.2.2. RS is a [n, k, n − k + 1]q code. That is, it matches the Singleton bound.
The claim on the distance follows from the fact that every non-zero polynomial of degree
k − 1 over Fq [X ] has at most k − 1 (not necessarily distinct) roots, and that if two polynomials
agree on more than k − 1 places then they must be the same polynomial.
81
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.
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,
82
Let us now find a generator matrix for RS codes (which exists by Claim 5.2.1). By Defi-
nition 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 k−1 . 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
2
α22 · · · α2j · · · α2n
α1
.. .. .. .. .. ..
. . . . . .
i i i
α
1 α2 · · · α j · · · αin
. . . . . .
.. .. .. .. .. ..
k−1 k−1 k−1 k−1
α1 α2 · · · αj · · · αn
The class of codes that match the Singleton bound have their own name, which we define
and study next.
Definition 5.3.2. For any subset of indices S ⊆ [n] of size exactly k and a code C ⊆ Σn , C S is the
set of all codewords in C projected onto the indices in S.
MDS codes have the following nice property which we shall prove for the special case of Reed-
Solomon codes first and subsequently for the general case as well.
Proposition 5.3.1. Let C ⊆ Σn of integral dimension k be an MDS code, then for all S ⊆ [n] such
that |S| = k, we have |C S | = Σk .
Before proving Proposition 5.3.1 in its full generality, we present its proof for the special case of
Reed-Solomon codes.
Consider any S ⊆ [n] of size k and fix an arbitrary v = (v 1 , . . . , v k ) ∈ Fkq , we need to show that
there exists a codeword c ∈ RS (assume that the RS code evaluates polynomials of degree at
most k − 1 over α1 , . . . , αn ⊆ Fq ) such that cS = v. Consider a generic degree k − 1 polynomial
!
P (X ) = k−1 i
i =0 p i X . Thus, we need to show that there exists P (X ) such that P (αi ) = v i for all i ∈
83
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
α αi αk v2
1
' ( 2 2 2
p 0 p 1 · · · p k−1 α1 αi αk = v 3
. .. .. ..
.
. . . .
α1k−1 αk−1
i
αk−1
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 k−1 ). This completes the proof for Reed-
Solomon 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
Chapter 6
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 “re-
ceiver" 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 pro-
cess. 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.
• (Noisy Channel) This type of channel introduces errors during transmission, which results
in an incorrect reception of the transmitted signal by the receiver. Redundancy is added
at the transmitter to increase reliability of the transmitted data. The redundancy is taken
off at the receiver. This process is termed as Channel Coding.
• (Noise-free Channel) As the name suggests, this channel does not introduce any type of
error in transmission. Redundancy in source data is used to compress the source data at
the transmitter. The data is decompressed at the receiver. The process is popularly known
as Source Coding.
1
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 con-
cepts we discussed above.
Source Channel
Message
Encoder Encoder
Channel
Source Channel
(Decoded) Message
Decoder Decoder
In Figure 6.1, source coding and channel coding are coupled. In general, to get the optimal
performance, it makes sense to design both the source and channel coding schemes simultane-
ously. However, Shannon’s source coding theorem allows us to decouple both these parts of the
communication setup and study each of these parts separately. Intuitively, this makes sense:
if one can have reliable communication over the channel using channel coding, then for the
source coding the channel effectively has no noise.
For source coding, Shannon proved a theorem that precisely identifies the amount by which
the message can be compressed: this amount is related to the “entropy" of the message. We will
however, not talk about source coding in in this book. From now on, we will exclusively focus on
the channel coding part of the communication setup. Note that one aspect of channel coding
is how we model the channel noise. So far we have seen Hamming’s worst case noise model in
some detail. Next, we will study some specific stochastic channels.
X ! x → channel → y ∈ Y
The channels considered by Shannon are also memoryless, that is, noise acts independently
on each transmitted symbol. In this book, we will only study discrete channels where both the
alphabets X and Y are finite. For the sake of variety, we will define one channel that is contin-
uous, though we will not study it in any detail later on.
The final piece in specification of a channel is the transition matrix M that governs the pro-
cess of how the channel introduces error. In particular, the channel is described in form of a
86
matrix with entries as cross over probability over all combination of the input and output al-
phabets. 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.
..
.
M=
· · · Pr(y|x) · · ·
..
.
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 nat-
urally 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.
1−p
0 0
p
p
1 1
1−p
In other words, every bit is flipped with probability p. We claim that we need to only con-
sider the case when p ≤ 21 (i.e. if we know how to ensure reliable communication over BSCp for
p ≤ 21 , then we can also handle the case of p > 12 ). The proof of this claim is left as an exercise.
q-ary Symmetric Channel (qSC). We now look at the generalization of BSCp to alphabets of
size q ≥ 2. Let 0 ≤ p ≤ 1 − q1 . (As with the case of BSCp , we leave the argument that allows us
to assume p ≤ 1 − 1/q as an exercise.) The q-ary Symmetric Channel with crossover probability
p, or qSC p is defined as follows. X = Y = [q]. The transition matrix M for qSCp is defined as
follows. '
1 − p if y = x
M (x, y) = p
q−1 if y (= x
In other words, every symbol is retained as it at the output with probability 1−p and is distorted
to each of the q − 1 possible different symbols with equal probability of p/(q − 1).
Binary Erasure Channel (BEC) In the previous two examples that we saw, X = Y . However
this might not always be the case.
87
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:
1−α
0 0
α
?
α
1 1
1−α
In Figure 6.3 any missing edge represents a transition that occurs with 0 probability. Further,
every bit in BECα is erased with probability α (and is left unchanged with probability 1 − α).
Binary Input Additive Gaussian White Noise Channel (BIAGWN). We now look at a channel
that is continuous. Let σ ≥ 0. The Binary Input Additive Gaussian White Noise Channel with
standard deviation σ or BIAGWNσ is defined as follows. X = {−1, 1} and Y = R. The noise is
modeled by continuous Gaussian probability distribution function. The Gaussian distribution
has lots of nice properties and is a popular choice for modeling noise continuous in nature.
Given (x, y) ∈ {−1, 1} × R, the noise y − x is distributed according to the Gaussian distribution of
mean of zero and standard deviation of σ. In other words,
(y − x)2
* * ++
( ) 1
Pr y | x = ) · exp −
σ 2π 2σ2
88
6.2.2 Shannon’s General Theorem
Recall that the big question that we are interested in this book is the tradeoff between the rate
of the code and the fraction of errors that can be corrected. For stochastic noise models that
we have seen, it is natural to think of the fraction of errors to be the parameter that governs the
amount of error that is introduced by the channel. For example, for BSCp , we will think of p as
the fraction of errors.
Shannon’s remarkable theorem on channel coding was to precisely identify when reliable
transmission is possible over the stochastic noise models that he considered. In particular, for
the general framework of noise models, Shannon defined the notion of capacity, which is a
real number such that reliable communication is possible if and only if the rate is less than the
capacity of the channel. In other words, given a noisy channel with capacity C , if information is
transmitted at rate R for any R < C , then there exists a coding scheme that guarantees negligible
probability of miscommunication. On the other hand if R > C , then regardless of the chosen
coding scheme there will be some message for which the decoding error probability is bounded
from below by some constant.
In this chapter, we are going to state (and prove) Shannon’s general result for the special case
of BSCp .
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] ≥ .
e∼BSCp 2
Note that Theorem 6.3.1 implies that the capacity of BSCp is 1−H (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 ap-
pears 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,
(We will set γ > 0 in terms of ε and p at the end of the proof.) See Figure 6.3.1 for an illustra-
tion. 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.
(6.1) and (6.2) along with the union bound (Proposition 3.1.3) imply the following:
1 2
Pr [E (m) + e (∈ D m ∩ S m ] ≤ + 2−Ω(γ n) .
2
1 2 1
Pr [E (m) + e ∈ D m ∩ S m ] ≥ − 2−Ω(γ n) ≥ , (6.3)
2 4
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 = max p d (1 − p)n−d .
y∈S m d ∈[(1−γ)pn,(1+γ)pn]
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)n−d is decreasing in d for p ≤ 1/2. (Indeed p d (1 − p)n−d = (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
* +γpn * +γpn
(1−γ)pn 1−p (1−p)n 1−p
p max = p (1 − p) n−(1−γ)pn
= ·p pn
(1 − p) = 2−nH (p) .
p p
91
Thus, we have shown that
* +γpn
1−p
Pr [E (m) + e ∈ D m ∩ S m ] ≤ |D m ∩ S m | · 2−nH (p) ,
p
In the above, (6.5) follows from the fact that for m1 (= m2 , D m1 and D m2 are disjoint. (6.6) follows
ε3
from (6.4). (6.7) follows for large enough n and if we pick γ = 1
4 . (Note that as 0 < p <
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 The-
orem 6.3.1 is complete.
Remark 6.3.1. It can be verified that the proof above can also work if the decoding error prob-
ability is bounded by 1 − 2−βn (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 1) For any arbitrary m ∈ {0, 1}k , we will show that for a random choice of E, the prob-
ability of failure, over BSCp noise, is small. This implies the existence of a good encoding
function for any arbitrary message.
92
• (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:
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 pic-
torial proof of Step 1. We begin by fixing m ∈ {0, 1}k . In Step 1, we need to estimate the following
quantity:
5 6
EE Pr [D (E (m) + e) (= m] .
e∼BSCp
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 = ≈ ,
e∼BSCp 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 Shannon’s capac-
ity theorem for the BSC (Theorem 6.3.1) by breaking up the quantity into two sums:
93
(p + ε/ )n
E (m/ ) E (m)
y
(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 Shannon’s capacity theorem for the BSC.
2 0 1
Pr [D (E (m) + e) (= m] = Pr y|E (m) · 1D(y)(=m
e∼BSCp y∈B (E (m),(p+ε/ )n)
2 0 1
+ Pr y|E (m) · 1D(y)(=m ,
y(∈B (E (m),(p+ε/ )n)
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 .
e∼BSCp y∈B (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
5 6 7 8
/2 2 0 1
EE Pr [D (E (m) + e) (= m] ≤ e −ε n/2 + Pr y|E (m) · EE 1D (y)(=m . (6.8)
e∼BSCp e∼BSCp
y∈B (E (m),(p+ε/ )n )
In the above we used linearity of expectation (Proposition 3.1.2) and the fact that the distribu-
tions on e and E are independent.
Next, for a fixed received
0 word
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
0 1 0 1 2 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
Noting that ∆(E (m/ ), y) ≤ ∆(E (m), y) ≤ (p + ε/ )n (see Figure 6.6), by (6.9) we have
0 1 2 0 ( ) ( ( ) ) 1
EE 1D(y)(=m ≤ Pr E m/ ∈ B y, p + ε/ n |E (m)
m/ (=m
9 ( ( ) )9
2 9B y, p + ε/ n 9
= (6.10)
m/ (=m 2n
2 2H (p+ε )n
/
≤ (6.11)
m/ (=m 2n
≤2k · 2−n (1−H (p+ε ))
/
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
Pr [D(E (m) + e) (= m] ≤e −ε n/2 + 2−n (H (p+ε)−H (p+ε ))
/2 / 2 0 1
EE Pr y|E (m)
e∼BSCp y∈B (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 .
e∼BSCp
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 .
e∼BSCp
95
5 6
0 ∗( ∗ ) 1 /
Em Pr D E (m) + e (= m ≤ 2−δ n . (6.14)
e∼BSCp
(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 “aver-
aging" argument.
Claim 6.3.2. Let the messages be ordered as m1 , m2 , . . . , m2k and define
Pi = Pr [D(E (mi ) + e) (= mi ] .
e∼BSCp
/
Assume that P 1 ≤ P 2 ≤ . . . ≤ P 2k and (6.14) holds, then P 2k−1 ≤ 2 · 2−δ n
Proof. By the definition of P i ,
2k
1 2
P i = Em Pr [D(E (m) + e) (= m]
2k i =1 e∼BSCp
/
≤ 2−δ n , (6.15)
where (6.15) follows from (6.14). For the sake of contradiction assume that
/
P 2k−1 > 2 · 2−δ n . (6.16)
So,
2k
1 2 1 2k
2
Pi ≥ Pi (6.17)
2k i =1 2k i =2k−1 +1
−δ/ n k−1
2·2 ·2
> (6.18)
2k
−δ/ n
>2 , (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 , . . . , m2k−1 as its messages and hence, has dimension k / =
k − 1. Define δ(= δ/ + n1 . In )the new code, maximum
( error) probability is at most 2−δn . Also if
/
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 Shannon’s 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 al-
gorithm that computes a succinct description of C given n. For linear codes, such a succinct
description would be a generator matrix.
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, Shannon’s proof uses MLD for which only exponential time implementations are
known. Thus, the biggest question left unsolved by Shannon’s work is the following.
As a baby step towards the resolution of the above question, one can ask the following ques-
tion:
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 Hamming’s 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.
97
H AMMING S HANNON
Focus on codewords itself Directly deals with encoding and decoding functions
Looked at explicit codes Not explicit at all
Fundamental trade off: rate vs. distance Fundamental trade off: rate vs. error
(easier to get a handle on this)
Worst case errors Stochastic errors
Intuitively achieving positive results in the Hamming world is harder than achieving positive
results in Shannon’s world. The reason is that the adversary in Shannon’s world (e.g. BSCp ) is
much weaker than the worst-case adversary in Hamming’s world (say for bits). We make this
intuition (somewhat) precise as follows:
Proposition 6.4.1. Let 0 ≤ p < 12 and 0 < ε ≤ 12 − 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 ≥ 1−e 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 k−n 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 k−n , 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:
'
c if y agrees with exactly one c ∈ C on the unerased entries in Fq
D(y) =
fail otherwise
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 ∈ Fk×n q is less than q k−n+|J | .
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
Chapter 7
In Section 6.4, we made a qualitative comparison between Hamming and Shannon’s 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 Shannon’s. 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.
• Hamming theory: Can correct ≤ δ2 fraction of worse case errors for codes of relative dis-
tance δ. By the Singleton bound (Theorem 4.3.1),
δ ≤ 1 − R,
which by Proposition 1.4.1 implies that p fraction of errors can be corrected has to satisfy
1−R
p≤ .
2
The above can be achieved via efficient decoding algorithms for example for Reed-Solomon
codes (we’ll 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 2
2
y
c1
δ
> 2
bad examples
c3 c2 δ
2
δ
2
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.
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 Shannon’s 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 dis-
tance 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 can-
not 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 codewords is roughly equal to:
δ
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 − 2−n(1−H ( 2 )−R) , (7.1)
where k = Rn and by the Hamming bound (Theorem 1.3) R ≤ 1 − H ( δ2 ). If R < 1 − H ( δ2 ) then
second term of (7.1) is very small. Therefore the number of vectors in shaded area (without
the bad examples) is almost all of the ambient space. Note that by the stringent condition on
unique decoding none of these received words can be decoded (even though for such received
words there is a unique closest codeword). Thus, in order to be able to decode such received
vectors, we need to relax the notion of unique decoding. We will consider such a relaxation
called list decoding next.
103
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 Shannon’s 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
7.3 Johnson Bound
In this section, we will indeed answer Question 7.2.1 in the affirmative by stating a bound due
to Johnson. To setup the context again, recall that Proposition 1.4.1 implies that any code with
relative distance δ is (δ/2, 1)-list decodable. $ %
Notice that if we can show a code for some e > d −1 2
is (e/n, n O(1) )-list decodable, then
(combinatorially) it is possible to list decode that code up to e errors. We’ll show by proving the
Johnson bound that this is indeed the case for any code.
& '
Theorem 7.3.1 (Johnson Bound). Let C ⊆ [q]n be a code of distance d . If ρ < J q dn , then C is a
(ρ, qd n)-list decodable code, where the function J q (δ) is defined as
( )* + ,
1 qδ
J q (δ) = 1 − 1− 1− .
q q −1
Proof (for q = 2). The proof technique that we will use has a name: double counting. The main
idea is to count the same quantity in two different ways to get both an upper and lower bound
on the same quantity. These bounds then imply an inequality and we will derive our desired
bound from this inequality.
We have to show that for every binary code C ⊆ {0, 1}n with distance d (i.e. for every c1 '= c2 ∈
-
C , ∆(c1 , c2 ) ≥ d ) and every y ∈ {0, 1}n , |B (y, e) C | ≤ 2d n.
Fix arbitrary C and y. Let c1 , . . . , cM ∈ B (y, e). We need to show that M ≤ 2d n. Define c(i =
ci − y for 1 ≤ i ≤ M . Then we have the following:
Define .
S= ∆(c(i , c(j ).
i<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
S≥ d (7.2)
2
105
Define . mi
ē = .
i M
Note that
n
. M
.
mi = w t (ci ) ≤ eM ,
i =1 j =1
ē ≤ e.
Using the Cauchy-Schwartz inequality (i.e., 〈x, y〉 ≤ ||x|| · ||y|| for x, y ∈ Rn ) by taking x =
(m 1 , · · · , m n ), y = (1/n, · · · , 1/n), we have
( /n )2 * n ,
m i . 1
i =1
≤ m i2 . (7.4)
n i =1 n
ē 2
( )
2 M (M − 1)
M ē − ≥ d,
n 2
dn 2d n 2d n
M≤ 2
= 2 2 2
= 2
d n − 2n ē + 2ē 2d n − n + n − 4n ē + 4ē (n − 2ē) − n(n − 2d )
2d n
≤ 2
, (7.6)
(n − 2e) − n(n − 2d )
where the last inequality follows from the fact that ē ≤ e. Then from
+
e 1 2d
< 1− 1− ,
n 2 n
we get 4
n − 2e > n(n − 2d ).
In other words
(n − 2e)2 > 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.
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− q−1 1−x
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,
x2
1−x + ≥ 1 − x,
4
which implies that
& x '2
1− ≥ 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 cor-
rect 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 John-
son 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 dis-
tance d is (e/n, qnd )-list decodable for all the q.
107
1
Singleton bound
Johnson bound
Unique decoding bound
0.8
0.4
0.2
0
0 0.2 0.4 0.6 0.8 1
Rate (R) --->
,
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 (1−R)/2 while
1 − R is the Singleton bound (and the list decoding capacity for codes over large alphabets).
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 code-
words. On the other hand, in the next section, we will show that, in some sense, it is not tight.
Theorem 7.4.1. Let q ≥ 2, 0 ≤ p < 1 − q1 , and ε > 0. Then the following holds for codes of large
enough block length n:
6 6 77
(i) If R ≤ 1 − H q (p) − ε, then there exists a p,O 1ε -list decodable code.
6 7
(ii) If R > 1 − H q (p) + ε, every ρ, L -list decodable code has L ≥ q Ω(n) .
108
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 Shannon’s world and Hamming’s 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
1
R ≤ 1 − H q (ρ) −
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
( )
k 1
|C | = q , where k ≤ 1 − H q (ρ) − n.
L
That is, as in Shannon’s 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
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:
V ol q (ρn, n)
Pr[C (mi ) ∈ B (y, ρn)] = ≤ q −n(1−Hq (ρ)) , (7.7)
qn
where the inequality follows from the upper bound on the volume of a Hamming ball (Proposi-
tion 3.3.1). Now the probability of a bad event given (y, m0 , · · · , mL ) is
: <
L
; L
=
Pr C (mi ) ∈ B (y, ρn) = Pr[C (mi ) ∈ B (y, ρn)] ≤ q −n(L+1)(1−Hq (ρ)) , (7.8)
i =0 0
where the equality follows from the fact that the random choices of codewords for distinct mes-
sages are independent and the inequality follows from (7.7). Then,
* ,
k
q
Pr[ There is a bad event] ≤ q n q −n(L+1)(1−Hq (ρ)) (7.9)
L +1
≤ q n q Rn(L+1) q −n(L+1)(1−Hq (ρ)) (7.10)
1
−n(L+1)[1−H q (ρ)− L+1 −R]
= q
1 1
≤ q −n(L+1)[1−Hq (ρ)− L+1 −1+Hq (ρ)+ L ] (7.11)
− nL
= q
< 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 y’s (which is q n ), and the number of L + 1 tuples (which is L+1 ). (7.10) follows from
6a 7
the fact that b ≤ a and k = Rn. (7.11) follows by assumption R ≤ 1 − H q (ρ) − L1 . The rest of the
b
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
110
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 [1c∈B (y,ρn) ] (7.14)
c∈C
.
= Pr[c ∈ B (y, ρn)]
c∈C
.
≥ q −n(1−Hq (ρ)+o(n)) (7.15)
c∈C
n[R−1+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
1
R ≤ 1 − H q (ρ) − . (7.17)
.logq (L + 1)/
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?
Question 7.4.3. Can we design an efficient list decoding algorithm that can achieve
, the John-
son bound? In particular, can we efficiently list decode a code of rate R from 1 − R fraction
of errors?
Theorem 7.5.1. Let ε > 0 be a real and q ≥ 2Ω(1/ε) be an integer. Then the following is true for any
0 < δ < 1 − 1/q and large enough n. Let C ⊆ {0, 1, ...q − 1}n be a code with relative distance δ and
let S⊆ [n] such that |S| = (1 − ρ)n, where (0 < ρ ≤ δ − ε).
Then, for all c ∈ C and all but a q −Ω(εn) fraction of error patterns, e ∈ {0, 1...q − 1}n such that
For illustration of the kinds of error pattern we will deal with, see Figure 7.3.
Before we present the proof, we present certain corollaries (the proofs of which we leave as
exercises). First the result above implies a similar result of the output list size being one for the
following two random noise models: (i) uniform distribution over all error patterns of weight
ρn and (ii) qSCp . In fact, we claim that the result also implies that any code with distance at
112
S
e 0 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 |.
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.
A2
c+e
A1
c(e)
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.
.
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]\(S∪A 2 ) = x.
Note that at this stage we have an error pattern e as depicted in Figure 7.5.
e 0 ?? x
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
where the inequality follows from (7.20) and the equality follows from (7.19).
Finally, summing up over all choices of A = (A 1 , A 2 ) (of which there are at most 2n ), we get
that the total number of bad patterns is upper bounded by
1
n
− εn
2 +2
2n · (q − 1)−εn+1 · |E S | ≤ q log2 q · |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 log2 q
< εn
4
. This
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
7.6 Bibliographic Notes
List decoding was defined by Elias [11] and Wozencraft [59].
The result showing that for random error patterns, the list size with high probability is one
for the special case of Reed-Solomon codes was shown by McEliece [41]. The result for all codes
was proved by Rudra and Uurtamo [47]
In applications of list decoding in complexity theory (see for example [54],[18, Chap. 12]),
side information is used crucially to prune the output of a list decoding algorithm to compute
a unique answer.
Guruswami [17] showed that the answer to Question 7.3.1 is yes in the sense that there ex-
ist linear codes with relative distance δ such that we can find Hamming ball of radius larger
than J q (δ) with super-polynomially many codewords. This result was proven under a number-
theoretic assumption, which was later removed by [27]. 6 7
(7.17) implies that there exist linear codes with rate 1 − H q (ρ) − ε that are ρ, q O(1/ε) -list
decodable. (This is also true for most linear codes6with the appropriate
7 parameters.) However,
for a while just for q = 2, we knew the existence of ρ,O(1/ε) -list decodable codes [21] (though
it was not a high probability result). Guruswami, Håstad and Kopparty resolved this “gap" by
showing that random linear codes of rate 1 − H q (ρ) − ε are (ρ,O(1/ε))-list decodable (with high
probability) [20].
116
Chapter 8
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.
117
1
Hamming bound
GV bound
Singleton bound
Plotkin bound
Elias-Bassalygo bound
0.8
0.6
R
0.4
0.2
0
0 0.2 0.4 0.6 0.8 1
δ
Figure 8.1: Singleton, Hamming, Plotkin, GV and Elias-Bassalygo bounds on rate versus dis-
tance 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:
|C |V ol q (e, n)
B≥ .
qn
By our choice of e and the Johnson bound (Theorem 7.3.1), we have
B ≤ qd n.
qn
|C | ≤ qnd · ≤ q n (1−Hq ( 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:
! "
R ≤ 1 − H q J q (δ) + o (1) ,
as desired. !
118
8.2 The MRRW bound: A better upper bound
The MRRW bound (due to McEliece, Rodemich, Rumsey and Welch) is based on a linear pro-
gramming approach introduced by Delsarte to bound the rate of a code. The MRRW bound
is a better upper bound than the Elias-Bassalygo bound (though we will not state or prove the
bound in this book). However, there is a gap between the Gilbert-Varshamov (GV) bound and
the MRRW bound. The gap still exists to this day. To give one data !point " on the gap, consider
δ = 12 −ε (think of ε → 0), the GV bound gives a lower bound on
! 2 R of Ω
! 1 "" ε 2
(see Proposition 3.3.5),
while the MRRW bound gives an upper bound on R of O ε log ε .
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 Shannon’s world and Hamming’s world (under both
unique and list decoding settings).
Shannon Hamming
BSCp Unique List
! " ! "
1-H p is capacity R ≥ 1 − H (δ) 1 − H p is list decoding capacity
R ≤ M RRW
Explicit codes at capacity? Explicit Asymptotically good codes? Explicit codes at capacity?
Efficient decoding algorithm? Efficient decoding algorithms? Efficient decoding algorithms?
For the rest of the section, we remind the reader about the definition of explicit codes (Def-
inition 6.3.1) and strongly explicit codes (Definition 6.3.2).
We begin with BSCp . We have seen that the capacity of BSCp is 1 − H (p). The most nat-
ural open question is to obtain the capacity result but with explicit codes along with efficient
decoding (and encoding) algorithms (Question 6.3.1).
Next we consider Hamming’s world under unique decoding. For large enough alphabets,
we have seen that Reed-Solomon codes (Chapter 5) meet the Singleton bound (Theorem 4.3.1).
Further, the Reed-Solomon codes are strongly explicit1 . The natural question then is
For smaller alphabets, especially binary codes, as we have seen in the last section, there is a
gap between the best known lower and upper bounds on the rate of a code with a given relative
1
The proof is left as an exercise.
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:
If we scale down our ambitions, the following is a natural weaker version of the second ques-
tion above:
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 sum-
marized in the last two rows of Table 8.1).
120
Chapter 9
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 ques-
tion 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 R! " δ
log n #1$
Hamming 1−O n O n
! "
log n 1
Hadamard O n
!2 "
1
Reed-Solomon 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 dis-
tance 1/2. Both of these codes have extremely good R or δ at the expense of the other param-
eter. 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,
% the “obvious”& binary code created by view-
1
ing symbols from F2s as bit vectors as above is an ns, ns ,
2 2
n
+ 1 2
code . Note that the distance
! "
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
The proof is left as an exercise.
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 func-
tion 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 asymp-
totically good codes.
C in : [q]k → [q]n .
Note that the alphabet size of C out exactly matches the number of messages for C in . Then given
m = (m 1 , . . . , m K ) ∈ [Q]K , we have the code C out ◦C in : [q]kK → [q]nN defined as
where
C out (m) = (C out (m)1 , . . . ,C out (m)N ) .
m1 m2 mK
C out
C in C in C in
Theorem 9.1.1. If C out is an (N , K , D)q k code and C in is an (n, k, d )q code, then C out ◦ C in is an
(nN , kK , d D)q code. In particular, if C out (C in resp.) has rate R (r resp.) and relative distance δout
(δin resp.) then C out ◦C in has rate Rr and relative distance δout · δin .
124
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
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
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.
δ
R = 1− .
H q−1 (1 − r ) − ε
2
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 in-
equality follows for d , D ≥ 1.
125
1
GV bound
Zyablov bound
0.8
0.6
R
0.4
0.2
0
0 0.2 0.4 0.6 0.8 1
δ
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− ,
0<r <1−H q (δ+ε) H q−1 (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:
We will focus on linear codes in seeking an answer to the question above because linear codes
have polynomial size representation. Let C out be an [N , K ]Q Reed-Solomon code where N =
Q − 1 (evaluation points being FQ ∗
with Q = q k ). This implies that k = Θ(log N ). However we still
need an efficient construction of an inner code that lies on the GV bound. We do not expect
to construct such a C in in time poly(k) as that would answer Open Question 8.3.2! However,
since k = O(log N ), note that an exponential time in k algorithm is still a polynomial (in N ) time
algorithm.
There are two options for this exponential (in k) time construction algorithm for C in :
126
• 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 construc-
tion 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 α ∈ F∗k , 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
∗
α ∈ F k is linear and is strongly explicit. (The proof if left as an exercise.)
q
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 q−1 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)
Finally, from (9.3) and (9.4), we obtain that the distance of C ∗ is at least
+ ,
1
(1 − R − ε) · N d = (1 − R − ε)H q−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
Proof of Theorem 9.3.1. Fix y = (y1 , y2 ) ∈ F2k q \ {0}. Note that this implies that y1 = 0 and y2 = 0
α
are not possible. We claim that y ∈ C in for at most one α ∈ F∗k . The proof is by a simple case
2
α
analysis. First, note that if y ∈ C in , then it has to be the case that y2 = α · y1 .
α y
• Case 1: y1 &= 0 and y2 &= 0, then y ∈ C in , where α = y21 .
α
• Case 2: y1 &= 0 and y2 = 0, then y ∉ C in for every α ∈ F∗k (as αy1 &= 0 since product of two
2
elements in F∗k also belongs to F∗k ).
2 2
α
• Case 3: y1 = 0 and y2 &= 0, then y ∉ C in for every α ∈ F∗k (as αy1 = 0).
2
α α
Now assume that w t (y) < H q−1 (1 − ε)n. Note that if y ∈ C in , then C in is “bad”(i.e. has relative
#
−1 1
$ α
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
≤ q Hq (Hq ( 2 −ε))·2k
(9.5)
( 12 −ε)·2k
=q
qk
=
q 2εk
< ε(q k − 1) (9.6)
= εN . (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
C in has relative distance at least H q 2 − ε , as desired. !
By concatenating an outer code of distance D and an inner code of distance d , we can ob-
tain a code of distance at least ≥ Dd (Theorem 9.1.1). Dd is called the concatenated code’s de-
sign 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 (Corol-
lary 9.3.3). Further, since these codes were linear, we also get polynomial time encoding. How-
ever, 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 poly-
nomial 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 construc-
tion 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 Varshamov’s 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 }ik=1, j =1
satisfies the property that A i , j = A i −1, j −1 . In other
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
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
Chapter 10
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 with-
out 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 prac-
tical applications.
To define expander codes, we will need some notions from graph theory, which we define
next.
131
!1
!2 r1
!3
!4 r2
!5
!6 r3
!7
Definition 10.1.2 (Adjacency matrix). Given a bipartite graph G = (L, R, E ), its adjacency matrix,
denoted by AG , is an |R| × |L| binary matrix, where we index each row by an element of R and
every column by an element of L such that for every (r, !) ∈ R × L, the (r, !)’th entry in AG is 1 if
(!, r ) ∈ E and 0 otherwise.
For example, the adjacency matrix of the graph in Figure 10.1 is given by
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.
132
In this chapter, we will consider codes whose factor graphs are so called “expander graphs."
!1
!2 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.
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
log(n/m) % ε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 includ-
ing) γ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
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.
Proposition 10.3.1. Let G = (L, R, E ) be a bipartite graph with |L| = n and |R| = n − k. Then
(c 1 , . . . , c n ) ∈ {0, 1}n is in C (G) if and only if the following holds (where S = {i ∈ [n]|c i '= 0}) for every
r ∈ N (S): )
c ! = 0, (10.1)
!∈S:r ∈N ({!})
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.
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,
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 affir-
mative.
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
Now since the total number of edges emanating out of S \ T is at most D|S \ T |, we have
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
Chapter 11
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 affir-
mative.
For the time being let us assume that we have a polynomial time unique decoding algo-
! "N ! "K
rithm D C out : q k → q k for the outer code that can correct up to D/2 errors.
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 in C in C in
Encoding of C out ◦ C in
m1 m2 mK
D C out
y# y 1# y 2# #
yN
D C in D C in D C in
y y1 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).
140
1. The time complexity of Step 1 is O(nq k ), which for our choice of k = O(log N ) (and con-
stant 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.
Note that if |B| < D2 , then the decoder in Step 2 will output the message m. Thus, to com-
plete 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 ,
then the total number of errors is at least D2 · d2 = Dd # D
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 an-
swering this latter question next.
Theorem 11.2.1. An [N , K ]q Reed-Solomon code can be corrected from e errors (or s erasures) as
long as e < N −K
2
+1
(or s < N − K + 1) in O(N 3 ) time.
We defer the proof of the result on decoding from errors to Chapter 13 and leave the proof
of the erasure decoder as an exercise. Next, we show that we can get the best of both worlds by
correcting errors and erasures simultaneously:
Theorem 11.2.2. An [N , K ]q Reed-Solomon code can be corrected from e errors and s erasures in
O(N 3 ) time as long as
2e + s < N − K + 1. (11.1)
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 Reed-
Solomon code. (Note that this new Reed-Solomon code has evaluation points that correspond-
ing 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
(N − s) − K + 1
e< .
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 Theo-
rem 11.2.1 can be implemented in cubic time.
Next, we will use the above errors and erasure decoding algorithm to design decoding algo-
rithms for certain concatenated codes that can be decoded up to half their design distance (i.e.
up to Dd /2).
142
11.3 Generalized Minimum Distance Decoding
Recall the natural decoding algorithm for concatenated codes from Algorithm 7. In particular,
we performed MLD on the inner code and then fed the resulting vector to a unique decoding
algorithm for the outer code. A drawback of this algorithm is that it does not take into account
the information that MLD provides. For example, it does not distinguish between the situations
where a given inner code’s received word has a Hamming distance of one vs where the received
word has a Hamming distance of (almost) half the inner code distance from the closest code-
word. It seems natural to make use of this information. Next, we study an algorithm called the
Generalized Minimum Distance (or GMD) decoder, which precisely exploits this extra informa-
tion.
In the rest of the section, we will assume C out to be an [N , K , D]q k code that can be decoded
(by D C out ) from e errors and s erasures in polynomial time as long as 2e + s < D. Further, let C in
be an [n, k, d ]q code with k = O(log N ) which has a unique decoder D C in (which we will assume
is the MLD implementation from Algorithm 1).
We will in fact look at three versions of the GMD decoding algorithm. The first two will be
randomized algorithms while the last will be a deterministic algorithm. We will begin with the
first randomized version, which will present most of the ideas in the final algorithm.
143
Algorithm 8 Generalized Minimum Decoder (ver 1)
# $ ! "N
I NPUT: Received word y = y 1 , · · · , y N ∈ q n
! "K
O UTPUT: Message m# ∈ q k
1: FOR 1 ≤ i ≤ N DO
2: y i# ← D C in (y i ).
' (
3: w i ← min ∆(y i# , y i ), d2 .
2w i
4: With probability d , set y i## ←?, otherwise set y i## ← x, where y i# = C in (x).
5: m# ← D C out (y## ), where y = (y 1## , . . . , y N
## ##
).
6: RETURN m#
Lemma 11.3.1. 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 com-
pared with C out ◦C in (m)), then ! "
E 2e # + s # < D.
Note that if 2e # + s # < D, then by Theorem 11.2.2, Algorithm 8 will output m. The lemma
above says that in expectation, this is indeed the case.
Proof of Lemma 11.3.1. For every 1 ≤ i ≤ N , define e i = ∆(y i , c i ). Note that this implies that
N
) Dd
ei < . (11.2)
i =1 2
X i? = 1 y ## =? ,
i
and
X ie = 1C in (y ## )'=ci and y ## '=? .
i i
144
where the inequality follows from (11.2).
To complete the proof, we will prove (11.3) by a case analysis. Towards this end, fix an arbi-
trary 1 ≤ i ≤ N .
Case 1: (c i = y i# ) First, we note that if y i## '=? then since c i = y i# , we have X ie = 0. This along with
2w
the fact that Pr[y i## =?] = d i implies
! " 2w i
E X i? = Pr[X i? = 1] = ,
d
and ! "
E X ie = Pr[X ie = 1] = 0.
Further, by definition we have
+ ,
d
w i = min ∆(y i# , y i ), ≤ ∆(y i# , y i ) = ∆(c i , y i ) = e i .
2
The three relations above prove (11.3) for this case.
Case 2: (c i '= y i# ) As in the previous case, we still have
! " 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 , (11.4)
which implies
! " 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 ).
This along with the assumption on ∆(y i# , y i ), we get
d
e i = ∆(c i , y i ) ≥ ∆(y i# , y i ) ≥ .
2
This in turn implies that
ei + wi ≥ d ,
as desired. !
145
11.3.2 GMD Algorithm- II
Note that Step 4 in Algorithm 8 uses “fresh" randomness for each i . Next we look at another
randomized version of the GMD algorithm that uses the same randomness for every i . In par-
ticular, consider Algorithm 9.
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
In Algorithm 9, we note that
- - ,.
! " 2w i 2w i
Pr y 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 com-
pared with C out ◦C in (m)), then ! "
Eθ 2e # + s # < D.
146
Define Q = {0, 1} ∪ { 2w
d
1
, · · · , 2wd N }. Then because for each i , w i = min(∆(y i# , y i ), d /2), we have
Q = {0, 1} ∪ {q 1 , · · · , q m }
/ 0
where q 1 < q 2 < · · · < q m 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 here is not an erasure Everything gets ?
0 q1 q2 q i −1 qi q i +1 1
Thus, we need to cycle through all possible values of θ ∈ Q, leading to Algorithm 10.
2w 2w
1: Q ← { d 1 , · · · , d N } ∪ {0, 1}.
2: FOR θ ∈ Q DO
3: FOR 1 ≤ i ≤ N DO
4: y i# ← D C in (y i ).
' (
# d
5: w i ← min ∆(y i , y i ), 2 .
2w i
6: If θ < d , set y i## ←?, otherwise set y i## ← x, where y i# = C in (x).
7: m#θ ← D C out (y## ), where y## = (y 1## , . . . , y N
##
).
# # $ $
8: RETURN m#θ∗ for θ ∗ = arg minθ∈Q ∆ C out ◦C in m#θ , y
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.
147
Chapter 12
Table 12.1 summarizes the main results we have seen so far for (binary codes).
Shannon Hamming
Unique Decoding List Decoding
Capacity 1 − H (p) (Thm 6.3.1) ≥ GV (Thm 4.2.1) 1 − H (p) (Thm 7.4.1)
≤ MRRW (Sec 8.2)
Explicit Codes ? Zyablov bound (Thm 9.2.1) ?
1
Efficient Algorithms ? 2 · Zyablov bound (Thm 11.3.3) ?
In this chapter, we will tackle the open questions in the first column of Table 12.1. Recall
that there exist linear codes of rate 1− H (p)−ε such that decoding error probability is not more
than 2−δn , δ = Θ(ε2 ) on the B SC p (Theorem 6.3.1 and Exercise 6.5.1). This led to Question 6.3.1,
which asks if we can achieve the BSCp capacity with explicit codes and efficient decoding algo-
rithms?
149
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 worst-
case 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$ $
yN
D in D in D in
y y1 y2 yN
γ
Independent decoding error probability of ≤ 2
We answer Question 6.3.1 in the affirmative by using a concatenated code C out ◦C in with the
following properties (where γ > 0 is a parameter that depends only on ε and will be fixed later
on):
(i) C out : The outer code is a linear [N , K ]2k code with rate R ≥ 1 − 2ε , where k = O(log N ).
Further, the outer code has a unique decoding algorithm D out that can correct at most γ
fraction of worst-case errors in time Tout (N ).
(ii) C in : The inner code is a linear binary [n, k]2 code with a rate of r ≥ 1− H (p)−ε/2. Further,
150
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 .
as both the outer and inner codes are linear1 . Further, the decoding by Algorithm 11 takes time
151
where the inequality is true as long as
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.
log( γ1 )
) *
# $
Ω ≤ k ≤ O log N .
ε2
Note, however, that since the proof of Theorem 6.3.1 uses MLD on the inner code and Al-
gorithm 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 c3 c N −1
···
c2 c4 cN
⇓
c1 c2 c3 c4 ··· 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.
153
We will pick C out to be C $ when considered over F2k , where we choose
log( γ1 )
) *
k =Θ .
ε2
γ = ε3 .
12.4.2 Wrapping Up
We now recall the construction, encoding and decoding time complexity for our
! construction
"
1
#1$
2 O log2
of C ∗ . The construction time for C in is 2O(n ) , which substituting for n, is 2 ε4 ε
. The
construction !time for "C out , meanwhile, is only poly(N ). Thus, our overall, construction time is
1
#1$
O log2
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
1
# $
O(1) O(n) O log 1ε
time is N + N ·2 = poly(N )+N ·2 ε2 . We also have shown that the decoding error
γN
−Ω( ) −Ω(ε6 N )
probability is exponentially small: 2 n =2 . Thus, we have proved the following
result:
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
−5
)
(a) C ∗ can be constructed in time poly(N ) + 2O(ε ;
154
Thus, we have answered in the affirmative Question 6.3.1, which was the central open ques-
tion from Shannon’s 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$
Question 12.4.1. Can we bring the high dependence on ε down to poly ε in the decoding
time complexity?
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
ε2
Section 12.4.1 with γ = Θ 2 .4 However, we obtain an encoding and decoding time of
log (1/ε)
1
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.
4
This is because we need 1/(1 + β) = 1 − ε/2, which implies that β = Θ(ε).
155
Chapter 13
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 (The-
orem 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 de-
coding algorithm that efficiently achieves the Johnson bound (Theorem 7.3.1).
157
yi
7
6
5
4
3
2
1
−6 −4 −2 2 4 6
αi
−7 −5 −3 −1 1 3 5 7
−1
−2
−3
−4
−5
−6
−7
n = 14, k = 2, e = 6
See Figure 13.3 for an illustration of the E (X ) corresponding to the received word in Figure 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
−6 −4 −2 2 4 6
αi
−7 −5 −3 −1 1 3 5 7
−1
−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 Fig-
ure 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 NP-
hard 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
To perform linearization, define N (X ) = P (X ) · E (X ). Note that N (X ) is a polynomial of
degree less than or equal to e + k − 1. Further, if we can find N (X ) and E (X ), then we are done.
This is because we can compute P (X ) as follows:
N (X )
P (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).
159
yi
7
6
5
4
3
2
1
−6 −4 −2 2 4 6
αi
−7 −5 −3 −1 1 3 5 7
−1
−2
−3
−4
−5
−6
−7
n = 14, k = 2, e = 6
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 algo-
rithm 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 < n−k+1
2 errors occur (i.e. ∆(y, (P (αi ))ni=1 ) ≤ e), then the Welch-Berlekamp algo-
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 ).
1 (X ) N2 (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
Algorithm 12 Welch-Berlekamp Algorithm
I NPUT: n ≥ k ≥ 1, 0 < e < n−k+1
2 and n pairs {(αi , y i )}ni=1 with αi distinct
O UTPUT: Polynomial P (X ) of degree at most k − 1 or fail.
Proof of Claim 13.1.2. We just take E ∗ (X ) to be the error-locating polynomial for P (X ) and let
N ∗ (X ) = P (X )E ∗ (X ) where deg(N ∗ (X )) ≤ deg(P (X ))+deg(E ∗ (X )) ≤ e+k−1. In particular, define
E ∗ (X ) as the following polynomial of degree exactly e:
! n
" #
E ∗ (X ) = X e−∆ y,(P (αi ))i =1 (X − αi ). (13.3)
1≤i ≤n|y i $=P (αi )
We now argue that E ∗ (X ) and N ∗ (X ) satisfy (13.2). Note that if E ∗ (αi ) = 0, then N ∗ (αi ) =
P (αi )E ∗ (αi ) = y i E ∗ (αi ) = 0. When E ∗ (αi ) $= 0, we know P (αi ) = y i and so we still have P (αi )E ∗ (αi ) =
y i E ∗ (αi ), as desired.
Proof of Claim 13.1.3. Note that the degrees of the polynomials N1 (X )E 2 (X ) and N2 (X )E 1 (X )
are at most 2e + k − 1. Let us define polynomial R(X ) with degree at most 2e + k − 1 as follows:
R(X ) = N1 (X )E 2 (X ) − N2 (X )E 1 (X ). (13.4)
161
Substituting (13.5) into (13.4) we get for 1 ≤ i ≤ n:
deg(R(X )) ≤ e + k − 1 + e
= 2e + k − 1
< 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
1 (X ) N2 (X )
that as E 1 (X ) $= 0 and E 2 (X ) $= 0, this implies that N
E 1 (X ) = E 2 (X ) , as desired.
Theorem 13.1.4. For any [n, k]q Reed-Solomon code, unique decoding can be done in O(n 3 ) time
up to d −1 n−k
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 concate-
nated codes up to half of their design distance) and Theorem 12.4.1 (efficiently achieving the
BSCp capacity).
162
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:
• Step 2: If Y −P (X ) divides Q(X , Y ) = Y E (X )−N (X ), then output P (X ) (assuming ∆(y, (P (αi ))ni=1 ) ≤
e).
N (X )
Note that Y −P (X ) divides Q(X , Y ) in Step 2 above if and only if P (X ) = E (X )
, which is exactly
what Step 4 does in Algorithm 12.
163
• 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 correspond-
ing 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 ) di-
vides 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 ,
0≤i ≤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) · + 1 > " · = n.
" "
164
Algorithm 13 The First List Decoding Algorithm for Reed-Solomon Codes
I NPUT: n ≥ k ≥ 1, " ≥ 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
n
1: Find a non-zero Q(X , Y ) with deg X (Q) ≤ ", degY (Q) ≤ such that
"
Q(αi , y i ) = 0, 1 ≤ i ≤ n. (13.6)
2: Ł ← +
3: FOR every factor Y − P (X ) of Q(X , Y ) DO
4: ∆(y, (P (αi ))ni=1 ) ≤ e and deg(P ) ≤ k − 1 THEN
IF
5: Add P (X ) to Ł.
6: RETURN Ł
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 ≤ k−1 agrees with Y in at least t positions,
then Y − P (X ) divides Q(X , Y ). Towards this end, we define
def
R(X ) = Q(X , P (X )).
Note that Y − P (X ) divides Q(X , Y ) if and only if R(X ) ≡ 0. Thus, we need to show R(X ) ≡ 0. For
the sake of contradiction, assume that R(X ) $≡ 0. Note that
deg(R) ≤ deg X (Q) + deg(P ) · degY (Q) (13.7)
n(k − 1)
≤ "+ . (13.8)
"
On the other hand, if P (αi ) = y i then (13.6) implies that
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
n(k − 1)
t > "+ .
"
* *
If we pick " = 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 frac-
tion 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 elim-
ination 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 1−R 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
1
Unique Decoding bound
Johnson bound
Algorithm 1
0.8
0.6
R
0.4
0.2
0
0 0.2 0.4 0.6 0.8 1
δ
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+3·2, 4+2·1) = 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 polyno-
mial such that deg(P ) ≤ w. Then we have
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 pre-
cise algorithm, we will present the algorithm via an example. Consider the received word in
Figure 13.5.
yi
4
3
2
1
−6 −4 −2 2 4 6
αi
−5 −3 −1 1 3 5
−1
−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 Fig-
ure 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. Fig-
ure 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
1
−6 −4 −2 2 4 6
αi
−5 −3 −1 1 3 5
−1
−2 E (X , Y ) = Y 2 /16 + X 2 /49 − 1
−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
1
−6 −4 −2 2 4 6
αi
−5 −3 −1 1 3 5
−1
−2 E (X , Y ) = Y 2 /16 + X 2 /49 − 1
−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 Algo-
rithm 13, we can ensure R(X ) ≡ 0 if we pick
t > D.
168
Algorithm 14 The Second List Decoding Algorithm for Reed-Solomon Codes
I NPUT: n ≥ k ≥ 1, D ≥ 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
Q(αi , y i ) = 0, 1 ≤ i ≤ n. (13.9)
2: Ł ← +
3: FOR every factor Y − P (X ) of Q(X , Y ) DO
4: ∆(y, (P (αi ))ni=1 ) ≤ e and deg(P ) ≤ k − 1 THEN
IF
5: Add P (X ) to Ł.
6: RETURN Ł
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 ≤ k−1 . (For notational convenience,
* D +
define " = k−1 .) Consider the following sequence of relationships
" D−(k−1)
$ $ j
N = 1
j =1 i =0
"
$
= (D − (k − 1) j + 1)
j =0
"
$ "
$
= (D + 1) − (k − 1) j
j =0 j =0
(k − 1)"(" + 1)
= (D + 1)(" + 1) −
2
"+1
= (2D + 2 − (k − 1)")
, 2 -
"+1
≥ (D + 2) (13.10)
2
D(D + 2)
≥ . (13.11)
2(k − 1)
D
In the above, (13.10) follows from the fact that " ≤ k−1 and (13.11) follows from the fact that
D
k−1 − 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
suffices by the following argument:
Algorithm 2 runs in polynomial time as Step 1 can be implemented using Gaussian elimi-
nation (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
Unique Decoding bound
Johnson bound
Algorithm 1
Algorithm 2
0.8
0.6
R
0.4
0.2
0
0 0.2 0.4 0.6 0.8 1
δ
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 −X
X
(0, 0)
Definition 13.2.3. Q(X , Y ) has r roots at (0, 0) if Q(X , Y ) doesn’t have any monomial with degree
at most r − 1.
171
Y
Y +X
Y −X
X
(0, 0)
X
(0, 0)
The definition of a root with multiplicity r at a more general point follows from a simple
translation:
def
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. Con-
sider 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. Fig-
ure 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
−9 −7 −1 1 2 5 8 11
αi
−5
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
−9 −7 −1 1 2 5 8 11
αi
−5
n = 10, k = 2, e = 6
Figure 13.13: An interpolating polynomial Q(X , Y ) for the received word in Figure 13.12.
Correctness of Algorithm 15. To prove the correctness of Algorithm 15, we will need the fol-
lowing 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
−9 −7 −1 1 2 5 8 11
αi
−5
n = 10, k = 2, e = 6
Figure 13.14: The five polynomials that need to be output are shown in blue.
2: Ł ← +
3: FOR every factor Y − P (X ) of Q(X , Y ) DO
4: ∆(y, (P (αi ))ni=1 ) ≤ e and deg(P ) ≤ k − 1 THEN
IF
5: Add P (X ) to Ł.
6: RETURN Ł
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
3 4
D(D + 2) r +1
>n ,
2(k − 1) 2
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
works. Thus, we have shown the correctness of Step 1.
For the correctness of the root finding step, we need to show that the number of roots of
R(X ) (which by Lemma 13.2.5 is at least r t ) is strictly bigger than the degree of R(X ), which
from Lemma 13.2.2 is D. That is we would be fine we if have,
t r > D,
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 poly-
nomial 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.
175
and $ α,β
Q α,β (X , Y ) = Q(X + α, Y + β) = ci , j X i Y j .
i,j
Note that (i) and (ii) prove the lemma. To prove (i), note that by the definition:
$ α,β
Q α,β (X , Y ) = ci , j X i Y j
(13.13)
i,j
$ , ,
= c i , , j , (X + α)i (Y + β) j (13.14)
i ,, j ,
i +(k−1) j , ≤D
,
α,β , ,
Note that, if i > i , or j > j , , then c i , j doesn’t depend on c i , j . By comparing coefficients of X i Y j
which proves (i). To prove (ii), recall that by definition Q α,β (X , Y ) has no monomial of degree
α,β
< r . In other words, we need to have constraints c i , j = 0 if i + j ≤ r − 1. The number of such
constraints is
3 4
≥0 r +1
|{(i , j )|i + j ≤ r − 1, i , j ∈ Z }| = ,
2
where the equality follows from the following argument. Note that for every fixed value of 0 ≤
j ≤ r − 1, i can take r − j values. Thus, we have that the number of constraints is
3 4
r$ −1 $r r +1
r−j = "= ,
j =0 "=1 2
as desired.
We now re-state Lemma 13.2.5 more precisely and then prove it.
Lemma 13.2.7. Let Q(X , Y ) be computed by Step 1 in Algorithm 15. Let P (X ) be a polynomial
of degree ≤ k − 1, such that P (αi ) = y i for at least t > Dr many values of i , then Y − P (X ) divides
Q(X , Y ).
176
Proof. Define
def
R(X ) = Q(X , P (X )).
As usual, to prove the lemma, we will show that R(X ) ≡ 0. To do this, we will use the following
claim.
Claim 13.2.8. If P (αi ) = y i , then (X − αi )r divides R(X ), that is αi is a root of R(X ) with multi-
plicity r .
Note that by definition of Q(X , Y ) and P (X ), R(X ) has degree ≤ D. Assuming the above claim
is correct, R(X ) has at least t · r roots. Therefore, by the degree mantra (Proposition 5.2.3), R(X )
is a zero polynomial as t · r > D. We will now prove Claim 13.2.8. 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(X + αi , P αi ,y i (X ) + y i ) (13.18)
= Q αi ,y i (X , P αi ,y i (X )), (13.19)
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
$ α ,y , , $ α ,y , ,
R αi ,y i (X ) = c i , ,i j , i X i (P αi ,y i (X )) j = c i , ,i j , i X i (X g (X )) j .
i ,, j , i ,, j ,
α ,y
Now for every i , , j , such that c i , ,i j , i $= 0, we have i , + j , ≥ r as Q αi ,y i (X , Y ) has no monomial of
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 general-
ized to output all polynomials P (X ) of degree at most k − 1, such that
9 3 4
: n w +1
$ : $ i
w i > ;(k − 1)n .
i :P (αi )=y i i =0 2
(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 3 4
: n $ w
$ : $ i ,α + 1
w i ,P (αi ) > ;(k − 1)n .
i i =0 α∈F 2
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 non-
negative 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
$
w i ,ci ≥ W.
i =1
Note that Theorem 13.3.1 solve the soft decoding problem with
9 3 4
: n $ w
: $ i ,α + 1
W = ;(k − 1)n .
i =0 α∈F 2
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 “quan-
tizer” 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 de-
signing 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
Chapter 14
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)?
181
f (1) f (γ) f (γ2 ) f (γ3 ) ··· f (γn−2 ) f (γn−1 )
Figure 14.1: Encoding f (X ) of degree ≤ k−1 and coefficients in Fq corresponding to the symbols
in the message.
⇓
f (1) f (γ2 ) f (γn−2 )
···
f (γ) f (γ3 ) f (γn−1 )
For general m ≥ 1, this transformation will be as in Figure 14.3 (where we assume that m
divides n).
⇓
f (1) f (γm ) f (γ2m ) f (γn−m )
f (γ) f (γm+1 ) f (γ2m+1 ) ··· f (γn−m+1 )
.. .. .. ..
. . . .
f (γm−1 ) f (γ2m−1 ) f (γ3m−1 ) f (γn−1 )
Definition 14.1.1 (Folded Reed-Solomon Code). The m-folded version of an [n, k]q Reed-Solomon
code C (with evaluation points {1, γ, . . . , γn−1 }), call it C ( , is a code of block length N = n/m over
Fq m , where n ≤ q − 1. The encoding of a message f (X ), a polynomial ! ! " ! over F"q of degree
! at most
""
k − 1, has as its j ’th symbol, for 0 ≤ j < n/m, the m-tuple f γ j m , f γ j m+1 , · · · , f γ j m+m−1 .
In other words, the codewords of C ( are in one-one correspondence with those of the Reed-
Solomon code C and are obtained by bundling together consecutive m-tuple of symbols in
codewords of C .
182
14.1.1 The Intuition Behind Folded Reed-Solomon Codes
We first make the simple observation that the folding trick above cannot decrease the list de-
codability of the code. (We have already seen this argument earlier in Section 12.4.1.)
Claim 14.1.1. If the Reed-Solomon code can be list-decoded from ρ fraction of errors, then the
corresponding folded Reed-Solomon code with folding parameter m can also be list-decoded from
ρ fraction of errors.
Proof. The idea is simple: If the Reed-Solomon code can be list decoded from ρ fraction of
errors (by say an algorithm A ), the Folded Reed-Solomon code can be list decoded by “unfold-
ing" the received word and then running A on the unfolded received word and returning the
resulting set of messages. Algorithm 16 has a more precise statement.
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 (γ2 ) f (γ3 ) ··· f (γn−2 ) f (γn−1 )
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
This implies that for any m ∈ Fkq if ∆(y, FRS(m)) ≤ ρ · m , then ∆(y( , RS(m)) ≤ m · ρ · m = ρ · n,
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 pat-
tern does not need to be handled and can be ignored. For example, suppose a Reed-Solomon
183
f (1) f (γ) f (γ2 ) f (γ3 ) ··· f (γn−2 ) f (γn−1 )
⇓
f (1) f (γ2 ) f (γn−2 )
···
f (γ) f (γ3 ) f (γn−1 )
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 12 fraction of errors is folded into a Folded Reed-
Solomon 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 al-
gorithm must be able to list-decode from this error pattern. However, for the Folded Reed-
Solomon code the error pattern has 1 fraction of errors which is too high for the code to list-
decode 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 pat-
terns that a list decoding "
algorithm for folded Reed-Solomon code needs to handle (even be-
yond 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 they’re called bursty er-
rors). 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
14.2 List Decoding Folded Reed-Solomon Codes: I
We begin with an algorithm for list decoding folded Reed-Solomon codes that works with agree-
ment t ∼ mR N . Note that this is a factor m larger than the R N agreement we ultimately want.
In the next section, we will see how to knock off the factor of m.
Before we state the algorithm, we formally (re)state the problem we want to solve:
y0 ym y n−m
.. .. ··· .. m×N n
y= . . . ∈ Fq , N=
m
y m−1 y 2m−1 y n−1
! "
f γmi y mi
.. ..
. = . (14.1)
! "
f γm(i +1)−1 y m(i +1)−1
The algorithm that we will study is a generalization of the Welch-Berlekamp algorithm (Al-
gorithm 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 algo-
rithm. Here are the new ideas in the algorithm for the two-step framework that we have seen in
the previous chapter:
• 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.
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:
y0 ym y n−m
.. .. ··· .. m×N n
y= . . . ∈ Fq , N=
m
y m−1 y 2m−1 y n−1
O UTPUT: All polynomials f (X ) ∈ Fq [X ] of degree at most k − 1 such that for at least t values of
0≤i <N
! "
f γmi y mi
.. ..
= (14.2)
! m(i. +1)−1 " .
f γ y m(i +1)−1
2: Ł ← 0
3: FOR every f (X ) ∈ Fq [X ] such that Q(X , f (X ), f (γX ), f (γ2 X ), . . . , f (γm−1 X )) = 0 DO
4: IF deg( f ) ≤ k − 1 and f (X ) satisfies (14.2) for at least t values of i THEN
5: Add f (X ) to Ł.
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 satis-
fies 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.
Note that due to the degree constraints on the A i (X )’s and f (X ), we have
deg (R) ≤ D + k − 1,
since deg( f (γi X )) = deg( f (X )). On the other hand, for every 0 ≤ i < N where (14.1) is satisfied
we have ) * ) *
R γmi = Q γmi , y mi , . . . , y m(i +1)−1 = 0,
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 satis-
fied if we pick + ,
N −k +1
D= .
m +1
This in turn implies that the condition in Claim 14.2.2 is satisfied if
N −k +1 N + m(k − 1)
t> +k −1 = .
m +1 m +1
Thus, the above would be satisfied if
- ) m *.
N mk 1
t≥ + =N + mR ,
m +1 m +1 m +1 m +1
Theorem 14.2.3. Algorithm 17 can list decode folded Reed-Solomon code with folding parameter
m
m ≥ 1 and rate R up to m+1 (1 − mR) fraction of errors.
187
1
m=1
m=2
m=2
m=4
Johnson bound
0.8
0.6
R
0.4
0.2
0
0 0.2 0.4 0.6 0.8 1
δ
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.
188
f (γ3i ) f (γ3i +1 ) f (γ3i +2 )
y 3i y 3i +1 y 3i +2
y 3i y 3i +1 y 3i +1 y 3i +2
Thus, in the proof of Claim 14.2.2, for each agreement we can now get two roots for the
polynomial R(X ). In general for an agreement over one Fq m symbols translates into m − s + 1
agreement over Fsq for any 1 ≤ s ≤ m (by “sliding a window" of size s over the m symbols from
Fq ). Thus, in this new idea the agreement is m − s + 1 times more than before which leads to the
mR
mR term in Theorem 14.2.3 going down to m−s+1 . Then making s smaller than m but still large
enough we can get down the relative agreement to R + ε, as desired. There is another change
that needs to be done to make the argument go through: the interpolation polynomial Q now
has to be (s + 1)-variate instead of the earlier (m + 1)-variate polynomial. Algorithm 18 has the
details.
Correctness of Algorithm 18. Next, we analyze the correctness of Algorithm 18 as well as com-
pute its list decoding error bound. We begin with the result showing that there exists a Q with
the required properties for Step 1.
/ 0
Lemma 14.3.1. If D ≥ N (m−s+1)−k+1
s+1
, then there exists a non-zero polynomial Q(X , Y1 , ..., Y s )
that satisfies Step 1 of the above algorithm.
Proof. Let us consider all coefficients of all polynomials A i as variables. Then the number of
variables will be
D + k + s(D + 1) = (s + 1)(D + 1) + k − 1.
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:
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:
y0 ym y n−m
.. .. ··· .. m×N n
y= . . . ∈ Fq , N=
m
y m−1 y 2m−1 y n−1
O UTPUT: All polynomials f (X ) ∈ Fq [X ] of degree at most k − 1 such that for at least t values of
0≤i <N
! "
f γmi y mi
.. ..
= (14.4)
! m(i. +1)−1 " .
f γ y m(i +1)−1
with deg[A 0 ] ≤ D + k − 1 and deg[A i ] ≤ D for every 1 ≤ i ≤ s such that for all 0 ≤ i < N and
0 ≤ j ≤ m − s, we have
Q(γi m+ j , y i m+ j , ..., y i m+ j +s−1 ) = 0. (14.5)
2: Ł ← 0
3: FOR every f (X ) ∈ Fq [X ] such that
! ! " ! " ! ""
Q X , f (X ), f γX , f γ2 X , . . . , f γs−1 X ≡ 0 (14.6)
DO
4: IF deg( f ) ≤ k − 1 and f (X ) satisfies (14.2) for at least t values of i THEN
5: Add f (X ) to Ł.
6: RETURN Ł
deg(R) ≤ D + k − 1. (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 " y mi
f γmi +1
y mi +1
· ·
= ,
· ·
! · "
·
f γm(i +1)−1 y m(i +1)−1
then for all 0 ≤ j ≤ m − s, we have:
) * ) ) * ) * ) **
R γmi + j = Q γmi + j , f γmi + j , f γmi +1+ j , ..., f γmi +s−1+ j
) *
= Q γmi + j , y mi + j , y mi +1+ j , ..., y mi +s−1+ j = 0.
In the above, the first equality follows as f (X ) agrees with y in column i while the second equal-
ity 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.
191
Theorem 14.3.3. Algorithm 18 can list decode folded Reed-Solomon code with folding parameter
s
m ≥ 1 and rate R up to s+1 (1 − mR/(m − s + 1)) fraction of errors.
1
m=6,s=6
m=9, s=6
m=12, s=6
m=15, s=6
Johnson bound
0.8
0.6
R
0.4
0.2
0
0 0.2 0.4 0.6 0.8 1
δ
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.
192
B (γk−1 ) f0 −a 0,k−1
B (γk−2 ) f1 −a 0,k−2
× =
Figure 14.10: The system of linear equations with the variables f 0 , . . . , f k−1 forming the coeffi-
1
cients of the polynomial f (X ) = k−1 i
i =0 f i X that we want to output. The constants a j ,0 are ob-
tained 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 s−1 solutions to f 0 , f 1 , .., f k−1 (where f (X ) = f 0 + f 1 X + ... +
f k−1 X k−1 ) to the equations
! " ! "
A 0 (X ) + A 1 (X ) f (X ) + A 2 (X ) f γX + ... + A s (X ) f γs−1 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 im-
plies 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
D+k−1
2
A i (X ) = a i j X j for every 0 ≤ i ≤ s,
j =0
193
Claim 14.3.5. For every 0 ≤ j ≤ k − 1:
We defer the proof of the claim above for now. Suppose that the above claim is correct. Then
as γ is a generator of Fq , 1, γ, γ2 , ..., γk−1 are distinct (since k − 1 ≤ q − 2). Further, by the degree
mantra (Proposition 5.2.3) at most s − 1 of these elements are roots of the polynomial B (X ).
Therefore by Claim 14.3.5, the number of solutions to f 0 , f 1 , ..., f k−1 is at most q s−1 . 2
We are almost done except we need to remove our earlier assumption that X does not divide
every A i . Towards this end, we essentially just factor out the largest common power of X from
all of the A i ’s, and proceed with the reduced polynomial. Let l ≥ 0 be the largest l such that
A i (X ) = X l A (i (X ) for 0 ≤ i ≤ s; then X does not divide all of A (i (X ) and we have:
! "
X l A (0 (X ) + A (1 (X ) f (X ) + · · · + A (s (X ) f (γs−1 X ) ≡ 0.
Thus we can do the entire argument above by replacing A i (X ) with A (i (X ) since the above con-
straint implies that A (i (X )’s also satisfy (14.8).
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 γs−1 X . Recall that we have C (X ) ≡ 0. If we expand
out each polynomial multiplication, we have:
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+k−1 X D+k−1 .
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 s−1 .
194
So we have D +k linear equations in variables f 0 , . . . , f k−1 , and we are seeking those solutions
such that c j = 0 for every 0 ≤ j ≤ D + k − 1. We will only consider the 0 ≤ j ≤ k − 1 equations. We
first look at the equation for j = 0: c 0 = 0. This implies the following equalities:
0 = a 0,0 + f 0 a 1,0 + f 0 a 2,0 + · · · + f 0 a s,0 (14.11)
! "
0 = a 0,0 + f 0 a 1,0 + a 2,0 + · · · + a s,0 (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:
−a 0,0
• Case 1: B (1) += 0. In this case, (14.13) implies that f 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 γs−1 + f 0 a s,1
3 4
! " 2s
s−1
0 = a 0,1 + f 1 a 1,0 + a 2,0 γ + · · · + a s,0 γ + f0 a l ,1
l =1
where b 0(1) =
1s
l =1
a l ,1 is a constant. We have two possible cases:
−a 0,1 − f 0 b 0(1)
• Case 1: B (γ) += 0. In this case, by (14.14), we have f 1 = B (γ) and there is a unique
choice for f 1 given fixed f 0 .
195
• Case 1: B (γ j ) += 0. In this case, by (14.15), we have
1 j −1 (j)
−a 0, j − f b
l =0 l l
fj = (14.16)
B (γ j )
We now revisit the proof above and make some algorithmic observations. First, we note that
to compute all the tuples ( f 0 , . . . , f k−1 ) that satisfy (14.8) one needs to solve the linear equations
(14.15) for j = 0, . . . , k − 1. One can state this system of linear equation as (see also Figure 14.10)
f0 −a 0,k−1
.. ..
C · . = . ,
f k−1 −a 0,0
(j)
where C is a k × k upper triangular matrix. Further each entry in C is either a 0 or B (γ j ) or b l –
each of which can!be computed
" in O(s log s) operations over Fq . Thus, we can setup this system
2
of equations in O s log sk operations over Fq .
Next, we make the observation that all the solutions to (14.8) form an affine subspace. Let
0 ≤ d ≤ s − 1 denote the number of roots of B (X ) in {1, γ, . . . , γk−1 }. Then since there will be
j
d unconstrained variables among f 0 , . . . , f k−1 (one
5 of every j such
6 that B (γ ) = 0), it is not too
hard to see that all the solutions will be in the set M · x + z|x ∈ Fdq , for some k ×d matrix M and
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 ∈ Fk×d q and z ∈ Fkq . Further, M and z can be computed from the poly-
nomials A 0 (X ), . . . , A s (X ) with O(s log sk 2 ) operations over Fq .
196
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.
Next, we analyze the run time of the algorithm. Throughout, we will assume that all polyno-
mials 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) oper-
ations 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 s−1 potential solutions as in Steps 7-11. (However, we’ll
see a twist in Section 14.4.) The latter would imply a total of O(s log s(N m)2 ) + O(q s−1 · (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 s−1 · (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
s ) m *
· 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
It is easy to check that one can choose
such that the bounds in (14.18) are satisfied. Using the bounds from (14.18) in (14.17) implies
that the algorithm can handle at least
Theorem 14.3.8. There exist strongly explicit folded Reed-Solomon codes of rate R that for large
enough block length N can be list decoded from 1 − R − ε fraction of errors (for any small enough
! "O(1/ε) ! "O(1/ε) ! "O(1/ε2 )
ε > 0) in time Nε . The worst-case list size is Nε and the alphabet size is Nε .
198
Question 14.0.1 in the affirmative. Guruswami [19] reproved this result but with a much sim-
pler proof. In this chapter, we studied the proof due to Guruswami. Guruswami in [19] cred-
its Salil Vadhan for the the interpolation step. An algorithm presented in Brander’s 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 s−1 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 s−1 . 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. How-
ever, 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 de-
code 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 effi-
cient 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 de-
coded 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 al-
gorithm 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 s−2 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 in-
stance. 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)
Even the question above with N (1/ε) is still open.
However, if one is willing to consider codes other than folded Reed-Solomon codes in or-
der to answer to achieve list decoding capacity with smaller list size (perhaps with one only
dependent on ε), then there is good news. Guruswami in the same paper that presented the
algorithm in this chapter also present a randomized construction of codes of rate R that are
(1 − R − ε,O(1/ε2 ))-list decodable codes [19]. This is of course worse than what we know from
the probabilistic method. However, the good thing about the construction of Guruswami comes
with an O(N /ε)O(1/ε) -list decoding algorithm.
Next we briefly mention the key ingredient in the result above. To see the potential for im-
provement consider Corollary 14.3.6. The main observation is that all the potential solutions
lie in an affine subspace of dimension s − 1. The key idea in [19] was use the folded Reed-
Solomon encoding for a special subset of the message space Fkq . Call a subspace S ⊆ Fkq to be a
(q, k, ε, $, L)-subspace evasive subset if
200
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 1−R −ε fraction of errors (for any small enough ε > 0) in time O εN2 +
! 1 "O(1/ε) ! "O(1/ε) ! "O(1/ε2 )
ε . 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 Gu-
ruswami and Xing [29].
201
Chapter 15
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."
Definition 15.1.1 (Hash Function). Given a domain D and a range Σ, (typically, with |Σ| < |D|),
a hash function is a map
h : D → Σ.
Of course, the definition above is too general and we will later specify properties that will
make the definition more interesting.
Integrity Checks on Routers. Routers on the Internet process a lot of packets in a very small
amount of time. Among other tasks, router has to perform an “integrity check" on the packet
to make sure that the packet it is processing is not corrupted. Since the packet has well defined
fields, the router could check if all the field have valid entries. However, it is possible that one of
the valid entry could be turned into another valid entry. However, the packet as a whole could
still be invalid.
If you have progressed so far in the book, you will recognize that the above is the error detec-
tion problem and we know how to do error detection (see e.g., Proposition 2.3.3). However, the
181
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 transmis-
sion, 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:
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. As-
sume 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 respec-
tively). 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 15.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?
183
The second workaround is to define a family of hash functions and then argue that the prob-
ability of collision is small for a hash function chosen randomly from the family. More formally,
we define a hash family:
Definition 15.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 → Σ.
Definition 15.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, we’re 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 15.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 de-
terministic 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 15.1.2. The basic idea is simple: we will mod-
ify 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 observa-
tion.
Claim 15.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 h
j =1 i j(a )=h i (x) . The probability bound above along with the
linearity of expectation (Proposition 3.1.4) and Lemma 3.1.3 completes the proof.
185
Thus, Proposition 15.2.4 answers Question 15.1.2 in the affirmative if we can answer the
following question in the affirmative:
&1'
Question 15.2.1. Given a domain D and an integer N ≥ 1, does there exist an O N -almost
universal hash function with domain D and a range Σ such that |Σ| = O(N )?
We will answer the question above (spoiler alert!) in the affirmative in the next section.
Definition 15.3.1. Given a hash family H = {h 1 , . . . , h n } where for each i ∈ [n], h i : D → Σ, con-
sider the following associated code
C H : D → Σn ,
where for any x ∈ D, we have
The connection also goes the other way. That is, given an (n, k)Σ code C , we call the associated
hash family H C = {h 1 , . . . , h n ), where for every i ∈ [n],
h i : Σk → Σ
Next we show that an ε-almost universal hash family is equivalent to a code with good dis-
tance.
Proposition 15.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
186
This implies that
! " |{i |h i (x) = h i (y)}| n − ∆(C H (x),C H (y)) ∆(C H (x),C H (y))
Pr h i (x) = h i (y) = = = 1− ,
i n n n
where the second equality follows from the definition of the Hamming distance. By the defi-
nition 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
Algorithm 8 Verification for Data Possession Verification
I NPUT: Index i of data x ∈ D
O UTPUT: 1 if Server has x and 0 otherwise
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 15.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.
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 15.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 proto-
col 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.
• We will need a general bound that shows that list decoding is possible close to 100% for
any C H for an ε-almost universal hash family; and
• Even if the above is possible, what will we do when a list decoding algorithm returns a list
of possible data?
We will get around the first concern by using the Johnson bound 7.3.1. To get around the second
issue we will indirectly use “side information" (like we mentioned in Section 7.2). For the latter,
we will need the notion of Kolmogorov complexity, which captures the amount of information
content in any given string. For our purposes, the following informal description is enough:
Definition 15.4.2. Given a string x, its Kolmogorov complexity, denoted by K (x) is the minimum
of |y| + |D|, where D is a decompression algorithm that on input y outputs x (where |x| and |D|
are the length of x and (a description of ) D in bits).
Informally, K (x) is the amount of information that can be obtained algorithmically from x.
Kolmogorov complexity is a fascinating topic that it outside the scope of this book. Here we will
only need to use the definition of K (x). We are now ready to prove the following list decoding
counterpart of Theorem 15.4.1:
5
Note that Theorem 15.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 15.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 informa-
tion 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 15.4.1, as even though
probability of catching a cheating server has gone up our guarantee is weaker. Unlike Theo-
rem 15.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 mem-
ory.
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 15.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 . (15.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.)
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 15.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 (15.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
Chapter 16
For the time being let us assume that we can somehow convert a fingerprint (image) some-
how to a string f . (We will see more details on this shortly.) Then we have the following naive
solution:
215
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 fin-
gerprints 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:
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 so-
lution we propose. Technology has not yet developed to the point where we can securely elimi-
nate 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 fin-
gerprinting 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 simultane-
ously: (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.
We claim that if we can solve the above problem, then we can solve the problem of designing a
secure hash function for fingerprints. We leave the details as an exercise. (Hint: pick s at random
and then in addition to the locked version of s also store h(s), where h is an off-the-shelf secure
hash function for strings.)
We will now formalize the fuzzy vault problem.
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
# $ # $
Fq Fq
• LOCK : Fkq × →
t n
# $ # $
Fq Fq
• UNLOCK : × → Fkq
t n
The goal of the problem is to define the functions LOCK and UNLOCK such that they satisfy
these two properties (for some c < t ):
!F q "
1. (c-completeness.) For any f , f % ∈ t
such that | f − f % | ≤ c, the following should hold:
! "
UNLOCK LOCK (s, f ), 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.
218
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 sound-
ness).
We begin with the LOCK function:
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: IF there exists a j ∈ [t ] such that αi = β j THEN
3: z j ← yi
4: ELSE
5: 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
points {β1 , . . . , βt } and output resulting message as s.
Lemma 16.2.1. The pair (LOCK2 , UNLOCK2 ) of functions is (t − k)-complete. Further, both func-
tions can be implemented in polynomial time.
Proof. Let us assume | f \ f % | ≤ t −k. Now as both f and f % have exactly t values, this means that
z has at most t − k erasures. Thus, by Theorem 11.2.1, Step 6 will output s and UNLOCK2 can
be implemented in polynomial time. Further, the claim on the polynomial run time of LOCK2
follows from the fact that one can do encoding of Reed-Solomon code in polynomial time.
219
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."
Algorithm 25 LOCK3
I NPUT: Fingerprint f = {α1 , . . . , αt } and secret s = (s 0 , . . . , s k−1 ) ∈ Fkq
O UTPUT: Vault with f locking s
1: R, T ← *
%
2: P s (X ) ← ik−1=0 s i · X
i
3: FOR i = 1, . . . , t DO
4: T ← T ∪ {αi }
5: FOR i = t + 1, . . . , n DO
6: αi be a random element from Fq \ T
7: T ← T ∪ {αi }
8: FOR every α ∈ T DO
9: γ be a random element from Fq \ P s (α)
10: R ← R ∪ {(α, γ)}
11: Randomly permute R
12: RETURN R
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: IF there exists a j ∈ [n] such that αi = β j THEN
3: z j ← yi
4: ELSE
5: 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
evaluation points {β1 , . . . , βt } and output resulting message as s.
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 sound-
ness 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
# $ ( ) ( ) ( )
n 1 t 1 n−t 1 n t
· · 1− ≥ .
t q q 3 qt
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
16.4 Bibliographic Notes
The fuzzy vault presented in this chapter is due to Juels and Sudan [33]. The “inverse Markov
inequality" first appeared in Dumer et al. [8].
222
Appendix A
Notation Table
183
E[V ] Expectation of a random variable V Definition 3.1.2
1E Indicator variable for event E Section 3.1
H q (x) x logq (q − 1) − x logq x − (1 − x) logq (1 − x) Definition 3.3.1
H q−1 (y) Unique x ∈ [0, 1 − 1/q] such that H q (x) = y Section 3.3.2
deg(P ) Degree of polynomial P (X ) Definition 5.1.2
Fq [X ] The set of all univariate polynomials in X over Fq Section 5.1
184