# Standard form Shor's code

I'm trying to solve exercise 10.57 in Nielsen-Chuang, where you have to obtain the standard form check matrix of Shor's code. I followed the procedure laid out in the earlier chapter but then realised that applying the Gauss-Jordan method seems to leave a negative value on my $$Z$$-side.

How to interpret this, or have I just made a mistake? Here's my result: $$\begin{bmatrix} \left.\begin{matrix} 1& 0& 1& 1& 1& 0& 0& 0& 1\\ 0& 1& 0& 1& 1& 1& 0& 1& 1\\ 0& 0& 0& 0& 0& 0& 0& 0& 0\\ 0& 0& 0& 0& 0& 0& 0& 0& 0\\ 0& 0& 0& 0& 0& 0& 0& 0& 0\\ 0& 0& 0& 0& 0& 0& 0& 0& 0\\ 0& 0& 0& 0& 0& 0& 0& 0& 0\\ 0& 0& 0& 0& 0& 0& 0& 0& 0 \end{matrix}\right| \begin{matrix} 0& 0& 0& 0& 0& 0& 0& 0& 0\\ 0& 0& 0& 0& 0& 0& 0& 0& 0\\ 0& 0& 1& 0& 0& 0& 0& 0& 0\\ 0& 0& 0& 1& 0& 0& 0& 0& -1\\ 0& 0& 0& 0& 1& 0& 0& 0& 1\\ 1& 0& 0& 0& 0& 1& 0& 0& 0\\ 0& 1& 0& 0& 0& 0& 1& 0& 0\\ 0& 0& 0& 0& 0& 0& 0& 1& 0 \end{matrix} \end{bmatrix}$$

• Haven't verified your matrix, but note that linear algebra in this context is taking place over the field $\mathbb{Z}_2$, so you should not be worried about -1 since -1=1. Commented Dec 7, 2020 at 18:39
• Thanks, that's the information I was looking for.
– otto
Commented Dec 7, 2020 at 23:15
• I think you do have errors - all the Z-rows should have even weight. Commented Dec 8, 2020 at 7:40

My result is $$\left[\begin{array}{ccccccccc|ccccccccc} 1 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 1 & 1 & 0 & 1 & 1 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 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 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 1 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 1 \end{array} \right]$$ Finally, use Gaussian elimination to get the standard form.

Cheers.

• Please add additional information, e.g. how you reached these results. Commented Dec 14, 2022 at 7:19
• @MartinVesely Added Commented Dec 16, 2022 at 4:23