Skip to main content

(4,3) even parity code is linear, odd parity is not

Short answer

(4,3) even parity code is linear: all-zero word is codeword and sum of any two codewords is a codeword. (4,3) odd parity code is not linear because all-zero word is missing and sum of two codewords has even weight, not in code.

Prove that (4,3) even parity code is a linear block code and (4,3) odd parity code is not a linear block code.

A block code is linear if (1) the all-zero word is a codeword and (2) the modulo-2 sum of any two codewords is also a codeword (closure). For binary codes, (2) implies (1) since c⊕c=0\mathbf{c}\oplus\mathbf{c}=\mathbf{0}.

A (4,3) parity code takes 3 message bits m1m2m3m_1m_2m_3 and adds one parity bit pp.

Even parity code is linear

p=m1⊕m2⊕m3p=m_1\oplus m_2\oplus m_3, so every codeword has an even number of 1s:

MessageCodewordMessageCodeword
00000001001001
00100111011010
01001011101100
01101101111111

General proof: let c1,c2\mathbf{c}_1,\mathbf{c}_2 be codewords, with weights w1,w2w_1,w_2 both even. Then

w(c1⊕c2)=w1+w2−2 w(c1⋅c2)w(\mathbf{c}_1\oplus\mathbf{c}_2)=w_1+w_2-2\,w(\mathbf{c}_1\cdot\mathbf{c}_2)

where c1⋅c2\mathbf{c}_1\cdot\mathbf{c}_2 counts positions where both are 1. Even + even − even = even, so the sum is again an even-weight 4-bit word, i.e. a codeword. Also 00000000 is a codeword.

Equivalently, the code can be generated by a matrix:

G=[100101010011],c=mGG=\begin{bmatrix}1&0&0&1\\0&1&0&1\\0&0&1&1\end{bmatrix},\qquad \mathbf{c}=\mathbf{m}G

and m1G⊕m2G=(m1⊕m2)G\mathbf{m}_1G\oplus\mathbf{m}_2G=(\mathbf{m}_1\oplus\mathbf{m}_2)G, which is a codeword.

Example: 0011⊕0101=01100011\oplus0101=0110 (codeword), 1001⊕1111=01101001\oplus1111=0110 (codeword). Hence the (4,3) even parity code is a linear block code.

Odd parity code is not linear

p=m1⊕m2⊕m3⊕1p=m_1\oplus m_2\oplus m_3\oplus1, so every codeword has an odd number of 1s:

MessageCodewordMessageCodeword
00000011001000
00100101011011
01001001101101
01101111111110
  1. The all-zero word 00000000 has even weight, so it is not a codeword.
  2. Closure fails: for odd w1,w2w_1,w_2, w1+w2−2(⋅)w_1+w_2-2(\cdot) is even, so the sum of two codewords always has even weight and is never a codeword. Example: 0001⊕0010=00110001\oplus0010=0011, weight 2, not in the code.

Hence the (4,3) odd parity code is not a linear block code.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Communication Systems chapter 8 questions →