Odd vs Even Parity in Binary Data Transmission
Parity checking is a fundamental mathematical method used in telecommunications and computer systems to detect single-bit errors in binary data transmission. By appending a single parity bit to a string of binary data, the system ensures that the total count of logic high states (“1”s) across the entire frame adheres to a predefined rule of either evenness or oddness. This article details the mathematical foundations—specifically modulo-2 arithmetic and Boolean logic—underpinning both even and odd parity schemes.
The Mathematical Basis: Modulo-2 Arithmetic
At the core of parity calculations is modulo-2 arithmetic, where any integer sum is divided by 2 to leave a remainder of either 0 or 1. Given a sequence of \(n\) data bits represented as \(b_1, b_2, \dots, b_n\) (where each \(b_i \in \{0, 1\}\)), the arithmetic sum \(S\) is:
\[S = \sum_{i=1}^{n} b_i\]
The parity check relies on the value of \(S \pmod 2\): * If \(S \pmod 2 = 0\), the number of 1s in the data sequence is even. * If \(S \pmod 2 = 1\), the number of 1s in the data sequence is odd.
In digital logic circuits, modulo-2 addition is implemented using the Exclusive OR (XOR) operation (\(\oplus\)).
Even Parity
In an even parity scheme, the parity bit \(p_{\text{even}}\) is chosen so that the total number of 1s in the transmitted block (data bits plus parity bit) is always an even number:
\[\left( \sum_{i=1}^{n} b_i + p_{\text{even}} \right) \pmod 2 = 0\]
Using Boolean logic, the even parity bit is computed as the chained XOR sum of all the data bits:
\[p_{\text{even}} = b_1 \oplus b_2 \oplus \dots \oplus b_n\]
- Example: For the 7-bit data byte
1011001, the number of 1s is 4 (already even). Therefore, \(p_{\text{even}} = 0\), producing the transmitted 8-bit stream10110010. - Example: For the 7-bit data byte
1010001, the number of 1s is 3 (odd). Therefore, \(p_{\text{even}} = 1\), producing the transmitted 8-bit stream10100011.
Odd Parity
In an odd parity scheme, the parity bit \(p_{\text{odd}}\) is selected so that the total number of 1s in the transmitted block is always an odd number:
\[\left( \sum_{i=1}^{n} b_i + p_{\text{odd}} \right) \pmod 2 = 1\]
Mathematically, this corresponds to the logical inversion (XNOR) of the even parity calculation:
\[p_{\text{odd}} = \neg (b_1 \oplus b_2 \oplus \dots \oplus b_n) = 1 \oplus (b_1 \oplus b_2 \oplus \dots \oplus b_n)\]
- Example: For the 7-bit data byte
1011001, the number of 1s is 4. To make the total sum odd, \(p_{\text{odd}} = 1\), producing the transmitted stream10110011. - Example: For the 7-bit data byte
1010001, the number of 1s is 3. To maintain an odd sum, \(p_{\text{odd}} = 0\), producing the transmitted stream10100010.
Error Detection at the Receiver
Upon receiving a transmitted word consisting of data bits \(b_1', b_2', \dots, b_n'\) and the received parity bit \(p'\), the receiver computes the total syndrome \(C\):
\[C = \left( \sum_{i=1}^{n} b_i' + p' \right) \pmod 2\]
- Even Parity Validation: An error is flagged if \(C \neq 0\).
- Odd Parity Validation: An error is flagged if \(C \neq 1\).
Because altering any single bit changes the result of a modulo-2 sum from 0 to 1 or from 1 to 0, parity checks reliably detect any single-bit transmission error (or any odd number of bit errors). However, because an even number of simultaneous bit flips preserves the original modulo-2 sum, double-bit or even-count bit errors will pass undetected.