You are on page 1of 35

BCH Codes

Yunghsiang S. Han
Graduate Institute of Communication Engineering,
National Taipei University
Taiwan
E-mail: yshan@mail.ntpu.edu.tw
Y. S. Han BCH codes 1
Description of BCH Codes
The Bose, Chaudhuri, and Hocquenghem (BCH) codes form a
large class of powerful random error-correcting cyclic codes.
This class of codes is a remarkable generalization of the
Hamming code for multiple-error correction.
We only consider binary BCH codes in this lecture note.
Non-binary BCH codes such as Reed-Solomon codes will be
discussed in next lecture note.
For any positive integers m 3 and t < 2
m1
, there exists a
binary BCH code with the following parameters:
Block length: n = 2
m
1
Number of parity-check digits: n k mt
Minimum distance: d
min
2t + 1.
Graduate Institute of Communication Engineering, National Taipei University
Y. S. Han BCH codes 2
We call this code a t-error-correcting BCH code.
Let be a primitive element in GF(2
m
). The generator
polynomial g(x) of the t-error-correcting BCH code of length
2
m
1 is the lowest-degree polynomial over GF(2) which has
,
2
,
3
, . . . ,
2t
as its roots.
g(
i
) = 0 for 1 i 2t and g(x) has ,
2
, . . . ,
2t
and their
conjugates as all its roots.
Let
i
(x) be the minimal polynomial of
i
. Then g(x) must be
the least common multiple of
1
(x),
2
(x), . . . ,
2t
(x), i.e.,
g(x) = LCM{
1
(x),
2
(x), . . . , (x)
2t
}.
If i is an even integer, it can be expressed as i = i

, where i

is
Graduate Institute of Communication Engineering, National Taipei University
Y. S. Han BCH codes 3
odd and > 1. Then
i
=
_

_
2
is a conjugate of
i

. Hence,

i
(x) =
i
(x).
g(x) = LCM{
1
(x),
3
(x), . . . ,
2t1
(x)}.
The degree of g(x) is at most mt. That is, the number of
parity-check digits, n k, of the code is at most equal to mt.
If t is small, n k is exactly equal to mt.
Since is a primitive element, the BCH codes dened are usually
called primitive (or narrow-sense) BCH codes.
Graduate Institute of Communication Engineering, National Taipei University
Y. S. Han BCH codes 4
Example
Let be a primitive element of GF(2
4
) such that 1 + +
4
= 0.
The minimal polynomials of ,
3
, and
5
are

1
(x) = 1 +x +x
4
,

3
(x) = 1 +x +x
2
+x
3
+x
4
,

5
(x) = 1 +x +x
2
,
respectively. The double-error-correcting BCH code of length
n = 2
4
1 = 15 is generated by
g(x) = LCM{
1
(x),
3
(x)}
= (1 +x +x
4
)(1 +x +x
2
+x
3
+x
4
)
= 1 +x
4
+x
6
+x
7
+x
8
.
n k = 8 such that this is a (15, 7, 5) code. Since the weight of
Graduate Institute of Communication Engineering, National Taipei University
Y. S. Han BCH codes 5
the generator polynomial is 5, it is a (15, 7, 5) code.
The triple-error-correcting BCH code of length 15 is generated by
g(x) = LCM{
1
(x),
3
(x),
5
(x)}
= (1 +x +x
4
)(1 +x +x
2
+x
3
+x
4
)(1 +x +x
2
)
= 1 +x +x
2
+x
4
+x
5
+x
8
+x
10
.
n k = 10 such that this is a (15, 5, 7) code. Since the weight
of the generator polynomial is 7, it is a (15, 5, 7) code.
The single-error-correcting BCH code of length 2
m
1 is a
Hamming code.
Graduate Institute of Communication Engineering, National Taipei University
Y. S. Han BCH codes 6

