---
title: "Forward error correction using Hamming code"
subject: "Data Communication"
chapter: 8
key: "semester_5/data_communication:fec-hamming"
source: https://www.bctengineer.com/q/semester_5/data_communication/fec-hamming
site: BCT Engineering
---

# Forward error correction using Hamming code

Data Communication · Chapter 8: Information Theory and Coding

- Asked in: 2069 Asar, 5 marks
- Video: [Error Detection and Correction 3: Forward Error Correction](https://www.youtube.com/watch?v=0CLTy231Hsw) — Jacob Schrum
- Answer checked by Claude Sonnet 5.5 on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_5/data_communication/fec-hamming
- Whole chapter: https://www.bctengineer.com/md/semester_5/data_communication/chapter-8

## Question

Explain forward error correction techniques with example of Hamming code.

## Short answer

Forward error correction adds redundant bits so the receiver corrects errors without retransmission, suited for one-way or delay-sensitive links. In (7,4) Hamming code, 3 parity bits sit at positions 1,2,4. For data 1101, the codeword is 1010101. A single-bit error at position 6 gives syndrome 110 (binary 6), identifying and correcting the flipped bit.

## Answer

**Forward error correction (FEC)** adds redundant bits to the data so the receiver can detect and correct errors by itself, without asking for retransmission. It suits one-way, real-time or long-delay links (satellite, broadcast, memory). Common FEC techniques: Hamming codes, BCH and Reed-Solomon codes, convolutional codes (Viterbi), turbo and LDPC codes. The cost is extra bits (lower code rate).

#### Hamming (7,4) example
Parity bits are at positions 1, 2, 4 (even parity); data bits are at 3, 5, 6, 7:
- p1 covers positions 1, 3, 5, 7
- p2 covers positions 2, 3, 6, 7
- p4 covers positions 4, 5, 6, 7

```text
 position :  1  2  3  4  5  6  7
 bit      : p1 p2 d3 p4 d5 d6 d7
```

**Encoding:** data d3 d5 d6 d7 = 1 1 0 1
- p1 = 1⊕1⊕1 = 1
- p2 = 1⊕0⊕1 = 0
- p4 = 1⊕0⊕1 = 0

Codeword (positions 1 to 7) = **1010101**.

**Error:** bit 6 flips during transmission, so the received word is 1010111.

**Decoding:** recompute the checks:
- c1 (positions 1, 3, 5, 7) = 1⊕1⊕1⊕1 = 0
- c2 (positions 2, 3, 6, 7) = 0⊕1⊕1⊕1 = 1
- c4 (positions 4, 5, 6, 7) = 0⊕1⊕1⊕1 = 1

The syndrome c4 c2 c1 = 110 = 6, so bit 6 is wrong. Flip it to get 1010101 and extract the data 1101. A single error is corrected without retransmission.

## Check yourself

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

1. What defines FEC?
   A. Receiver asks for retransmission on error
   B. Redundant bits let the receiver correct errors itself without retransmission
   C. Errors are only detected, never corrected
   D. Data is sent twice
   Answer: B. FEC adds redundancy so the receiver corrects errors alone, suiting one-way or long-delay links. (Key point: Forward error correction)

2. In the Hamming (7,4) code, where are the parity bits placed?
   A. Positions 1, 2, 4
   B. Positions 1, 2, 3
   C. Positions 5, 6, 7
   D. Positions 3, 5, 6
   Answer: A. Parity bits sit at powers-of-two positions 1, 2, 4; data bits at 3, 5, 6, 7. (Key point: Parity positions)

3. For data d3 d5 d6 d7 = 1 1 0 1, what is p4 (covers 4, 5, 6, 7)?
   A. 0
   B. 1
   C. Depends on p1
   D. Cannot be computed
   Answer: A. p4 = d5 ⊕ d6 ⊕ d7 = 1⊕0⊕1 = 0. (Key point: Encoding example)

4. The syndrome c4 c2 c1 = 110. What does the receiver do?
   A. Flip bit 6
   B. Flip bit 3
   C. Request retransmission
   D. Accept the word as correct
   Answer: A. 110 in binary is 6, which is the position of the erroneous bit; flipping it corrects the word. (Key point: Syndrome decoding)

## Related in Data Communication

- [Construct a (7,4) Hamming code](https://www.bctengineer.com/question.md?key=semester_5%2Fdata_communication%3Ahamming-74-construct) — Data Communication, chapter 8
- [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
- [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
- [Capability of a code with dmin = 4](https://www.bctengineer.com/question.md?key=semester_5%2Fdata_communication%3Ahamming-distance-dmin4) — Data Communication, chapter 8
- [Hamming codes and their properties](https://www.bctengineer.com/question.md?key=semester_5%2Fdata_communication%3Ahamming-code-properties) — Data Communication, chapter 8
- [Minimum Hamming distance; find k and n](https://www.bctengineer.com/question.md?key=semester_5%2Fdata_communication%3Amin-hamming-k-n) — Data Communication, chapter 8

## Related in other subjects

- [Error detection vs correction; rate ½ convolutional encoder](https://www.bctengineer.com/question.md?key=semester_6%2Fcommunication_systems%3Aerror-detect-correct-conv-half-rate) — Communication Systems, chapter 8
- [Hamming weight and distance; (7,4) cyclic code for 1011](https://www.bctengineer.com/question.md?key=semester_6%2Fcommunication_systems%3Ahamming-weight-cyclic-1011) — Communication Systems, chapter 8, asked 2×
- [Speech characteristics and 7-bit Hamming code](https://www.bctengineer.com/question.md?key=semester_7%2Fwireless_communication%3Aspeech-hamming-code) — Wireless Communication, chapter 6
- [Hamming distance and weight; (6,3) code check for 100101](https://www.bctengineer.com/question.md?key=semester_6%2Fcommunication_systems%3Ahamming-6-3-h-100101) — Communication Systems, chapter 8
