OGBORN'S MATH HUB


Hamming Codes: What Multiple Parity Bits Can Do

     Hamming Codes are built upon the idea of using Parity Bits to detect errors. If we instead included two parity bits, one for the first half of the data string and the other for the second half, then we would be able to not only detect whether an error has occurred, but also in which half of the data the error occurred. In this way, a second parity bit could help us get closer to locating the error. In fact, for our time of day codes (that have eleven message bits), we only need a total of five parity bits to be able to pinpoint the exact bit where an error occurred! (These five parity bits include the reddish-pink overall parity bit that you are used to by now. We will have to update that parity bit after attaching the other four, just to make sure the overall parity is still even.)

     In general, only n+1 parity bits are needed to fully protect a code with (2^n) - (n+1) data digits. In total, the protected data string will be 2^n bits long. In our practice time of day codes, we will need five parity bits. In total, our protected practice codes will be sixteen digits long. We will have to follow very carefully the following rules to create our protected code:

     Let the 11 bits of message data be denoted as D0 to D10, with D0 being the rightmost message bit and D10 being the leftmost message bit.. Let the addended bits be denoted as P0 to P4, from left to right the sequence being P4, P3, P2, P1, P0. For clarity, message bits will be black, the overall parity bit that we have already worked with will be reddish-pink and will be P4, and the new parity bits will be blue and will be P3, P2, P1, and P0. See the sample string below:

Data String Configuration
Data String Configuration

Each of the addended bits will be a parity bit, but most will only be a parity bit on a specific subset of the block:

To make clear why these specific halves were selected to correspond to each parity bit, let's arrange the 11 message bits and the 5 parity bits into a grid:

Hamming Grid
Hamming Grid