# Why aren’t repetition codes used to encode qubits in superposition states?

I just finished reading the section of the qiskit textbook on quantum error correction using repetition codes(https://qiskit.org/textbook/ch-quantum-hardware/error-correction-repetition-code.html) and based on the experiments they ran, I’m only seeing repetition codes being used to encode logical bits (i.e. qubits in their independent $$|0\rangle$$ or $$|1\rangle$$ basis states).

I thought the whole purpose of developing the syndrome measurement technique was to prevent the breakdown of qubits in superposition. But then the experiments just went on to use it for encoding qubits that are not in superposition (logical bits) instead.

Was this done solely for simplicity or does the RepetitionCode object currently not allow us to do experiments on qubits in superposition?

To see that the repetition code is not much use as a quantum error correcting code, think about a qubit with logical states $$|000\rangle$$ and $$|111\rangle$$. We encode the $$|+\rangle$$ state as $$|+\rangle=\frac{1}{\sqrt{2}}(|000\rangle+|111\rangle).$$ Now if we had a single $$Z$$ error occurring on any one qubit, we would instead have $$|-\rangle=\frac{1}{\sqrt{2}}(|000\rangle-|111\rangle).$$ In other words, logical $$Z$$ has been applied with just a single error. The code is distance 1 and does not protect against $$Z$$ errors at all. The repetition code does not protect superpositions.
The idea is that if you can understand the processes being demonstrated, then they work equally well for superpositions (this is the point of the linearity of quantum mechanics), you just need to use a different code for it to work well, one with built-in protection against $$Z$$ errors as well.
To understand the answer of this question you have to look into no cloning theorem which states that you can't make a copy of an unknown quantum state. e.g. $$\alpha|0> + \beta|1>$$ where you don't exactly know the values of $$\alpha$$ and $$\beta$$. but you can make copy of states like $$|0>$$, $$|1>$$ or $$\frac{1}{\sqrt2}(|0>+|1>)$$. So unlike classical bits you can't repeat unknown qubits. That's why we use the property of entanglement in quantum error correction codes. Let's look t the proof of the theorem. We want to copy the state $$|\psi>$$ and create the state $$|\psi>\otimes|\psi>$$.
Consider an initial state $$|\psi>\otimes |s>$$ where $$|s>$$ is some arbitrary pure state. Now acting a unitary operator in this input state should give us our desirable result. Let U be the unitary operator that does this copying operation.
So, $$U(|\psi>\otimes |s>) = |\psi>\otimes|\psi>$$
Suppose this procedure works for two states $$|\psi>$$ and $$|\phi>$$. Then,
$$U(|\phi>\otimes |s>) = |\phi>\otimes|\phi>$$
Taking inner product of these two equation gives $$<\psi|\phi> = (<\psi|\phi>)^2$$ . So, either $$<\psi|\phi> = 0$$ or $$1$$. Either $$|\psi> = |\phi>$$ or they are orthogonal. Thus a cloning device can only clone states which are orthogonal to each other. So, general cloning device is not possible.