# Why are the planar surface codes in articles always of odd distance?

I have been playing around with the qecsim Python library and a question has come to my thoght. Whenever I try to represent the logical error rate dependence with the physical error rate for several planar code distances the even ones do not intersect with the probability threshold, but the rest always do. Then I saw that most of the articles consider odd distances. Why is that?

My first thought has been to be the existence of a given symmetry for even distance codes which make their error detection to be worse, but I am not sure. I have been looking for the answer in articles online but could not find it. Does anyone know why?

Thank you very much in advance!

I ran some simulations to answer this question. I did min(100M shots, 1K errors) runs of distances 2-9 and error rates 0.001-0.01. I used Stim's default surface code circuits and only depolarizing noise on Clifford operations no other noise. I checked how often the decoder predicted the observable correctly from the detection events. More concretely, I followed this readme with some adjustments on the exact cases and the decoder used and etc.

Note the stair steps on the left of the plot, rather than nice smooth lines. That's why people avoid even code distances.

The stair steps become more prominent as your physical error rate decreases (downward on the plot), and less prominent as your distance increases (rightward on the plot). Practical quantum computers will probably use high distances so ironically caring about the even/odd distinction might go away as the field starts to do "real scale" stuff rather than toy small distance stuff.

For even $$d$$, the threshold will be different, because you will have to make a round. The threshold is determined by half of the distance of the code, since you need more than half distance errors, if you want the logical error to happen. In case of more than half errors, the decoder will misinterpret the correct logical value.

According to "Surface codes: Towards practical large-scale quantum computation" (2012) :

It makes more sense to look at odd-distance codes since the number of errors that can be corrected for a code of distance d is $$\lfloor(d-1)/2\rfloor$$. It’s easiest to see this in the case of a repetition code: here you can do a majority vote, and the majority will be correct as long as the number of errors is no more than $$\lfloor(d-1)/2\rfloor$$.

The interesting thing is that this remains correct for more complex codes such as the surface code. Intuitively you can think about the code words as spheres packed in some abstract space - the distance between spheres is about 2r, which is the code distance, and you’ll be able to associate an erroneous message with the original one as long as it remains within the radius of the original sphere.