**Eg. Now form a hamming code for 5-bit information bits 10110 with odd parity**

m=5 and we have to follow 2^{p} >= m + p + 1

The value of p as 4 to satisfy 2^{4} (16) >= 5 + 4 + 1 but p=3 doesn’t satisfy as 2^{3} (8) >= 5 + 3 + 1

So p=4 and hence a total of 9 bits

Parity bit positions are 1, 2, 4, 8

And hence hamming code composition is as follow

0001 0010 0011 0100 0101 0110 0111 1000 1001

1 2 3 4 5 6 7 8 9

**P _{1 }P_{2 }M_{1 }P_{3 }M_{2 }M_{3 }M_{4 }P_{4 }M_{5}**

Now if we see **P _{1 }**has 1 at LSB so message bits with this parity bit are

**M**

_{1}M_{2}M_{4}M_{5}Similarly we see P_{2} checks M_{1} M_{3} M_{4}

Similarly we see P_{3} checks M_{2} M_{3} M_{4}

Similarly we see P_{4} checks M_{5}

**Or we can also put it as**

**P _{1 }checks code bits 1, 3, 5, 7, 9**

**P _{2 }checks code bits 2, 3, 6, 7**

**P _{3 }checks code bits 4, 5, 6, 7**

**P _{4 }checks code bits 8, 9**

**For message 10110 we hamming code**

Bit positions

1 2 3 4 5 6 7 8 9

**P _{1 }P_{2 }1 P_{3 }0 1 1 P_{4 }0**

We see P_{1}=1 to make no. of 1’s to 3 i.e. odd

We see P_{2}=0 to make no. of 1’s to 3 i.e. odd

We see P_{3}=1 to make no. of 1’s to 3 i.e. odd

We see P_{4}=1 to make no. of 1’s to 1 i.e. odd

**So we get the hamming code as 101101110**