The Hamming Distance is a number used to denote the difference between two binary strings. It is a small portion of a broader set of formulas used in information analysis. Specifically, Hamming's formulas allow computers to detect and correct error on their own. The Hamming Code earned Richard Hamming the Eduard Rheim Award of Achievement in Technology in 1996, two years before his death. Hamming's additions to information technology have been used in such innovations as modems and compact discs.

### Step 1

Ensure the two strings are of equal length. The Hamming distance can only be calculated between two strings of equal length. String 1: "1001 0010 1101" String 2: "1010 0010 0010"

### Step 2

Compare the first two bits in each string. If they are the same, record a "0" for that bit. If they are different, record a "1" for that bit. In this case, the first bit of both strings is "1," so record a "0" for the first bit.

### Step 3

Compare each bit in succession and record either "1" or "0" as appropriate. String 1: "1001 0010 1101" String 2: "1010 0010 0010" Record: "0011 0000 1111"

### Step 4

Add all the ones and zeros in the record together to obtain the Hamming distance. Hamming distance = 0+0+1+1+0+0+0+0+1+1+1+1 = 6

#### Tip

- If using a computer, "XOR" can be used to compare the two strings and obtain the "record."