Imagine sending the four-bit message 1011 across a noisy connection. One bit flips on the way, and the receiver gets 1001. Something went wrong—but which bit changed? Without more information, there is no way to tell. The received message looks just as plausible as the one you sent.
The solution sounds almost too simple: send extra bits. Arrange them carefully, and those bits can do more than warn that an error happened. They can point to the exact bit that needs fixing.

A parity bit can spot a problem
A bit is a zero or a one. A parity bit is an extra bit chosen to make the number of ones in a group even. If the data is 1011, it contains three ones, so we add a 1. The result, 10111, contains four ones.
If one bit flips during transmission, the number of ones becomes odd. The receiver knows something changed. But a single parity bit cannot say where: every possible one-bit error produces the same warning.
To locate an error, we need several parity checks that cover different, overlapping groups. Think of asking whether a missing book belongs on the left shelf, the upper shelf, or the back shelf. Each answer narrows its location. The trick is to give every bit its own pattern of answers.
Give every bit an address
One elegant arrangement is the Hamming(7,4) code, named for mathematician Richard Hamming. It turns four data bits into seven transmitted bits by adding three parity bits. Number the seven positions from 1 to 7. Put the data in positions 3, 5, 6, and 7; reserve positions 1, 2, and 4 for parity.
Each parity bit makes the number of ones even in its own group:
- Position 1 checks positions 1, 3, 5, and 7.
- Position 2 checks positions 2, 3, 6, and 7.
- Position 4 checks positions 4, 5, 6, and 7.
Notice that position 6 belongs to the second and third groups, but not the first. Position 3 belongs to the first and second, but not the third. In fact, every position has a distinct membership pattern. That pattern is its address.
Send four bits; recover seven
Let’s send 1011. Place those four bits, in order, into data positions 3, 5, 6, and 7. Reading from position 1 to 7, we now have _ _ 1 _ 0 1 1.
Choose each blank to make its group contain an even number of ones. The group checked by position 1 already has two ones, so position 1 is 0. The group checked by position 2 has three, so position 2 must be 1. The group checked by position 4 has two, so position 4 is 0. We transmit 0110011.
Suppose noise flips bit 6 from 1 to 0. The receiver sees 0110001 and runs all three checks again:
- The position-1 check passes: its group still has two ones.
- The position-2 check fails: its group has three ones.
- The position-4 check fails: its group has one one.
The failed checks are numbered 2 and 4. Add them: 2 + 4 = 6. That identifies the bad position. Flip bit 6 back to 1, then read the data from positions 3, 5, 6, and 7. The original 1011 returns.
Why adding the failed checks works
The numbers 1, 2, and 4 are powers of two. Every position from 1 to 7 can be written as a unique sum of them. Position 6, for example, is 2 + 4, which is why it participates in exactly those two checks. Position 7 is 1 + 2 + 4, so an error there would fail all three.
Three checks produce eight possible pass-or-fail patterns: one means “all clear,” and the other seven identify the seven possible locations of a single bad bit. The result of the checks is called a syndrome. Despite the medical-sounding name, it is simply an error’s address, written in binary.
There is an important limit. If two bits flip, an ordinary Hamming(7,4) decoder may mistake their combined pattern for a single-bit error and “correct” the wrong position. Some computer-memory systems add one more overall parity bit to distinguish a single error from a double error: they can correct the former and flag the latter.
The useful idea behind error correction
Computers cannot look at a damaged bit and see what it used to be. They can, however, compare overlapping pieces of evidence. Hamming’s design makes those comparisons precise enough to recover from one flipped bit without asking for the message again.
That is the back-of-the-envelope insight to keep: redundancy is not necessarily waste. If extra information is arranged so that each possible mistake leaves a different pattern, it becomes a map back to the original message.


Leave a Reply
You must be logged in to post a comment.