# Is it possible to generate Hamming code with minimum distance $d$ which can correct more than 1 bit error?

In literature, all I am seeing is Hamming code with minimum Hamming distance $3$. Theoretically a Hamming code with minimum distance d can detect $d-1$ errors and can correct $(d-1)/2$ error. So minimum distance of $3$ can detect $2$ errors and correct $1$ error.

So here is my question: Is it possible to generate a code with minimum Hamming distance of (let's say) $5$ which can correct $2$-bit errors in each block of coded bits?

If yes, could anyone please give me suggestion about that?

If not, then please give me an explanation.

• A Hamming code is defined as a single-error-correcting code with minimum Hamming distance exactly $3$ and maximal block length for the chosen number $m$ of parity bits. Its parameters (if you have seen the notation before) are $$[n,k,d] =[2^m-1,2^m-1-m,3].$$. So you cannot find "a _Hamming_ code with minimum distance $5$" as you want but you can find a code with minimum Hamming distance $5$ (notice the change in the location of the word "Hamming"). An easily-understood example can be found in Chapter 1 of Berkekamp's Algebraic Coding Theory (McGrawHill 1968, Aegean Press 1984). – Dilip Sarwate Jun 11 '18 at 13:48
• -1 for the use of $n$ in the title of your question to denote the minimum distance of the code. If your book or whatever material you are reading (including class notes that you have faithfully transcribed from what your instructor wrote on the board) uses $n$ for minimum distance, throw it away and find some other source/instructor. The use of $n$ to denote block length is universal in coding theory. – Dilip Sarwate Jun 11 '18 at 14:05
• Sorry for the mistake. I have edited it. Could you please remove -1? – Sourav Dev Jun 11 '18 at 17:15
• OK, removed the -1. Unfortunately, the answer by user36216 uses $n$ for the number ef parity bits (and is mostly wrong otherwise too). – Dilip Sarwate Jun 12 '18 at 2:24

You cannot detect 2-bit errors (reliably) with a Hamming code distance of 3 if you are correcting 1-bit errors.

At any rate, you can design Hamming codes correcting two errors. Let's assume 32bit of data and n Hamming code bits. The states we then need to be able to encode is 0 bit error = 1 state 1 bit error = 32+n states 2 bit error = (32+n)(31+n)/2 states For n=10, this amounts to 1+32+10+21*41 = 904 states that can be encoded with 10 bits of redundancy. Depending on how complex you want your correction machinery to get, you might want to use more bits in order to make multiple error correction less complex.

• Thanks for your answer. Could you please give me one or more sources which discuss your points in details? – Sourav Dev Jun 11 '18 at 10:08
• This answer is mostly nonsensical. – Dilip Sarwate Jun 11 '18 at 13:16