---
title: "Linear block coding with example"
subject: "Data Communication"
chapter: 8
key: "semester_5/data_communication:linear-block-code-explain"
source: https://www.bctengineer.com/q/semester_5/data_communication/linear-block-code-explain
site: BCT Engineering
---

# Linear block coding with example

Data Communication · Chapter 8: Information Theory and Coding

- Asked in: 2073 Shrawan, 6 marks; 2072 Kartik, 3 marks; 2071 Shrawan, 6 marks (asked 3 times)
- Video: [Complete Example of Linear Block Code in Digital Communication by Engineering Funda](https://www.youtube.com/watch?v=DfSvzkgUNNs) — Engineering Funda
- Answer checked by Claude Sonnet 5.5 on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_5/data_communication/linear-block-code-explain
- Whole chapter: https://www.bctengineer.com/md/semester_5/data_communication/chapter-8

## Question

Describe linear block coding method with a suitable example for detection of an error.

## Short answer

Linear block codes add parity bits using modulo-2 equations. A (6,3) code with G=[I|P] encodes m=101 to 101101. At receiver, syndrome s = rH^T detects errors; if s matches a column of H, that bit is flipped. Example: syndrome (110) identifies bit 3 error, correcting it.

## Answer

A **linear block code** (n, k) maps each k-bit message to an n-bit codeword by adding n − k parity bits using linear (modulo-2) equations, so the sum of any two codewords is also a codeword. Codeword **c = m·G**, where G is the k × n generator matrix.

#### Example: (6,3) code
```text
      | 1 0 0 : 0 1 1 |           | 0 1 1 : 1 0 0 |
 G =  | 0 1 0 : 1 0 1 |      H =  | 1 0 1 : 0 1 0 |
      | 0 0 1 : 1 1 0 |           | 1 1 0 : 0 0 1 |
```
Here G = [I | P] and the parity-check matrix H = [Pᵀ | I]. Codewords satisfy c·Hᵀ = 0.

#### Encoding
Message m = 101 → c = row 1 ⊕ row 3 = 100011 ⊕ 001110 = **101101**.

#### Error detection using the syndrome
Receiver computes syndrome **s = r·Hᵀ** (mod 2).
- s = 000 means no error (accept).
- s ≠ 000 means an error; if s equals column j of H, then bit j is in error (single error).

Suppose bit 3 is received in error: r = 100101 (sent 101101).
- s1 = row 1 (011100): r2⊕r3⊕r4 = 0⊕0⊕1 = 1
- s2 = row 2 (101010): r1⊕r3⊕r5 = 1⊕0⊕0 = 1
- s3 = row 3 (110001): r1⊕r2⊕r6 = 1⊕0⊕1 = 0

s = (1 1 0) ≠ 0, so an error is detected. It equals column 3 of H, so bit 3 is wrong: flip it to get 101101, and message = **101**.

Minimum distance of this code is 3: it detects up to 2 errors and corrects 1 error.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. What defines a linear block code?
   A. Every codeword has the same number of 1s
   B. The modulo-2 sum of any two codewords is also a codeword
   C. Parity bits are placed before the message bits
   D. Codewords are produced by a shift register with memory
   Answer: B. A linear code is closed under modulo-2 addition, so the sum of any two codewords is another codeword. (Key point: Linearity property)

2. In the (6,3) example, how is the codeword for m = 101 obtained?
   A. Add row 1 and row 2 of G
   B. Add row 2 and row 3 of G
   C. Add row 1 and row 3 of G (100011 xor 001110 = 101101)
   D. Multiply the message by H
   Answer: C. The 1s in the message select rows 1 and 3 of G, and their mod-2 sum is 101101. (Key point: Encoding c = m.G)

3. The receiver computes s = r.H^T. What does s = 000 indicate?
   A. No error is detected, so the word is accepted
   B. A single-bit error in bit 1
   C. An uncorrectable error
   D. The message is all zeros
   Answer: A. Valid codewords satisfy c.H^T = 0, so a zero syndrome means no detectable error. (Key point: Syndrome test)

4. For r = 100101 the syndrome is 110. What does this tell the receiver?
   A. Bit 6 is wrong because s ends in 0
   B. Bit 3 is wrong because s equals column 3 of H
   C. Two bits are wrong
   D. The syndrome is ignored since it is non-zero
   Answer: B. For a single error the syndrome equals the column of H at the error position; 110 is column 3. (Key point: Locating a single error)

## Related in Data Communication

- [Dataword vs codeword; error coding techniques](https://www.bctengineer.com/question.md?key=semester_5%2Fdata_communication%3Adataword-codeword-error-coding) — Data Communication, chapter 8
- [CRC error detection with example](https://www.bctengineer.com/question.md?key=semester_5%2Fdata_communication%3Acrc-explain) — Data Communication, chapter 8, asked 5×
- [Design a C(8,4) linear block code](https://www.bctengineer.com/question.md?key=semester_5%2Fdata_communication%3Alinear-block-code-84) — Data Communication, chapter 8
- [Redundancy, Hamming distance, linear vs cyclic](https://www.bctengineer.com/question.md?key=semester_5%2Fdata_communication%3Aredundancy-hamming-linear-cyclic) — Data Communication, chapter 8
- [Checksum error detection](https://www.bctengineer.com/question.md?key=semester_5%2Fdata_communication%3Achecksum-12-15-15-10-5-2) — Data Communication, chapter 8

## Related in other subjects

- [Differential coding; DPSK modulation and detection](https://www.bctengineer.com/question.md?key=semester_6%2Fcommunication_systems%3Adifferential-coding-dpsk) — Communication Systems, chapter 7
- [Error detection in serial data transmission](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Aserial-error-detection) — Instrumentation II, chapter 3, asked 2×
- [Error correction vs detection, bit stuffing](https://www.bctengineer.com/question.md?key=semester_7%2Fcomputer_networks_and_security%3Aerror-correct-detect-bitstuff) — Computer Networks and Security, chapter 3
- [Phase error in synchronous DSB-SC detection; synchronized receiver](https://www.bctengineer.com/question.md?key=semester_6%2Fcommunication_systems%3Aphase-error-dsbsc-costas) — Communication Systems, chapter 2
