# Lecture-2(ERROR CORRECTION)

```MUDULI ACADEMY
ERROR CORECTION:
Error correction can be handled in two ways i.e.
1. Backward error correction (retransmission)
2. Foreword error correction
Backward error correction:
When error is discovered by the receiver then sender retransmits the entire data unit
to the receiver, this is called backward error correction.
For ward error correction:
In this error correction receiver can use an error-correcting code which
automatically correct certain errors, this is called forward error correction. So theoretically it is
possible to correct any number of errors automatically.
ERROR CORRECTION TECHNIQUES:
Hamming code is one of the error correction techniques is used to correct the single bit error.
Hamming code structure:
It is an error correcting code. The parity bits are inserted in between the data bit. The
7-bit hamming code is used commonly for correcting the error.
In hamming code the parity bits are inserted at each 2𝑛 bit when n=0, 1, 2, 3 , …….
Thus p1 is at 20 =1 i.e first bit. P2 is at 21 =2, p4 is at 22 =4
and p8 is at 23 = 8………
In hamming code D7, D6, D5, D3 are called data bits and p4, p2, p1 are called parity bits.
Parity bits are calculated by using one formula i.e
2𝑟 &gt;=m+r+1
Where ‘r’ is the redundant bit and ‘m’ is the total no of data unit.
Hamming distance:
The hamming distance between two words is the number of difference between corresponding
bits.
Example:
Find the distance between (10101, 10010)
Sol:
Hamming distance is to be calculated between two given data unit by using XOR operation
between two given data unit. So how many 1(one) is present in that result of data unit after XOR
operation that is the distance between two given data unit.
d(10101 (XOR)10010)= 00111 ( here 3 numbers 1(one) is present so the distance is 3)
Problem:
If a 7-bit Hamming code received by a receiver is 1011011.detect error of this data unit and
correct it.
Solution:
Step-1
1
D7
0
D6
1
D5
1
P4
0
D3
1
P2
Analyze the bits 1,3,5,7
P1 D3 D5 D7 = 1 0 1 1 which is odd parity so error exist.
Hence set p1=1 in the 1st position of the error word.
Step-2
Analyze the bits 2, 3, 6 and 7
P2 D3 D6 D7 = 1 0 0 0 1 which is an even parity. So there is no error
Hence set p2=0 in the 2nd position of the error word.
1
P1
Step-3
Analyze bits 4, 5, 6 and 7
P4 D5 D6 D7 = 1 1 0 1 which is odd parity. So errors exist.
Hence put p4=1 in the 4th position of the error word.
Step-4
Error word E = P4 P2 P1
E= 1 0 1
E = 5 (in decimal)
Hence bit 5 of the transmitted codeword is in error
D7
D6
D5
P4
D3
P2
Step-5
For correcting the error we invert (1 to 0 or 0 to 1) the incorrect bit to obtain the correct
codeword.
Correct codeword = [ 1 0 0 1 0 1 1 ]
P1
```