# How to interpret the encoding circuit for the 5-qubit QECC

I have a question on circuit which constitutes the sydnrome measurement for the 5-qubit error correcting code. If I focus on just a portion of the circuit:

Reference for image. The full circuit can be found on page $$3$$ of the Notebook just referenced.

So I have a five qubit state $$|\psi\rangle$$ and an ancilla qubit in the $$|0\rangle$$ state.

If, for example, we say the state $$|\psi\rangle = |0_{5L}\rangle$$, I am a litte confused as to the circuit works.

1. We begin with the $$|000000\rangle$$ state
2. We apply the Hadamard operator to the first qubit, so the resulting state is $$|+00000\rangle$$
3. The 1st qubit is the control qubit and the 2nd qubit is the target qubit. But I am not quite sure how this works for the Pauli matrices? I know that for the CNOT operation, if the control qubit is in the $$|1\rangle$$ state, then the target qubit undergoes a bit flip. How does this work in this circuit with the Pauli matrices?
4. I have the same gap in understanding for the next few steps.

From Nielsen and Chuang's textbook, $$|c\rangle |t\rangle \rightarrow |c\rangle U^{c}|t\rangle$$ "If the control qubit is set than $$U$$ is applied to the target, otherwise it is left alone."

So perhaps my question would be better summarised as, what does it mean for the control qubit to be "set"?

• can you add the source of the image/question?
– glS
Oct 19, 2023 at 12:32
• Oops, edited the question to include the source for the picture, thanks for letting me know! Oct 19, 2023 at 13:16

...From Nielsen and Chuang's textbook, $$|c> |t> \rightarrow |c> U^{c}|t>$$ "If the control qubit is set than $$U$$ is applied to the target, otherwise it is left alone."

So perhaps my question would be better summarised as, what does it mean for the control qubit to be "set"?

The control qubit is "set" if it is $$|1\rangle$$ and not set if it is $$|0\rangle$$.

In this answer I will use the $$\otimes$$ symbol to indicate the direct product of qubits. So, instead of writing $$|a\rangle|b\rangle$$ I will write $$|a\rangle\otimes|b\rangle$$.

With the above notation we have, for example: $$|0\rangle\otimes|t\rangle\to|0\rangle\otimes|t\rangle$$ and $$|1\rangle\otimes|t\rangle\to|1\rangle \otimes\left(U|t\rangle\right)$$

And for an arbitrary superposition of the control bit: $$\left(\alpha|0\rangle+\beta|1\rangle\right)\otimes|t\rangle \to \left(\alpha|0\rangle\otimes|t\rangle+\beta|1\rangle\otimes(U|t\rangle)\right)$$

You can also understand the action of a controlled $$U$$ gate in terms of projection operators. The controlled $$U$$ gate can be written as: $$|0\rangle\langle 0|\otimes \mathbf{1} + |1\rangle\langle 1|\otimes U$$