Chapter 13 of 28

Error Detection & Correction

When data travels through a network, it does not always arrive exactly as it was sent. Electrical interference, weak signals, damaged cables, or other problems can cause some bits to change during transmission.

For example, a sender might transmit:

10110010

but the receiver could receive:

10100010

Here, one bit has changed. This is called a transmission error.

To deal with such problems, computer networks use techniques called Error Detection and Error Correction.

Error detection finds out whether an error has occurred, while error correction goes one step further and tries to recover the correct data.


What Is Error Detection?

Error detection is the process of identifying whether the data received by the receiver contains errors.

The sender adds some extra information to the original data before transmission. The receiver uses this information to check whether the data was changed.

Original Data
     ↓
Add Error-Checking Information
     ↓
Transmit
     ↓
Receiver
     ↓
Check for Errors

If an error is detected, the receiver may request the sender to send the data again, depending on the protocol being used.


What Is Error Correction?

Error correction is the process of detecting an error and recovering the original data without necessarily requiring retransmission.

The sender adds enough extra information to the transmitted data so that the receiver can determine what went wrong and correct certain errors.

Data + Extra Information
          ↓
       Network
          ↓
       Receiver
          ↓
    Detect & Correct
          ↓
      Correct Data

Error correction is especially useful when retransmission is difficult, expensive, or slow.


Error Detection vs Error Correction

Feature

Error Detection

Error Correction

Purpose

Detects errors

Detects and corrects errors

Can recover data by itself?

Usually no

Yes, for correctable errors

Extra information

Added

More redundancy is generally required

Retransmission

May be required

May not be required

Complexity

Usually simpler

Usually more complex


Common Error Detection Techniques

There are several techniques used to detect transmission errors.

1. Parity Check

Parity checking is one of the simplest error detection methods.

An additional bit called a parity bit is added to the data.

There are two types:

  • Even parity

  • Odd parity

Even Parity Example

Suppose the data is:

1011001

It contains four 1s, which is already an even number. Therefore, the parity bit can be 0.

Data:        1011001
Parity bit:       0
Transmitted: 10110010

The receiver counts the number of 1s. If the expected parity does not match, an error is detected.

Limitation

Parity checking is simple but cannot detect every possible error. For example, if two bits change, the parity may remain the same.


2. Checksum

A checksum is a value calculated from the data and sent along with it.

The receiver performs a similar calculation and compares the result.

Data
 ↓
Calculate Checksum
 ↓
Data + Checksum
 ↓
Transmission
 ↓
Receiver calculates again
 ↓
Compare

If the calculated checksum does not match the received checksum, the receiver knows that the data was probably corrupted.

Checksums are commonly used in various communication and data-transfer systems.


3. Cyclic Redundancy Check (CRC)

CRC (Cyclic Redundancy Check) is a powerful and widely used error detection technique.

The sender performs a mathematical calculation on the data and generates a CRC value. This value is transmitted along with the data.

The receiver performs the same calculation. If the results do not match, an error is detected.

CRC is widely used in networking and data communication because it is very effective at detecting many common types of transmission errors.

Simple Idea

Data → CRC Calculation → Data + CRC
                              ↓
                           Receiver
                              ↓
                         Check CRC
                              ↓
                    Error / No Error

You don't need to understand the mathematical calculation behind CRC immediately. The important idea is that CRC adds a calculated value that helps the receiver detect whether the data was changed.


Common Error Correction Technique

Hamming Code

Hamming Code is an error correction technique that adds specially calculated redundant bits to data.

These bits allow the receiver to:

  • Detect certain bit errors

  • Identify the position of a single-bit error

  • Correct that error

For example, if one bit changes during transmission, Hamming Code can help the receiver determine which bit is incorrect and fix it.

Received Data
      ↓
Check Redundant Bits
      ↓
Find Error Position
      ↓
Correct Bit
      ↓
Correct Data

Hamming Code is a classic example of forward error correction.


Retransmission-Based Error Recovery

Another common approach is to detect an error and simply request the data again.

This is known as Automatic Repeat reQuest (ARQ).

The basic idea is:

Sender → Data → Receiver
                  ↓
              Error?
               /   \
             Yes    No
              ↓      ↓
         Send Again  Continue

If the receiver detects an error, it asks the sender to retransmit the affected data.

This approach is useful when retransmission is practical.


Error Detection and Correction in Real Life

Imagine downloading a file from a server.

If some data becomes corrupted while traveling through the network, error detection mechanisms can identify the problem. Depending on the protocol and system, the corrupted data may then be retransmitted or corrected using redundant information.

This helps ensure that the file you receive is the same as the file that was originally sent.


Why Are Error Detection and Correction Important?

Without these techniques, even a small transmission problem could silently change the information being transferred.

They help provide:

  • Data integrity

  • Reliable communication

  • Detection of corrupted data

  • Recovery from certain transmission errors

  • Better quality of communication

They are particularly important in systems where incorrect data could cause serious problems.

Conclusion

Error detection determines whether data has been corrupted during transmission, while error correction attempts to recover the correct data.

Some important techniques are:

  • Parity Check → Simple error detection

  • Checksum → Detects errors using a calculated value

  • CRC → Powerful error detection technique

  • Hamming Code → Can detect and correct certain bit errors

  • ARQ → Retransmits data when an error is detected

The simple idea to remember is:

Error Detection → "Something went wrong."

Error Correction → "Something went wrong, and here's how we fix it."