Representations of GF(2
4
). p(z) = z
4
+ z + 1
Exponential
Notation
Polynomial
Notation
Binary
Notation
Decimal
Notation
Minimal
Polynomial
0 0 0000 0 x
!
0
1 0001 1 x + 1
!
1
z 0010 2 x
4
+ x + 1
!
2
z
2
0100 4 x
4
+ x + 1
!
3
z
3
1000 8 x
4
+ x
3
+ x
2
+ x + 1
!
4
z + 1 0011 3 x
4
+ x + 1
!
5
z
2
+ z 0110 6 x
2
+ x + 1
!
6
z
3
+ z
2
1100 12 x
4
+ x
3
+ x
2
+ x + 1
!
7
z
3
+ z + 1 1011 11 x
4
+ x
3
+ 1
!
8
z
2
+ 1 0101 5 x
4
+ x + 1
!
9
z
3
+ z 1010 10 x
4
+ x
3
+ x
2
+ x + 1
!
10
z
2
+ z + 1 0111 7 x
2
+ x + 1
!
11
z
3
+ z
2
+ z + 1 1110 14 x
4
+ x
3
+ 1
!
12
z
3
+ z
2
+ z + 1 1111 15 x
4
+ x
3
+ x
2
+ x + 1
!
13
z
3
+ z
2
+ 1 1101 13 x
4
+ x
3
+ 1
!
14
z
3
+ 1 1001 9 x
4
+ x
3
+ 1
! !
2
!
4
!
8
!
16
! !
!
3
!
6
!
12
!
24
!
48
! !
3
! !
9
Graduate Institute of Communication Engineering, National Taipei University
Y. S. Han BCH codes 7
Examples of Finite Fields

GF(4
2
) ! GF(4)[z]/z
2
+z+2, p(z) = z
2
+z+2
Exponential
Notation
Polynomial
Notation
Binary
Notation
Decimal
Notation
Minimal
Polynomial
0 0 00 0
!
0
1 01 1 x + 1
!
1
z 10 4 x
2
+ x + 2
!
2
z + 2

12 6 x
2
+ x + 3
!
3
3z + 2

32 14 x
2
+ 3x + 1

