Walsh–Hadamard code
In coding theory, the Walsh–Hadamard code, named after the American mathematician Joseph Leonard Walsh and the French mathematician Jacques Hadamard, is an example of a linear code over a binary alphabet that maps messages of length n to codewords of length 2n. The Walsh–Hadamard code is unique in that each non-zero codeword has Hamming weight of exactly 2n − 1, which implies that the distance of the code is also 2n − 1. In standard coding theory notation, this means that the Walsh–Hadamard code is a [2n,n,2n / 2]2-code. The Hadamard code can be seen as a slightly improved version of the Walsh–Hadamard code as it achieves the same block length and minimum distance with a message length of n + 1, that is, it can transmit one more bit of information per codeword, but this improvement comes at the expense of a slightly more complicated construction.
The Walsh–Hadamard code is a locally decodable code, which provides a way to recover parts of the original message with high probability, while only looking at a small fraction of the received word. This gives rise to applications in computational complexity theory and particularly in the design of probabilistically checkable proofs. It can also be shown that, using list decoding, the original message can be recovered as long as less than 1/2 of the bits in the received word have been corrupted.
In code division multiple access (CDMA) communication, the Walsh–Hadamard code is used to define individual communication channels. It is usual in the CDMA literature to refer to codewords as “codes”. Each user will use a different codeword, or “code”, to modulate their signal. Because Walsh–Hadamard codewords are mathematically orthogonal, a Walsh-encoded signal appears as random noise to a CDMA capable mobile terminal, unless that terminal uses the same codeword as the one used to encode the incoming signal.[1]
Contents |
[edit] Definition
The
generator matrix G for the Walsh–Hadamard code of dimension n is given by
where
is the vector corresponding to the binary representation of i. In other words,
is the list of all vectors of {0,1}n in some lexicographic order. For example, the generator matrix for the Walsh–Hadamard code of dimension 3 is
As is possible for any linear code generated by a generator matrix, we encode a message
, viewed as a row vector, by computing its codeword
using the vector-matrix product in the vector space over the finite field
:
This way, the matrix G defines a linear operator
and we can write z = WH(x).[2]
A more explicit, equivalent definition of WH uses the scalar product
over
:
- For any two strings
, we have 
Then the Walsh–Hadamard code is the function
that maps every string
into the string
satisfying
for every
(where zy denotes the yth coordinate of z, identifying {0,1}n with
in some way).
[edit] Distance
The distance of a code is the minimum Hamming distance between any two distinct codewords, i.e., the minimum number of positions at which two distinct codewords differ. Since the Walsh–Hadamard code is a linear code, the distance is equal to the minimum Hamming weight among all of its non-zero codewords. All non-zero codewords of the Walsh–Hadamard code have a Hamming weight of exactly 2n − 1 by the following argument.
Let
be the
generator matrix for a Walsh-Hadamard code of dimension n.
Let wt(x) represent the Hamming weight of vector x.
Let
be a non-zero message in {0,1}n.
We want to show that
for all non-zero codewords. Remember that all arithmetic is done over
, which is the finite field of size 2.
Let xi be a non-zero bit of arbitrary message, x. Pair up the columns of G such that for each pair (gj,gk), gj + gk = ei (where ei is the zero vector with a 1 in the ith position). By the way G is constructed, there will be exactly 2n − 1 pairs. Then note that
.
, implies that exactly one of
,
must be 1. There are 2n − 1 pairs, so
will have exactly 2n − 1 bits that are a 1.
Therefore, the Hamming weight of every codeword in the code is exactly 2n − 1.
Being a linear code, this means that the distance of the Walsh-Hadamard code is 2n − 1.
[edit] Locally Decodable
A locally decodable code is a code that allows a single bit of the original message to be recovered with high probability by only looking at a small portion of the received word. A code is q-query locally decodable if a message bit, xi, can be recovered by checking q bits of the received word. More formally, a code,
, is
-locally decodable, if there exists a probabilistic decoder,
, such that (Note: Δ(x,y) represents the Hamming distance between vectors x and y):
,
implies that ![Pr[D(y)_i = x_i] \geq \frac{1}{2} + \epsilon, \forall i \in [k]](http://upload.wikimedia.org/wikipedia/en/math/7/3/2/7326f23ed74f1f6eeab2e3eb921a3ce4.png)
Theorem 1: The Walsh–Hadamard code is
-locally decodable for
.
Lemma 1: For all codewords, c in a Walsh–Hadamard code, C, ci + cj = ci + j, where ci,cj represent the bits in c in positions i and j respectively, and ci + j represents the bit at position (i + j).
[edit] Proof of Lemma 1
Let
be the codeword in C corresponding to message x
Let
be the generator matrix of C
By definition,
. From this,
. By the construction of G, gi + gj = gi + j. Therefore, by substitution,
.
[edit] Proof of Theorem 1
To prove theorem 1 we will construct a decoding algorithm and prove its correctness.
[edit] Algorithm
Input: Received word 
For each
:
- Pick
independently at random - Pick
such that j + k = ei where j + k is the bitwise xor of j and k. 
Output: Message 
[edit] Proof of correctness
For any message, x, and received word y such that y differs from c = C(x) on at most δ fraction of bits, xi can be decoded with probability at least
.
By lemma 1,
. Since j and k are picked uniformly, the probability that
is at most δ. Similarly, the probability that
is at most δ. By the union bound, the probability that either yj or yk do not match the corresponding bits in c is at most 2δ. If both yj and yk correspond to c, then lemma 1 will apply, and therefore, the proper value of xi will be computed. Therefore the probability xi is decoded properly is at least 1 − 2δ. Therefore,
and for
to be positive,
.
Therefore, the Walsh–Hadamard code is
locally decodable for 
[edit] See also
[edit] Notes
- ^ "CDMA Tutorial: Intuitive Guide to Principles of Communications". Complex to Real. http://www.complextoreal.com/CDMA.pdf. Retrieved 4 August 2011.
- ^ Section 19.2.2 of Arora & Barak (2009).
[edit] References
- Arora, Sanjeev; Barak, Boaz (2009), Computational Complexity: A Modern Approach, Cambridge, ISBN 978-0-521-42426-4, http://www.cs.princeton.edu/theory/complexity/
- Lecture notes of Atri Rudra: Hamming code and Hamming bound



, we have 
independently at random
such that 