Two-Dimensional Parity Check: Error Detection (with Worked Example)
A parity check detects certain transmission errors by appending extra bits that describe whether the data has even/odd parity. In a two-dimensional parity check, we write the data into a grid and compute parity across both directions—rows and columns—so the receiver can detect inconsistencies and often localize where corruption occurred.
Mechanically:
- If parity is computed as even parity, then each row and each column is required to have an even number of 1s.
- After transmission, the receiver recomputes all row and column parities.
- If a row parity and a column parity disagree with the expected values simultaneously, the intersection points to a likely corrupted bit location (localization).
A key concept is the Hamming distance: adding row/column parity constraints creates a structured code that has nonzero minimum distance for many error patterns, allowing detection of various single-bit (and some multi-bit) errors. However, like any parity-based method, it cannot guarantee detection of every possible multi-bit corruption. (Specifically, parity checks detect all odd-weight errors within the checked structure, while some even-weight patterns can “cancel out”.)
The core structure can be visualized as:
2D Parity / Parity Check Error Detection (conceptual)
Key learning terms (used throughout)
- parity
- row parity
- column parity
- detection
How Two-Dimensional Parity Check Detects Errors
Matrix formation
1Arrange the bitstream into an grid (optionally padding with 0s)."
Row parity generation
2For each row, compute a parity bit so the row has the required even/odd parity."
Column parity generation
3For each column, compute a parity bit so the column has the required even/odd parity."
Transmission
4Send the data matrix plus all row and column parity bits."
Receiver verification
5Recompute parity for each row and column; mismatches imply detected errors."
Localization (often possible)
6A mismatching row and mismatching column intersect at the likely corrupted bit."
Worked Example: Data = 1100101100110000110100101101
We are given the bitstring:
Let’s apply a 2D parity check. The length is bits, which is perfect for arranging into an matrix as (since ).
We will use even parity for both row and column parity bits. (If your course uses odd parity, the procedure is identical—only the parity-bit values change.)
Step 1: Arrange bits into a matrix
Write the bits row-wise (left to right within a row):
Row 1: 1100101
Row 2: 1001100
Row 3: 0011010
Row 4: 0101101
So the matrix is:
| Row / Col | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
|---|---|---|---|---|---|---|---|
| R1 | 1 | 1 | 0 | 0 | 1 | 0 | 1 |
| R2 | 1 | 0 | 0 | 1 | 1 | 0 | 0 |
| R3 | 0 | 0 | 1 | 1 | 0 | 1 | 0 |
| R4 | 0 | 1 | 0 | 1 | 1 | 0 | 1 |
Compute row parity and column parity (even parity)
- 1Step 1
For each row, count 1s. If the count is already even, parity bit = 0; if odd, parity bit = 1 (so total becomes even).
- 2Step 2
For each column, repeat the same even-parity rule across the 4 bits in that column.
- 3Step 3
Transmit the original matrix plus: one parity bit per row and one parity bit per column.
- 4Step 4
Receiver recomputes row/column parity from received matrix; any mismatch indicates an error. A mismatching row and mismatching column point to a particular cell (bit).
Row parity bits (even parity)
Count 1s in each row:
- Row 1:
1100101has ones → even → row parity - Row 2:
1001100has ones → odd → row parity - Row 3:
0011010has ones → odd → row parity - Row 4:
0101101has ones → even → row parity
So row parity vector is:
Column parity bits (even parity)
Now for each column (from the matrix):
- Col 1: bits = → ones → even →
- Col 2: bits = → ones → even →
- Col 3: bits = → one → odd →
- Col 4: bits = → ones → odd →
- Col 5: bits = → ones → odd →
- Col 6: bits = → one → odd →
- Col 7: bits = → ones → even →
So column parity vector is:
How detection works (the key logic)
Consider what happens if exactly one bit flips during transmission (a error):
- That flip changes the 1-count of its row by (toggling parity).
- It also changes the 1-count of its column by (toggling parity).
- Therefore, the parity check will fail for both the corresponding row and corresponding column.
So a single-bit error produces:
- at least two mismatches (one row, one column),
- and the intersection of the mismatching row and column identifies the bit’s location.
Why two dimensions detect more than 1D parity
With simple (1D) parity, any even number of flipped bits may cancel and evade detection. With 2D parity, multi-bit errors have to simultaneously preserve every row and every column parity to go undetected.
2D parity still cannot detect every possible multi-bit pattern
If an error flips multiple bits such that each affected row has an even number of changes AND each affected column also has an even number of changes, all parities may remain consistent—so the receiver may not detect it.
Concrete detection scenario (illustrative)
Suppose during transmission, the bit at Row 2, Column 4 flips.
From the matrix, Row 2 is 1 0 0 1 1 0 0, so Column 4 currently is 1. A flip makes it 0.
Effect on parities
- Row 2: number of 1s decreases by 1 → row parity toggles
So receiver’s recomputed parity for Row 2 will not match the transmitted . - Column 4: Column 4 currently has bits (3 ones). After flip at Row 2, it becomes (2 ones). Parity toggles again.
So receiver’s recomputed parity for Column 4 will not match .
Thus, the receiver detects an error by finding:
- row mismatch at Row 2
- column mismatch at Column 4
Their intersection uniquely points to cell in this single-bit-error case.
Summary of what to transmit
For a matrix:
- transmit the data bits,
- plus row parity bits and column parity bits:
Parity bits to append:
- Row parity:
- Column parity:
Common exam-focused clarifications
Knowledge Check
In a 2D parity check with even parity, if exactly one bit flips, which parity sets must mismatch?