# Link between distance of a stabilizer code and number of errors it is able to correct

I am confused by a property.

In the N&Chuang it is said that an $$[n,k,2t+1]$$ stabilizer code is able to correct up to $$t$$ errors. But for me if the code has distance $$d$$ it should be able to correct up to $$d-1$$ error.

Indeed, the distance of a quantum code is defined as the minimal weight of an element in $$Z(S)-S$$ (uncorrectable errors).

But then, if my error has a weight $$d-1$$, it is not in $$Z(S)-S$$ and I will be able to correct it ? Thus an $$[n,k,d]$$ code is able to correct up to $$d-1$$ error.

Where is my mistake ?

This question applies equally to classical codes, and is perhaps easier to understand in that context. Consider, for example, the 5-bit repetition code. The code words are $$00000\qquad 11111$$ Clearly, the distance $$d=5$$ because it takes 5 bit flips to convert from one code word to the other. Now, let's imagine some errors have happened. We look at our bits and read $$11101$$ What has happened? It's actually ambiguous. Either our codeword was 00000 and errors have happened on bits 1,2,3,5 or the codeword was 11111 and there was a single error on bit 4. With the underlying assumption that errors are unlikely, we will always resolve the ambiguity by assuming it was the most likely error sequence, i.e. the one consisting of fewest errors. So, even if it were the case that 4 errors had happened, we have no way of knowing that. We'd perform the wrong correction. So, when is correction successful? If the number of errors leaves us closer to our original codeword than the other codeword. In other words, if $$d=2t+1$$, then we can correct for $$t$$ errors. In this specific case, $$t=2$$.
• Thank you for your answer. I agree with you for classical codes. However the definition of distance in term of stabilizer code is not (as far as I understand so I may be wrong) the distance between two code words. Instead it is the minimal weight of an element in $Z(S)-S$. With respect to this definition I am not sure to see the connection. – StarBucK Sep 2 '19 at 8:49
• @StarBucK I'm not so used to using the notation that you are, but $Z(S)-S$ are basically the terms that commute with the stabilizers, right? In other words, they're the logical operators of the code (they preserve the code space). So the size of the operator is the number of single-site errors that convert one logical state to another. This is the distance, just as it is in classical. – DaftWullie Sep 2 '19 at 9:00
From my understanding of the concept, the weight of an error $$E \in G_n$$, where $$G_n$$ represents the n-fold Pauli group, is defined as the number of terms in the tensor product that are not equal to $$I$$ (the identity operator). Therefore, according to this definition, error sequences of weight $$t$$ correspond to sequences that have errors in $$t$$ qubits.
The distance $$d$$ of a stabilizer code is defined as the minimum weight of an element that belongs to the set defined as the centralizer minus the stabilizer: $$Z(S) - S$$. This set contains all the elements that commute with $$S$$ but don't actually belong to $$S$$. The Pauli operators that belong to $$Z(S) - S$$ are such that $$<\psi_i|E_a|\psi_j>\neq c_{a}\delta_{ij}$$, where $$E_a \in [Z(s) - S]$$.
Therefore, based on our definition of distance, a stabilizer code will be able to correct $$t$$ errors if the error set $$\mathbb{E}$$ used for recovery includes all Pauli operators of weights $$t$$ or less. The definition given for distance implies that the criterion for error correction $$<\psi_i|E_a^{\dagger}E_b|\psi_j> =c_{ab}\delta{ij}$$ will be fulfilled by Pauli operators of weight $$t$$ or less, provided that $$d \geq 2t + 1$$. Thus if $$d=2t+1$$, the stabilizer code will be able to correct $$t$$ errors.