# What does it mean for a stabilizer to commute with an error?

I am currently working on the 5-qubit ([[5,1,3]]) code. I need to understand what it means for an error to commute with the stabilizers. I also need to calculate the commutator of an error with the stabilizers. The stabilizers for the 5-qubit code are XZZXI, IXZZX, XIXZZ and ZXIXZ. Can someone provide an example of how to calculate such a commutator? I do have a hard time figuring that out from available literature online. Thank you in advance.

Try writing out each stabilizer as a binary string. In this case, you'll have strings of length 10, the first 5 corresponding to X positions, and the second 5 corresponding to Z positions. Hence, for your first stabilizer, you have $$s_1=\{1,0,0,1,0|0,1,1,0,0\}$$ Now, an error can also be written in this way: $$e=\{x,z\}.$$ From this I can calculate if the two commute: $$s_1\cdot\{z,x\}\equiv 0\text{ mod }2.$$ Note that I switch the order the $$x$$ and $$z$$ (this is because I wantto count the number of positions in which X and Z operators meet, since these are the ones that anticommute). Thus, if I construct a matrix $$S=\left(\begin{array}{c} s_1 \\ s_2 \\ s_3 \\ s_4 \end{array}\right)$$ then any vector that is a null vector modulo 2 (i.e. is an eigenvector of 0 eigenvalue) specifies an operator that commutes.
NullSpace[S,Modulus->2]