!
4
z + 1 11 5 x
2
+ x + 2
!
5
2 02 2 x + 2
!
6
2z 20 8 x
2
+2x + 1
!
7
2z + 3 23 11 x
2
+ 2x + 2
!
8
z + 3 13 7 x
2
+ x + 3
!
9
2z + 2 22 10 x
2
+ 2x + 1
!
10
3 03 3 x + 3
!
11
3z 30 12 x
2
+ 3x + 3
!
12
3z + 1 31 13 x
2
+ 3x + 1
!
13
2z + 1 21 9 x
2
+ 2x + 2
!
14
3z + 3 33 15 x
2
+ 3x + 3
! = z
!
15
= 1
Operate on
GF(4)
Primitive polynomial over GF(4)
Graduate Institute of Communication Engineering, National Taipei University
Y. S. Han BCH codes 8
BCH Codes of Lengths Less than 2
10
1 (1)
! " # $ ! " # $ ! " # $ " # $ " # $
% & ' ( 63 )' & ()& *+ (% )** (,& - )** &( )-
' (* (( ( (, (+ '% (' (&- (+ .% %+
& ) (. (( %. (* (&( (( ** %(
* % (+ (% )- )( (.% () '& ')
* %( ). ( & (* )) )% (** (% '* '%
)( ) 7 ()& ()+ ( (* )& ('& (' %& '*
(. % ((% ) , %( (%- (* )- '&
(( * (+. % , )** )'& ( (%( (, )( **
. & -- ' )%- ) ()% (- (% *-
. .% *& ( -) * )%( % ((* )( - .%
*( ) ,* . ))% ' (+& )) *(( *+) (
'* % &, & )(* * -- )% '-% )
%- ' &( - )+& . -( )* ',' %
%. * .' (+ (-- & ,& ). '&* '
%+ . *& (( (-( , &- )& '.. *
For t small
n k = mt
Graduate Institute of Communication Engineering, National Taipei University
Y. S. Han BCH codes 9
BCH Codes of Lengths Less than 2
10
1 (2)
n k t n k t n k t n k t n k t
511 457 6 511 322 22 511 193 43 511 58 91 1023 933 9
448 7 313 23 184 45 49 93 923 10
439 8 304 25 175 46 40 95 913 11
430 9 295 26 166 47 31 109 903 12
421 10 286 27 157 51 28 111 893 13
412 11 277 28 148 53 19 119 883 14
403 12 268 29 139 54 10 121 873 15
394 13 259 30 130 55 1013 1 863 16
385 14 250 31 121 58 1023 1003 2 858 17
376 15 241 36 112 59 993 3
367 16 238 37 103 61 983 4
358 18 229 38 94 62 973 5
349 19 220 39 85 63 963 6
340 20 211 41 76 85 953 7
331 21 202 42 67 87 943 8
Graduate Institute of Communication Engineering, National Taipei University
Y. S. Han BCH codes 10
Graduate Institute of Communication Engineering, National Taipei University
Y. S. Han BCH codes 11
Graduate Institute of Communication Engineering, National Taipei University
Y. S. Han BCH codes 12
Minimal Polynomials of the Elements in GF(2
6
)
Graduate Institute of Communication Engineering, National Taipei University
Y. S. Han BCH codes 13
Generator Polynomials of All BCH Codes of Length 63
Graduate Institute of Communication Engineering, National Taipei University
Y. S. Han BCH codes 14
Parity-Check Matrix of a BCH Code
We can dene a t-error-correcting BCH code of length
n = 2
m
1 in the following manner: A binary n-tuple
v = (v
0
, v
1
, . . . , v
n1
) is a code word if and only if the polynomial
v(x) = v
0
+v
1
x + +v
n1
x
n1
has ,
2
, . . . ,
2t
as roots.
Since
i
is a root of v(x) for 1 i 2t, then
v(
i
) = v
0
+v
1

i
+v
2

2i
+ +v
n1

(n1)i
= 0.
Graduate Institute of Communication Engineering, National Taipei University
Y. S. Han BCH codes 15
This equality can be written as a matrix product as follows:
(v
0
, v
1
, . . . , v
n1
)
_

_
1

2i
.
.
.

(n1)i
_

_
= 0 (1)
for 1 i 2t.
Graduate Institute of Communication Engineering, National Taipei University
Y. S. Han BCH codes 16
Let
H =
_

_
1
2

3

n1
1 (
2
) (
2
)
2
(
2
)
3
(
2
)
n1
1 (
3
) (
3
)
2
(
3
)
3
(
3
)
n1
.
.
.
.
.
.
1 (
2t
) (
2t
)
2
(
2t
)
3
(
2t
)
n1
_

_
. (2)
From (1), if v = (v
0
, v
1
, . . . , v
n1
) is a code word in the
t-error-correcting BCH code, then
v H
T
= 0.
If an n-tuple v satises the above condition,
i
is a root of the
polynomial v(x). Therefore, v must be a code word in the
t-error-correcting BCH code.
Graduate Institute of Communication Engineering, National Taipei University
Y. S. Han BCH codes 17
H is a parity-check matrix of the code.
If for some i and j,
j
is a conjugate of
i
, then v(
j
) = 0 if and
only if v(
i
) = 0.
The H matrix can be reduced to
H =
_

_
1
2

3

n1
1 (
3
) (
3
)
2
(
3
)
3
(
3
)
n1
1 (
5
) (
5
)
2
(
5
)
3
(
5
)
n1
.
.
.
.
.
.
1 (
2t1
) (
2t1
)
2
(
2t1
)
3
(
2t1
)
n1
_

_
.
If each entry of H is replaced by its corresponding m-tuple over
GF(2) arranged in column form, we obtain a binary parity-check
matrix for the code.
Graduate Institute of Communication Engineering, National Taipei University
Y. S. Han BCH codes 18
BCH Bound
The t-error-correcting BCH code dened has minimum distance
at least 2t + 1.
Proof: We need to show that no 2t of fewer columns of H sum
to zero. Suppose that there exists a nonzero code vector v with
weight 2t. Let v
j
1
, v
j
2
, . . . , v
j

be the nonzero components of


v. Then
0 = v H
T
= (v
j
1
, v
j
2
, . . . , v
j

)
_

j
1
(
2
)
j
1
(
2t
)
j
1

j
2
(
2
)
j
2
(
2t
)
j
2

j
3
(
2
)
j
3
(
2t
)
j
3
.
.
.
.
.
.
.
.
.

(
2
)
j

(
2t
)
j

_
Graduate Institute of Communication Engineering, National Taipei University
Y. S. Han BCH codes 19
= (1, 1, . . . , 1)
_

j
1
(
j
1
)
2
(
j
1
)
2t

j
2
(
j
2
)
2
(
j
2
)
2t

j
3
(
j
3
)
2
(
j
3
)
2t
.
.
.
.
.
.
.
.
.

(
j

)
2
(
j

)
2t
_

_
.
The equality above implies the following equality:
(1, 1, . . . , 1)
_

j
1
(
j
1
)
2
(
j
1
)

j
2
(
j
2
)
2
(
j
2
)

j
3
(
j
3
)
2
(
j
3
)

.
.
.
.
.
.
.
.
.

(
j

)
2
(
j

_
= 0,
Graduate Institute of Communication Engineering, National Taipei University
Y. S. Han BCH codes 20
which the second matrix on the left is a square matrix. To
satisfy the above equality, the determinant of the matrix
must be zero. That is,

j
1
(
j
1
)
2
(
j
1
)

j
2
(
j
2
)
2
(
j
2
)

j
3
(
j
3
)
2
(
j
3
)

.
.
.
.
.
.
.
.
.

(
j

)
2
(
j

= 0.
Graduate Institute of Communication Engineering, National Taipei University
Y. S. Han BCH codes 21
Then

j
1
+j
2
++j

1
j
1

j
1
(1)
1
j
2

j
2
(1)
1
j
3

j
3
(1)
.
.
.
.
.
.
.
.
.
1
j

(1)

= 0.
The determinant in the equality above is a Vandermonde
determinant which is nonzero. Contradiction!
The parameter 2t + 1 is usually called the designed distance of
the t-error-correcting BCH code.
The true minimum distance of the code might be larger than
2t + 1.
Graduate Institute of Communication Engineering, National Taipei University
Y. S. Han BCH codes 22
Syndrome Calculation
Let
r(x) = r
0
+r
1
x +r
2
x
2
+ +r
n1
x
n1
be the received vector and e(x) the error pattern. Then
r(x) = v(x) + e(x).
The syndrome is a 2t-tuple,
S = (S
1
, S
2
, . . . , S
2t
) = r H
T
,
where H is given by (2).

S
i
= r(
i
) = r
0
+r
1

i
+r
2

2i
+ +r
n1

(n1)i
for 1 i 2t.
Graduate Institute of Communication Engineering, National Taipei University
Y. S. Han BCH codes 23
Dividing r(x) by the minimal polynomial
i
(x) of
i
, we have
r(x) = a
i
(x)
i
(x) + b
i
(x),
where b
i
(x) is the remainder with degree less than that of
i
(x).
Since
i
(
i
) = 0, we have
S
i
= r(
i
) = b
i
(
i
).
Since
1
,
2
, . . . ,
2t
are roots of each code polynomial, v(
i
) = 0
for 1 i 2t.
Then S
i
= e(
i
) for 1 i 2t.
We now consider a general case that is also good for non-binary
case.
Suppose that the error pattern e(x) has v errors at locations
Graduate Institute of Communication Engineering, National Taipei University
Y. S. Han BCH codes 24
0 j
1
< j
2
< < j
v
n. That is,
e(x) = e
j
1
x
j
1
+e
j
2
x
j
2
+ +e
j
v
x
j
v
.

S
1
= e
j
1

j
1
+e
j
2

j
2
+ +e
j
v

j
v
S
2
= e
j
1
(
j
1
)
2
+e
j
2
(
j
2
)
2
+ +e
j
v
(
j
v
)
2
S
3
= e
j
1
(
j
1
)
3
+e
j
2
(
j
2
)
3
+ +e
j
v
(
j
v
)
3
.
.
.
S
2t
= e
j
1
(
j
1
)
2t
+e
j
2
(
j
2
)
2t
+ +e
j
v
(
j
v
)
2t
, (3)
where e
j
1
, e
j
2
, . . . , e
j
v
, and
j
1
,
j
2
, . . . ,
j
v
are unknown.
Any method for solving these equations is a decoding algorithm
for the BCH codes.
Let Y
i
= e
j
i
, X
i
=
j
i
, 1 i v.
Graduate Institute of Communication Engineering, National Taipei University
Y. S. Han BCH codes 25
(3) can be rewritten as follows:
S
1
= Y
1
X
1
+Y
2
X
2
+ +Y
v
X
v
S
2
= Y
1
X
2
1
+Y
2
X
2
2
+ +Y
v
X
2
v
S
3
= Y
1
X
3
1
+Y
2
X
3
2
+ +Y
v
X
3
v
.
.
.
S
2t
= Y
1
X
2t
1
+Y
2
X
2t
2
+ +Y
v
X
2t
v
. (4)
We need to transfer the above set of non-linear equations into a
set of linear equations.
Consider the error-locator polynomial
(x) = (1 X
1
x)(1 X
2
x) (1 X
v
x)
= 1 +
1
x +
2
x
2
+ +
v
x
v
. (5)
Multiplying (5) by Y
i
X
j+v
i
, where 1 j v, and set x = X
1
i
Graduate Institute of Communication Engineering, National Taipei University
Y. S. Han BCH codes 26
we have
0 = Y
i
X
j+v
i
_
1 +
1
X
1
i
+
2
X
2
i
+ +
v
X
v
i
_
.
for 1 i v.
Summing all above v equations, we have
0 =
v

i=1
Y
i
_
X
j+v
i
+
1
X
j+v1
i
+ +
v
X
j
i
_
=
v

i=1
Y
i
X
j+v
i
+
1
v

i=1
Y
i
X
j+v1
i
+ +
v
v

i=1
Y
i
X
j
i
= S
j+v
+
1
S
j+v1
+
2
S
j+v2
+ +
v
S
j
.
We have

1
S
j+v1
+
2
S
j+v2
+ +
v
S
j
= S
j+v
for 1 j v.
Graduate Institute of Communication Engineering, National Taipei University
Y. S. Han BCH codes 27
Putting the above equations into matrix form we have
_

_
S
1
S
2
S
v1
S
v
S
2
S
3
S
v
S
v+1
.
.
.
S
v
S
v+1
S
2v2
S
2v1
_

_
_

v1
.
.
.

1
_

_
=
_

_
S
v+1
S
v+2
.
.
.
S
2v
_

_
. (6)
Since v t, S
1
, S
2
, . . . , S
2v
are all known. Then we can solve for

1
,
2
, . . . ,
v
.
We still need to nd the smallest v such that the above system of
equations has a unique solution.
Graduate Institute of Communication Engineering, National Taipei University
Y. S. Han BCH codes 28
Let the matrix of syndromes, M, be dened as follows:
M =
_

_
S
1
S
2
S
u
S
2
S
3
S
u+1
.
.
.
.
.
.
.
.
.
S
u
S
u+1
S
2u1
_

_
.
M is nonsingular if u is equal to v, the number of errors that
actually occurred. M is singular if u > v.
Proof: Let
A =
_

_
1 1 1
X
1
X
2
X
u
.
.
.
.
.
.
.
.
.
X
u1
1
X
u1
2
X
u1
u
_

_
Graduate Institute of Communication Engineering, National Taipei University
Y. S. Han BCH codes 29
with A
ij
= X
i1
j
and
B =
_

_
Y
1
X
1
0 0
0 Y
2
X
2
0
.
.
.
.
.
.
.
.
.
0 0 Y
u
X
u
_

_
with B
ij
= Y
i
X
i

ij
, where

ij
=
_
_
_
1 i = j
0 i = j
.
We have
_
ABA
T
_
ij
=
u

=1
X
i1

k=1
Y

k
X
j1
k
Graduate Institute of Communication Engineering, National Taipei University
Y. S. Han BCH codes 30
=
u

=1
X
i1

X
j1

=
u

=1
Y

X
i+j1

= M
ij
.
Hence, M = ABA
T
. If u > v, then det(B) = 0 and then
det(M) = det(A) det(B) det(A
T
) = 0. If u = v, then det(B) = 0.
Since A is a Vandermonde matrix with X
i
= X
j
, i = j,
det(A) = 0. Hence, det(M) = 0.
Graduate Institute of Communication Engineering, National Taipei University
Y. S. Han BCH codes 31
The Peterson-Gorenstein-Zierler Algorithm
Graduate Institute of Communication Engineering, National Taipei University
Y. S. Han BCH codes 32
Example
Consider the triple-error-correcting (15, 5) BCH code with
g(x) = 1 +x +x
2
+x
4
+x
5
+x
8
+x
10
. Assume that the received
vector is r(x) = x
2
+x
7
. The operating nite eld is GF(2
4
). Then
the syndromes can be calculated as follows:
S
1
=
7
+
2
=
12
S
2
=
14
+
4
=
9
S
3
=
21
+
6
= 0
S
4
=
28
+
8
=
3
S
5
=
35
+
10
=
0
= 1
S
6
=
42
+
12
= 0.
Graduate Institute of Communication Engineering, National Taipei University
Y. S. Han BCH codes 33
Set v = 3, we have
det(M) =

S
1
S
2
S
3
S
2
S
3
S
4
S
3
S
4
S
5

12

9
0

9
0
3
0
3
1

= 0.
Set v = 2, we have
det(M) =

S
1
S
2
S
2
S
3

12

9
0

= 0.
Graduate Institute of Communication Engineering, National Taipei University
Y. S. Han BCH codes 34
We then calculate
M
1
=
_
_
0
6

9
_
_
.
Hence,
_

1
_
= M
1
_
0

3
_
=
_

9

12
_
and
(x) = 1 +
12
x +
9
x
2
=
_
1 +
2
x
_ _
1 +
7
x
_
=
9
_
x
8
_ _
x
13
_
.
Since 1/
8
=
7
and 1/
13
=
2
, we found the error locations.
Graduate Institute of Communication Engineering, National Taipei University

You might also like