ERROR DETECTING AND CORRECTING CODES 155 



Thus we define the distance D{x, y) between two points x and y as the num- 

 ber of coordinates for which x and y are different. This is the same as the 

 least number of edges which must be traversed in going from x to y. This 

 distance function satisfies the usual three conditions for a metric, namely, 



D(x, y) = if and only if x = y 



D(x, y) = D(y, x) > iix ^ y 



D{z, y) + D(y, z) > D(x, z) (triangle inequality). 



As an example we note that each of the following code points in the three- 

 dimensional cube is two units away from the others, 



1 



1 



1 



111. 



To continue the geometric language, a sphere of radius r about a point x 

 is defined as all points which are at a distance r from the point x. Thus, in 

 the above example, the first three code points are on a sphere of radius 2 

 about the point (1, 1, 1). In fact, in this example any one code point may be 

 chosen as the center and the other three will lie on the surface of a sphere 

 of radius 2. 



If all the code points are at a distance of at least 2 from each other, then it 

 follows that any single error will carry a code point over to a point that is 

 not a code point, and hence is a meaningless symbol. This in turn means that 

 any single error is detectable. If the minimum distance between code points 

 is at least three units then any single error will leave the point nearer to the 

 correct code point than to any other code point, and this means that any 

 single error will be correctable. This type of information is summarized in 

 the following table: 



Table V 



Minimum 

 Distance 



Meaning 



uniqueness 



single error detection 



single error correction 



single error correction plus double error detection 



double error correction 



Etc. 



Conversely, it is evident that, if we are to effect the detection and correc- 

 tion listed, then all the distances between code points must equal or exceed 

 the minimum distance listed. Thus the problem of finding suitable codes is 



