# Nielsen & Chuang Exercise Question on CSS code

I was reading the CSS ( Steane Code) from the Nielsen & Chuang book. It asked in Ex. 10.27 to prove that: suppose $$C_1$$ and $$C_2$$ are $$[n,k_1]$$ and $$[n,k_2]$$classical linear codes such that $$C_2\subset C_1$$ and $$C_1$$ and $$C_2^\perp$$ both correct $$t$$ errors. Codes defined by $$|x+C_2\rangle\equiv \dfrac{1}{\sqrt{|C_2|}}\sum_{y\in C_2}(-1)^{u.y}|x+y+v\rangle$$ and parametrized by $$u$$ and $$v$$ are equivalent to $$\mathrm{CSS}(C_1, C_2)$$ in the sense that they have the same error-correcting properties.

My attempt for this was let the corrupted state be for the bit flip case: $$\dfrac{1}{\sqrt{|C_2|}}\sum_{y\in C_2}(-1)^{u.y}|x+y+v+e_1\rangle$$ now proceeding on the lines of the code $$\mathrm{CSS}(C_1,C_2)$$, I apply the Parity matrix $$H_1$$ for $$C_1$$, on the ancilla to obtain $$\dfrac{1}{\sqrt{|C_2|}}\sum_{y\in C_2}(-1)^{u.y}|x+y+v+e_1\rangle|H_1e_1\rangle$$ where $$H_1(x+y+v)=0$$. so i get the position of the flipped qubit by inspecting the position where $$1$$ occurs.

Now for the phase flip case here is my try $$\dfrac{1}{\sqrt{|C_2|}}\sum_{y\in C_2}(-1)^{u.y}(-1)^{(x+y+v).e_2}|x+y+v\rangle$$ now I apply the Hadamard gate on the qubit to obtain $$\dfrac{1}{\sqrt{|C_2|2^n}}\sum_z\sum_{y\in C_2}(-1)^{u.y}(-1)^{(x+y+v).e_2}(-1)^{(x+y+v).z}|z\rangle$$$$= \dfrac{1}{\sqrt{|C_2|}2^n}\sum_z\sum_{y\in C_2}(-1)^{u.y}(-1)^{(x+y+v).(e_2+z)}|z\rangle$$ Now let $$e_2+z=z'$$, we get $$\dfrac{1}{\sqrt{|C_2|2^n}}\sum_z\sum_{y\in C_2}(-1)^{u.y}(-1)^{(x+y+v).z'}|z'+e\rangle$$, proceeding from here the final step that I got was $$\dfrac{1}{\sqrt{2^n/|C_2|}}\sum_{z'+u\in C_2^{\perp}}(-1)^{(x+v)z'}|z'+e_2\rangle$$, Now is this correct, if so how do I proceed, and what should be the answer?

I am not following all of the calculations in your post (for one thing because your first displayed equation does not mention $$C_1$$), but I know why the goal of the exercise is true. In fact it is true for any code at all, not just a CSS code. If $$\mathcal{C} \subseteq \mathcal{H}_\text{qubit}^{\otimes n}$$ is any code, then you get an equivalent code $$\mathcal{C}'$$ if you apply a separate unitary operator to each of the $$n$$ qubits. After all, the definition of the error properties does not depend on a choice of basis for each for the $$n$$ qubits; who is to say whether the code "is" $$\mathcal{C}$$ or $$\mathcal{C}'$$ before you have chosen qubit bases.
In the case at hand, translation by your vector $$x$$ is equivalent to applying a flip operator $$X$$ in each position $$k$$ with $$x_k = 1$$. So this is just applying independent unitaries (either $$X$$ or $$I$$) for each of the qubits. In fact you can check the error properties in a particularly explicit way, since $$X$$ is a Pauli operator. Applying $$X$$ to the code in some position amounts to replacing the $$Y$$ and $$Z$$ errors with $$-Y$$ and $$-Z$$ and keeping $$X$$ just itself; you can see this from whether they commute or anti-commute.
There is a nifty corollary that applies to all additive codes, not just CSS codes. Namely, an additive code is normally defined by demanding that a set of commuting parity check operators all report the value $$1$$. However, you get an equivalent code if you use any mutual eigenspace of the parity check operators. In fact, if $$\mathcal{C} \subseteq \mathcal{H}_\text{qubit}^{\otimes n}$$ is an additive code, then the outer Hilbert space $$\mathcal{H}_\text{qubit}^{\otimes n}$$ is partitioned into equivalent codes.
We can proceed by applying the parity check matrix $$H_2$$ for $$C_2^\perp$$ on the ancilla, which would become $$\vert H_2(z'+e_2)\rangle =\vert H_2(z'+u + e_2 -u)\rangle =\vert H_2(e_2-u)\rangle$$. Measuring the ancilla gives us $$H_2(e_2-u)$$. As $$u$$ is known. we then know $$H_2 e_2$$, and in turn $$e_2$$. After correcting the now bit flip $$e_2$$, we have: $$\dfrac{1}{\sqrt{2^n/\vert C_2\vert}}\sum_{z'+u\in C_2^{\perp}}(-1)^{(x+v)z'}|z'\rangle \label{eq:1}\tag{\star}$$ We then re-apply Hadamard gates to each qubit of $$\eqref{eq:1}$$, which is equivalent to applying Hadamard gates to the state on the final line of the question $$\dfrac{1}{\sqrt{2^n/\vert C_2\vert}}\sum_{z'+u\in C_2^{\perp}}(-1)^{(x+v)z'}|z'+e_2\rangle$$ with $$e_2=0$$. Hadamard gates are self-inverse, so we get back $$\dfrac{1}{\sqrt{|C_2|}}\sum_{y\in C_2}(-1)^{u\cdot y}(-1)^{(x+y+v)\cdot 0}\vert x+y+v\rangle$$ which is the original encoded state: $$\dfrac{1}{\sqrt{|C_2|}}\sum_{y\in C_2}(-1)^{u\cdot y}\vert x+y+v\rangle$$