# Repetition code encoder circuit

The repetition code encodes $$\vert \psi \rangle = \alpha \vert 0 \rangle + \beta \vert 1 \rangle \rightarrow \vert \psi \rangle = \alpha \vert 000 \rangle + \beta \vert 111 \rangle$$ using the following circuit: where $$t_0: \vert \psi \rangle = (\alpha \vert 0 \rangle + \beta \vert 1 \rangle) \otimes \vert 0 \rangle \otimes \vert 0 \rangle = \alpha \vert 000 \rangle + \beta \vert 100 \rangle$$ $$t_1: \vert \psi \rangle = \alpha \vert 000 \rangle + \beta \vert 110 \rangle$$ $$t_2: \vert \psi \rangle = \alpha \vert 000 \rangle + \beta \vert 111 \rangle$$.

I am wondering what is the operator used from $$t_0$$ to $$t_1$$? I understand that an XOR was applied there to get the desired output but what is the explicit operator (gate-wise or matrix-wise) used?

Furthermore, I tried $$U = \mathbb{I} \otimes \mathbb{X} \otimes \mathbb{I}$$ and applied it to $$\vert \psi \rangle$$ which resulted in $$\vert \psi \rangle = \alpha \vert 010 \rangle + \beta \vert 110 \rangle$$

Operator applied from $$t_{0}$$ to $$t_{1}$$ is $$CNOT \otimes I$$, i.e. $$\begin{equation} U_1= \begin{pmatrix} 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\ \end{pmatrix} \end{equation}$$ As a CNOT gate produces a entangled quantum state, it is not possible to express it as Kronecker product $$I \otimes X$$.

Your operator $$I \otimes X \otimes I$$ means that negation $$X$$ is applied on $$|q_1\rangle$$ and identical operator $$I$$ is applied on $$|q_0\rangle$$ and $$|q_2\rangle$$ always. There is no connection established between $$|q_0\rangle$$ and $$|q_1\rangle$$.

This operation changes your input qubits to $$\alpha|000\rangle + \beta|110\rangle$$.

Operation from $$t_1$$ to $$t_2$$ is decribed by following matrix: $$\begin{equation} U_2= \begin{pmatrix} 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \\ \end{pmatrix} \end{equation}$$

Application of $$U_2U_{1}$$ leads to state $$\alpha|000\rangle + \beta|111\rangle$$.

• Thank you for the comment. Unfortunately, $(CNOT \otimes I) \vert \psi \rangle = \vert \psi \rangle$, it doesn't change the state to $\vert \psi \rangle = \alpha \vert 000 \rangle + \beta \vert 110 \rangle$ Dec 21, 2019 at 1:54
• symbolab.com/solver/step-by-step/… Dec 21, 2019 at 1:56
• The gate you’ve written out is $I\otimes$cnot not cnot$\otimes I$ Dec 21, 2019 at 6:13
• @M.AlJumaily Al: Apologize for my mistake. Now, it should be all right, I checked my calculation in Octave. Dec 21, 2019 at 8:03
• @DaftWullie: Thanks for checking. I recalculated Kronecker product and expanded answer. Now, it should be all right. Dec 21, 2019 at 8:03