Today, almost everything people do involves the transfer of digital information. When you bank online, update social media or even play a DVD, information moves from one place to another digitally, whether through a cord or over a wireless signal. For this information to pass, it has to use computer code. In this "language," information moves via 1's and 0's, known as binary code. An error in the code can mean that information is not conveyed properly, which could cause lots of issues for the computer user. Hamming distance is a way of understanding how codes differ. This can then be used to correct errors.

## What Is Hamming Distance?

Given two lines of the same length, Hamming distance is the number of points at which the lines' symbols are different. This can be a bit confusing, so consider a simple example: The line of code "101" and the line of code "010." Comparing these lines, you can see that there are different symbols in each of the three spots.

## How To Calculate Hamming Distance

In simple scenarios, calculating Hamming distance is easy. You simply add up the number of spots where the lines have different values. In the example above, the Hamming distance would be three, since the lines have different values in three spots.

Making this comparison gets harder the longer the set of data is. Consider a slightly longer example, with two lines of code: 100110 and 110011. These lines of code both contain six information points. The values are different in three of those points, so the Hamming distance between these two lines is also three.

Calculating Hamming distance with a larger set of data becomes more complicated and involves using intricate equations and functions like d=min {d(x,y):x,y∈C,x≠y}.

It's important to remember that Hamming distance can only be calculated for lines that are the same length.

## Why Is Hamming Distance Useful?

Out of context, Hamming distance can seem arbitrary. However, it's an important measurement for coders. Hamming distance can help coders write code that detects errors and even corrects those errors on its own. It can also help people understand how error-prone a code is.

Hamming distance comes for Richard Wesley Hamming, who developed the measurement in the late 1940s when he was working at Bell Telephone Laboratories. Although Hamming downplayed the celebration of the innovation, the technology industry took notice. Nearly 50 years after Hamming discovered the measurement he was given the Eduard Rheim Award for Achievement in Technology by the Eduard Rheim Foundation of Germany in 1996. In addition, the I.E.E.E., a large professional organization in the technology sector, gives out the annual Richard W. Hamming Medal in his honor.